summaryrefslogtreecommitdiff
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2023-05-29 21:11:01 +0800
committerSong Liu <song@kernel.org>2023-06-13 15:25:43 -0700
commit5ec6ca140a034682e421e2e808ef5ddfdfd65242 (patch)
treee8a4f1e657acb12536ac988ca174d4896c3bcb30 /drivers/md/raid1.c
parent010444623e7f4da6b4a4dd603a7da7469981e293 (diff)
md/raid1-10: factor out a helper to add bio to plug
The code in raid1 and raid10 is identical, prepare to limit the number of plugged bios. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20230529131106.2123367-3-yukuai1@huaweicloud.com
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 220f6ce761a5..92180f3a9f28 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1346,8 +1346,6 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
struct bitmap *bitmap = mddev->bitmap;
unsigned long flags;
struct md_rdev *blocked_rdev;
- struct blk_plug_cb *cb;
- struct raid1_plug_cb *plug = NULL;
int first_clone;
int max_sectors;
bool write_behind = false;
@@ -1576,15 +1574,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
r1_bio->sector);
/* flush_pending_writes() needs access to the rdev so...*/
mbio->bi_bdev = (void *)rdev;
-
- cb = blk_check_plugged(raid1_unplug, mddev, sizeof(*plug));
- if (cb)
- plug = container_of(cb, struct raid1_plug_cb, cb);
- else
- plug = NULL;
- if (plug) {
- bio_list_add(&plug->pending, mbio);
- } else {
+ if (!raid1_add_bio_to_plug(mddev, mbio, raid1_unplug)) {
spin_lock_irqsave(&conf->device_lock, flags);
bio_list_add(&conf->pending_bio_list, mbio);
spin_unlock_irqrestore(&conf->device_lock, flags);