From patchwork Fri Jan 19 03:09:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Qi X-Patchwork-Id: 10174493 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 2DAC1602B8 for ; Fri, 19 Jan 2018 03:09:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15E0728329 for ; Fri, 19 Jan 2018 03:09:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A690283FF; Fri, 19 Jan 2018 03:09:26 +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=-6.9 required=2.0 tests=BAYES_00, 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 4C06F28329 for ; Fri, 19 Jan 2018 03:09:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754836AbeASDJY (ORCPT ); Thu, 18 Jan 2018 22:09:24 -0500 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:46944 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752855AbeASDJY (ORCPT ); Thu, 18 Jan 2018 22:09:24 -0500 X-Alimail-AntiSpam: AC=CONTINUE; BC=0.08147011|-1; CH=green; FP=0|0|0|0|0|-1|-1|-1; HT=e01e04421; MF=joseph.qi@linux.alibaba.com; NM=1; PH=DS; RN=6; RT=6; SR=0; TI=SMTPD_---0Swp8ntM_1516331359; Received: from JosephdeMacBook-Pro.local(mailfrom:joseph.qi@linux.alibaba.com fp:42.120.74.110) by smtp.aliyun-inc.com(127.0.0.1); Fri, 19 Jan 2018 11:09:19 +0800 To: Jens Axboe Cc: linux-block , device-mapper development , Shaohua Li , Mike Snitzer , caspar@linux.alibaba.com From: Joseph Qi Subject: [PATCH v3 RESEND 2/2] blk-throttle: fix wrong initialization in case of dm device Message-ID: Date: Fri, 19 Jan 2018 11:09:18 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 Content-Language: en-US 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 From: Joseph Qi DM device sets QUEUE_FLAG_NONROT after the queue is registered. That is to mean, the previous initialization in blk_throtl_register_queue is wrong in this case. Fix it by checking and then updating the info during root tg initialization as we don't have a better choice. Signed-off-by: Joseph Qi Reviewed-by: Shaohua Li --- block/blk-throttle.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index bf52035..7150f14 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -541,6 +541,25 @@ static void throtl_pd_init(struct blkg_policy_data *pd) if (cgroup_subsys_on_dfl(io_cgrp_subsys) && blkg->parent) sq->parent_sq = &blkg_to_tg(blkg->parent)->service_queue; tg->td = td; + +#ifdef CONFIG_BLK_DEV_THROTTLING_LOW + /* + * DM device sets QUEUE_FLAG_NONROT after the queue is registered, + * so the previous initialization is wrong in this case. Check and + * update it here. + */ + if (blk_queue_nonrot(blkg->q) && + td->filtered_latency != LATENCY_FILTERED_SSD) { + int i; + + td->throtl_slice = DFL_THROTL_SLICE_SSD; + td->filtered_latency = LATENCY_FILTERED_SSD; + for (i = 0; i < LATENCY_BUCKET_SIZE; i++) { + td->avg_buckets[READ][i].latency = 0; + td->avg_buckets[WRITE][i].latency = 0; + } + } +#endif } /*