Thread (7 messages) 7 messages, 4 authors, 2020-11-16

Re: [PATCH 1/3] md: improve variable names in md_flush_request()

From: Pankaj Gupta <hidden>
Date: 2020-11-11 07:22:40
Also in: lkml

Hi Paul,
quoted
  This patch improves readability by using better variable names
  in flush request coalescing logic.
Please do not indent the commit message.
o.k
quoted
Signed-off-by: Pankaj Gupta <redacted>
---
  drivers/md/md.c | 8 ++++----
  drivers/md/md.h | 6 +++---
  2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 98bac4f304ae..167c80f98533 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -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
       * bios because of suspend check
       */
-     mddev->last_flush = mddev->start_flush;
+     mddev->prev_flush_start = mddev->start_flush;
      mddev->flush_bio = NULL;
      wake_up(&mddev->sb_wait);
@@ -660,13 +660,13 @@ static void md_submit_flush_data(struct work_struct *ws)
   */
  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);
      wait_event_lock_irq(mddev->sb_wait,
                          !mddev->flush_bio ||
-                         ktime_after(mddev->last_flush, start),
+                         ktime_after(mddev->prev_flush_start, req_start),
                          mddev->lock);
-     if (!ktime_after(mddev->last_flush, start)) {
+     if (!ktime_after(mddev->prev_flush_start, req_start)) {
              WARN_ON(mddev->flush_bio);
              mddev->flush_bio = bio;
              bio = NULL;
diff --git a/drivers/md/md.h b/drivers/md/md.h
index ccfb69868c2e..2292c847f9dd 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -495,9 +495,9 @@ struct mddev {
       */
      struct bio *flush_bio;
      atomic_t flush_pending;
-     ktime_t start_flush, last_flush; /* last_flush is when the last completed
-                                       * flush was started.
-                                       */
+     ktime_t start_flush, prev_flush_start; /* prev_flush_start is when the previous completed
+                                             * flush was started.
+                                             */
With the new variable name, the comment could even be removed. ;-)
quoted
      struct work_struct flush_work;
      struct work_struct event_work;  /* used by dm to report failure event */
      mempool_t *serial_info_pool;
Reviewed-by: Paul Menzel <redacted>
Thanks,
Pankaj

Kind regards,

Paul
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help