public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Liu Bo <bo.liu@linux.alibaba.com>
To: <linux-block@vger.kernel.org>
Subject: [PATCH] Block: initialize bio_cnt_ret_time for the first time
Date: Thu, 21 Jun 2018 11:07:04 +0800	[thread overview]
Message-ID: <1529550424-105210-1-git-send-email-bo.liu@linux.alibaba.com> (raw)

When a new tg is created, tg->bio_cnt_ret_time is 0, so if the first
IO going thru this tg turns out to be a bad one, we fail to record it
in tg->bad_bio_cnt as

if (jiffies > bio_cnt_ret_time) {
	tg->bad_bio_cnt /= 2;
}

Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
---
 block/blk-throttle.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 82282e6fdcf8..8bd54118dc0a 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -2329,6 +2329,8 @@ void blk_throtl_bio_endio(struct bio *bio)
 		tg->bio_cnt++;
 	}
 
+	if (unlikely(!tg->bio_cnt_reset_time))
+		tg->bio_cnt_reset_time = jiffies;
 	if (time_after(jiffies, tg->bio_cnt_reset_time) || tg->bio_cnt > 1024) {
 		tg->bio_cnt_reset_time = tg->td->throtl_slice + jiffies;
 		tg->bio_cnt /= 2;
-- 
1.8.3.1

             reply	other threads:[~2018-06-21  3:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-21  3:07 Liu Bo [this message]
2018-06-29 19:50 ` [PATCH] Block: initialize bio_cnt_ret_time for the first time Liu Bo
2018-06-29 20:00 ` Jens Axboe
2018-06-29 20:23   ` Liu Bo
2018-06-29 20:26     ` Jens Axboe
2018-06-29 20:43       ` Liu Bo
2018-06-29 20:46         ` Jens Axboe
2018-06-29 21:41           ` Liu Bo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1529550424-105210-1-git-send-email-bo.liu@linux.alibaba.com \
    --to=bo.liu@linux.alibaba.com \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox