diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2024-05-28 13:32:34 +0200 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2024-06-26 11:32:39 -0400 |
commit | aaa53168cbcc486ca1927faac00bd99e81d4ff04 (patch) | |
tree | 817b2893bc4545fdc9f8a364917e39222b980ab4 /drivers/md/dm-table.c | |
parent | cf546dd289e0f6d2594c25e2fb4e19ee67c6d988 (diff) | |
download | linux-aaa53168cbcc486ca1927faac00bd99e81d4ff04.tar.gz linux-aaa53168cbcc486ca1927faac00bd99e81d4ff04.tar.bz2 linux-aaa53168cbcc486ca1927faac00bd99e81d4ff04.zip |
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 <mpatocka@redhat.com>
Reviewed-by: Mike Snitzer <snitzer@kernel.org>
Suggested-by: Yang Yang <yang.yang@vivo.com>
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r-- | drivers/md/dm-table.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 92d18dcdb3e9..33b7a1844ed4 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -160,6 +160,7 @@ int dm_table_create(struct dm_table **result, blk_mode_t mode, t->type = DM_TYPE_NONE; t->mode = mode; t->md = md; + t->flush_bypasses_map = true; *result = t; return 0; } @@ -748,6 +749,9 @@ int dm_table_add_target(struct dm_table *t, const char *type, if (ti->limit_swap_bios && !static_key_enabled(&swap_bios_enabled.key)) static_branch_enable(&swap_bios_enabled); + if (!ti->flush_bypasses_map) + t->flush_bypasses_map = false; + return 0; bad: |