Commit 81ba3c24 authored by Pankaj Gupta's avatar Pankaj Gupta Committed by Song Liu

md: improve variable names in md_flush_request()

This patch improves readability by using better variable names
in flush request coalescing logic.
Signed-off-by: default avatarPankaj Gupta <pankaj.gupta@cloud.ionos.com>
Reviewed-by: default avatarPaul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
parent 93decc56
...@@ -639,7 +639,7 @@ static void md_submit_flush_data(struct work_struct *ws) ...@@ -639,7 +639,7 @@ static void md_submit_flush_data(struct work_struct *ws)
* could wait for this and below md_handle_request could wait for those * could wait for this and below md_handle_request could wait for those
* bios because of suspend check * bios because of suspend check
*/ */
mddev->last_flush = mddev->start_flush; mddev->prev_flush_start = mddev->start_flush;
mddev->flush_bio = NULL; mddev->flush_bio = NULL;
wake_up(&mddev->sb_wait); wake_up(&mddev->sb_wait);
...@@ -660,13 +660,13 @@ static void md_submit_flush_data(struct work_struct *ws) ...@@ -660,13 +660,13 @@ static void md_submit_flush_data(struct work_struct *ws)
*/ */
bool md_flush_request(struct mddev *mddev, struct bio *bio) bool md_flush_request(struct mddev *mddev, struct bio *bio)
{ {
ktime_t start = ktime_get_boottime(); ktime_t req_start = ktime_get_boottime();
spin_lock_irq(&mddev->lock); spin_lock_irq(&mddev->lock);
wait_event_lock_irq(mddev->sb_wait, wait_event_lock_irq(mddev->sb_wait,
!mddev->flush_bio || !mddev->flush_bio ||
ktime_after(mddev->last_flush, start), ktime_after(mddev->prev_flush_start, req_start),
mddev->lock); mddev->lock);
if (!ktime_after(mddev->last_flush, start)) { if (!ktime_after(mddev->prev_flush_start, req_start)) {
WARN_ON(mddev->flush_bio); WARN_ON(mddev->flush_bio);
mddev->flush_bio = bio; mddev->flush_bio = bio;
bio = NULL; bio = NULL;
......
...@@ -495,9 +495,9 @@ struct mddev { ...@@ -495,9 +495,9 @@ struct mddev {
*/ */
struct bio *flush_bio; struct bio *flush_bio;
atomic_t flush_pending; atomic_t flush_pending;
ktime_t start_flush, last_flush; /* last_flush is when the last completed ktime_t start_flush, prev_flush_start; /* prev_flush_start is when the previous completed
* flush was started. * flush was started.
*/ */
struct work_struct flush_work; struct work_struct flush_work;
struct work_struct event_work; /* used by dm to report failure event */ struct work_struct event_work; /* used by dm to report failure event */
mempool_t *serial_info_pool; mempool_t *serial_info_pool;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment