From aaa53168cbcc486ca1927faac00bd99e81d4ff04 Mon Sep 17 00:00:00 2001 From: Mikulas Patocka Date: Tue, 28 May 2024 13:32:34 +0200 Subject: dm: optimize flushes Device mapper sends flush bios to all the targets and the targets send it to the underlying device. That may be inefficient, for example if a table contains 10 linear targets pointing to the same physical device, then device mapper would send 10 flush bios to that device - despite the fact that only one bio would be sufficient. This commit optimizes the flush behavior. It introduces a per-target variable flush_bypasses_map - it is set when the target supports flush optimization - currently, the dm-linear and dm-stripe targets support it. When all the targets in a table have flush_bypasses_map, flush_bypasses_map on the table is set. __send_empty_flush tests if the table has flush_bypasses_map - and if it has, no flush bios are sent to the targets via the "map" method and the list dm_table->devices is iterated and the flush bios are sent to each member of the list. Signed-off-by: Mikulas Patocka Reviewed-by: Mike Snitzer Suggested-by: Yang Yang --- drivers/md/dm-core.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/md/dm-core.h') diff --git a/drivers/md/dm-core.h b/drivers/md/dm-core.h index 14a44c0f8286..3637761f3585 100644 --- a/drivers/md/dm-core.h +++ b/drivers/md/dm-core.h @@ -206,6 +206,8 @@ struct dm_table { bool integrity_supported:1; bool singleton:1; + /* set if all the targets in the table have "flush_bypasses_map" set */ + bool flush_bypasses_map:1; /* * Indicates the rw permissions for the new logical device. This -- cgit v1.2.3