Skip to content

Commit

Permalink
md/raid1/10: add missed blk plug
Browse files Browse the repository at this point in the history
flush_pending_writes isn't always called with block plug, so add it, and plug
works in nested way.

Signed-off-by: Shaohua Li <[email protected]>
  • Loading branch information
shligit committed Dec 1, 2017
1 parent d2e2ec8 commit 18022a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/md/raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,11 +809,15 @@ static void flush_pending_writes(struct r1conf *conf)
spin_lock_irq(&conf->device_lock);

if (conf->pending_bio_list.head) {
struct blk_plug plug;
struct bio *bio;

bio = bio_list_get(&conf->pending_bio_list);
conf->pending_count = 0;
spin_unlock_irq(&conf->device_lock);
blk_start_plug(&plug);
flush_bio_list(conf, bio);
blk_finish_plug(&plug);
} else
spin_unlock_irq(&conf->device_lock);
}
Expand Down
4 changes: 4 additions & 0 deletions drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -894,10 +894,13 @@ static void flush_pending_writes(struct r10conf *conf)
spin_lock_irq(&conf->device_lock);

if (conf->pending_bio_list.head) {
struct blk_plug plug;
struct bio *bio;

bio = bio_list_get(&conf->pending_bio_list);
conf->pending_count = 0;
spin_unlock_irq(&conf->device_lock);
blk_start_plug(&plug);
/* flush any pending bitmap writes to disk
* before proceeding w/ I/O */
bitmap_unplug(conf->mddev->bitmap);
Expand All @@ -918,6 +921,7 @@ static void flush_pending_writes(struct r10conf *conf)
generic_make_request(bio);
bio = next;
}
blk_finish_plug(&plug);
} else
spin_unlock_irq(&conf->device_lock);
}
Expand Down

0 comments on commit 18022a1

Please sign in to comment.