diff options
author | Shaohua Li <shli@fb.com> | 2017-05-10 17:47:11 +0200 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-05-12 00:32:17 +0200 |
commit | 23b245c04d0ef408087430dd4d1b214a5da1eb78 (patch) | |
tree | 229ffbbf1bb96ef604d59c4af9ed28d062c1d566 /drivers/md/raid10.c | |
parent | md/raid5-cache: in r5l_do_submit_io(), submit io->split_bio first (diff) | |
download | linux-23b245c04d0ef408087430dd4d1b214a5da1eb78.tar.xz linux-23b245c04d0ef408087430dd4d1b214a5da1eb78.zip |
md/raid1/10: avoid unnecessary locking
If we add bios to block plugging list, locking is unnecessry, since the block
unplug is guaranteed not to run at that time.
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 6b86a0032cf8..4343d7ff9916 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1282,17 +1282,16 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio, plug = container_of(cb, struct raid10_plug_cb, cb); else plug = NULL; - spin_lock_irqsave(&conf->device_lock, flags); if (plug) { bio_list_add(&plug->pending, mbio); plug->pending_cnt++; } else { + spin_lock_irqsave(&conf->device_lock, flags); bio_list_add(&conf->pending_bio_list, mbio); conf->pending_count++; - } - spin_unlock_irqrestore(&conf->device_lock, flags); - if (!plug) + spin_unlock_irqrestore(&conf->device_lock, flags); md_wakeup_thread(mddev->thread); + } } static void raid10_write_request(struct mddev *mddev, struct bio *bio, |