summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorPankaj Gupta <pankaj.gupta@cloud.ionos.com>2020-11-11 06:16:57 +0100
committerSong Liu <songliubraving@fb.com>2020-11-30 19:12:34 +0100
commit204d1a6434158ac655fc4037f29742b9b6103f0e (patch)
tree73691a29783d479cadda64c08f45517ac503ace1 /drivers/md
parentmd: improve variable names in md_flush_request() (diff)
downloadlinux-204d1a6434158ac655fc4037f29742b9b6103f0e.tar.xz
linux-204d1a6434158ac655fc4037f29742b9b6103f0e.zip
md: add comments in md_flush_request()
Request coalescing logic is dependent on flush time update in other context. This patch adds comments to understand the code flow better. Signed-off-by: Pankaj Gupta <pankaj.gupta@cloud.ionos.com> Signed-off-by: Song Liu <songliubraving@fb.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 3992e8c5c0d6..a0998ad6388c 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -662,10 +662,14 @@ bool md_flush_request(struct mddev *mddev, struct bio *bio)
{
ktime_t req_start = ktime_get_boottime();
spin_lock_irq(&mddev->lock);
+ /* flush requests wait until ongoing flush completes,
+ * hence coalescing all the pending requests.
+ */
wait_event_lock_irq(mddev->sb_wait,
!mddev->flush_bio ||
ktime_after(mddev->prev_flush_start, req_start),
mddev->lock);
+ /* new request after previous flush is completed */
if (!ktime_after(mddev->prev_flush_start, req_start)) {
WARN_ON(mddev->flush_bio);
mddev->flush_bio = bio;