From: Shaohua Li Date: Thu, 23 Feb 2017 20:26:41 +0000 (-0800) Subject: md/raid10: submit bio directly to replacement disk X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=634fd953630e9ea59072e0d44c614d8b6446d93c;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git md/raid10: submit bio directly to replacement disk commit 6d399783e9d4e9bd44931501948059d24ad96ff8 upstream. Commit 57c67df(md/raid10: submit IO from originating thread instead of md thread) submits bio directly for normal disks but not for replacement disks. There is no point we shouldn't do this for replacement disks. Cc: NeilBrown Signed-off-by: Shaohua Li Signed-off-by: Willy Tarreau --- diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index f53f4f895502..b4de9c3e5ca4 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1569,11 +1569,24 @@ retry_write: mbio->bi_private = r10_bio; atomic_inc(&r10_bio->remaining); + + cb = blk_check_plugged(raid10_unplug, mddev, + sizeof(*plug)); + if (cb) + plug = container_of(cb, struct raid10_plug_cb, + cb); + else + plug = NULL; spin_lock_irqsave(&conf->device_lock, flags); - bio_list_add(&conf->pending_bio_list, mbio); - conf->pending_count++; + if (plug) { + bio_list_add(&plug->pending, mbio); + plug->pending_cnt++; + } else { + bio_list_add(&conf->pending_bio_list, mbio); + conf->pending_count++; + } spin_unlock_irqrestore(&conf->device_lock, flags); - if (!mddev_check_plugged(mddev)) + if (!plug) md_wakeup_thread(mddev->thread); } }