aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/md/raid1-10.c
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2023-05-29 21:11:03 +0800
committerSong Liu <song@kernel.org>2023-06-13 15:25:44 -0700
commit7db922bae3abdf0a1db81ef7228cc0b996a0c1e3 (patch)
treec033c61f7fa1d3fb874ce1c8282852da0631913d /drivers/md/raid1-10.c
parentmd/raid1-10: factor out a helper to submit normal write (diff)
downloadwireguard-linux-7db922bae3abdf0a1db81ef7228cc0b996a0c1e3.tar.xz
wireguard-linux-7db922bae3abdf0a1db81ef7228cc0b996a0c1e3.zip
md/raid1-10: submit write io directly if bitmap is not enabled
Commit 6cce3b23f6f8 ("[PATCH] md: write intent bitmap support for raid10") add bitmap support, and it changed that write io is submitted through daemon thread because bitmap need to be updated before write io. And later, plug is used to fix performance regression because all the write io will go to demon thread, which means io can't be issued concurrently. However, if bitmap is not enabled, the write io should not go to daemon thread in the first place, and plug is not needed as well. Fixes: 6cce3b23f6f8 ("[PATCH] md: write intent bitmap support for raid10") Signed-off-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20230529131106.2123367-5-yukuai1@huaweicloud.com
Diffstat (limited to 'drivers/md/raid1-10.c')
-rw-r--r--drivers/md/raid1-10.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c
index 21b0ff3ca4f0..52469e460dab 100644
--- a/drivers/md/raid1-10.c
+++ b/drivers/md/raid1-10.c
@@ -132,9 +132,18 @@ static inline bool raid1_add_bio_to_plug(struct mddev *mddev, struct bio *bio,
blk_plug_cb_fn unplug)
{
struct raid1_plug_cb *plug = NULL;
- struct blk_plug_cb *cb = blk_check_plugged(unplug, mddev,
- sizeof(*plug));
+ struct blk_plug_cb *cb;
+
+ /*
+ * If bitmap is not enabled, it's safe to submit the io directly, and
+ * this can get optimal performance.
+ */
+ if (!md_bitmap_enabled(mddev->bitmap)) {
+ raid1_submit_write(bio);
+ return true;
+ }
+ cb = blk_check_plugged(unplug, mddev, sizeof(*plug));
if (!cb)
return false;