On 9/12/25 12:56 PM, Mikulas Patocka wrote:
If the table has only linear targets and there is just one underlying
device, we can optimize REQ_PREFLUSH with data - we don't have to split
it to two bios - a flush and a write. We can pass it to the linear target
directly.
Thanks! Since this patch works fine on my test setup:
Tested-by: Bart Van Assche <bvanassche@xxxxxxx>
@@ -1996,11 +1993,19 @@ static void dm_split_and_process_bio(str
}
init_clone_info(&ci, io, map, bio, is_abnormal);
- if (bio->bi_opf & REQ_PREFLUSH) {
+ if (unlikely((bio->bi_opf & REQ_PREFLUSH) != 0)) {
+ if (map->flush_bypasses_map) {
How map->flush_bypasses_map makes submitting REQ_PREFLUSH bios that have
data safe is nontrivial so it's probably a good idea to explain this in
a comment.
+ struct list_head *devices = dm_table_get_devices(map);
+ if (devices->next == devices->prev)
+ goto send_preflush_with_data;
Should it be explained in a comment that devices->next == devices->prev
checks whether there are either no elements or one element in the list
and that we know that the devices list is not empty?
+ }
+ if (bio->bi_iter.bi_size)
+ io->requeue_flush_with_data = true;
__send_empty_flush(&ci);
/* dm_io_complete submits any data associated with flush */
goto out;
}
+send_preflush_with_data:
if (static_branch_unlikely(&zoned_enabled) &&
(bio_op(bio) == REQ_OP_ZONE_RESET_ALL)) {
Isn't it recommended to leave a blank line above goto labels rather than
below?
Thanks,
Bart.