From patchwork Thu Jun 21 03:07:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 10479095 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C30E6604D3 for ; Thu, 21 Jun 2018 03:07:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A691728A52 for ; Thu, 21 Jun 2018 03:07:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99B7628A89; Thu, 21 Jun 2018 03:07:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E612128A52 for ; Thu, 21 Jun 2018 03:07:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754501AbeFUDHV (ORCPT ); Wed, 20 Jun 2018 23:07:21 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:55055 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754451AbeFUDHV (ORCPT ); Wed, 20 Jun 2018 23:07:21 -0400 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R201e4; CH=green; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e07488; MF=bo.liu@linux.alibaba.com; NM=1; PH=DS; RN=1; SR=0; TI=SMTPD_---0T34s6uT_1529550428; Received: from localhost(mailfrom:bo.liu@linux.alibaba.com fp:SMTPD_---0T34s6uT_1529550428) by smtp.aliyun-inc.com(127.0.0.1); Thu, 21 Jun 2018 11:07:08 +0800 From: Liu Bo To: Subject: [PATCH] Block: initialize bio_cnt_ret_time for the first time Date: Thu, 21 Jun 2018 11:07:04 +0800 Message-Id: <1529550424-105210-1-git-send-email-bo.liu@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;