Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2887644rwb; Mon, 15 Aug 2022 13:20:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR7DGSmZvBsvYQ+GFBWtDZvvxi3u4T2O4rRovs9y28/BMAkL8gMXu8IIG8ZYtTF23o8/r0s2 X-Received: by 2002:a17:907:a424:b0:732:e3d8:ec70 with SMTP id sg36-20020a170907a42400b00732e3d8ec70mr11814266ejc.666.1660594717108; Mon, 15 Aug 2022 13:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594717; cv=none; d=google.com; s=arc-20160816; b=QCp6/zmPno5rQXqqJZ1VYNeQiMML8/kW4QPbPlY4P851jYc6dWUrfTr4PvKbBIJLEK cPiJFNcf4v0UuKBwYnmUrIwwaI02JTTPh4TJiOHp0S8GV3pAvlW7/BoyuKlQSLVtlZ97 sT14RCmluP5LU9UVOtGeD8BPHTkfF8TmjWv059fs+q0egGgnKfZo9abgpvV//bwXHUHR WrPYajbgso9wKCS7oWTjJB3rz0vkWuAZhzIFxcwzgwludY/BUPeS/tthXvyLvD0rMQhS jH/Khu0Rv40mgrWohZcNtBOVZj9f1zS07J2qCXgzCkg7ij8oSFgaV6jC7obzHW8UTIHr Qocw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Wjb1qTXlokDQYe09SbHkoQQWImTj77hQRi0l75R/oCk=; b=N4DoTy8rD6jo9o67nXl1b0m0uLjZS7e4TNUZ6/Ap+GX1JgPYuUyGERJqRPt3SlWxzb xcn+waIzm6a5ImhN8EKvU1nBmOXZoBUF0GfRHZacuUSMt6jmMOPTFinX+C4mGoRm0EsI xA2L+AoqnK8CtQfRrWi8KydXh3D6ihiyk1RcXSsIDivNtsPU9im0uhpYT5VtPrsmR5QM 2G2TZA3K+pSMtNV+zLNM/c1R+7+wenRRQ9EyajjmfN7zzgD2fH/SOs770zSIGbreh3x0 G6O9+jeUnuI/va/3Ih7PVJdvCJClyDTPyp/8dGUgS/7PwuTvvdL/MmdF5fBkpz61ma3j Ei9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ehlw5uGw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg43-20020a170907a42b00b00734be0d7167si7998119ejc.825.2022.08.15.13.18.11; Mon, 15 Aug 2022 13:18:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ehlw5uGw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243772AbiHOSp2 (ORCPT + 99 others); Mon, 15 Aug 2022 14:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242904AbiHOSkp (ORCPT ); Mon, 15 Aug 2022 14:40:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 491DB2A95B; Mon, 15 Aug 2022 11:24:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AD52CB8107D; Mon, 15 Aug 2022 18:24:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07AE0C433C1; Mon, 15 Aug 2022 18:24:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587862; bh=JDDcoCnPxmg7DVjWNm1DOZfDcTV9TzDW0XJCx77XjG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ehlw5uGwbk2OSlgsYO/otzFCrJY2Orf6p5s7Sbe8/w6julEKP2Gr1Vxq0ufgUV9tc s5gV+ntPPsKLl00ulvJ8KLjLNdnJyW2zW2H86j0UwYVQxOgQCZU+G75aDaWJHpj0rF Sskil0C5tXtl9e1LwQs+Y31cTEjDZIhYl66Wtpss= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.15 217/779] dm writecache: count number of blocks discarded, not number of discard bios Date: Mon, 15 Aug 2022 19:57:41 +0200 Message-Id: <20220815180346.549831036@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mikulas Patocka [ Upstream commit 2ee73ef60db4d79b9f9b8cd501e8188b5179449f ] Change dm-writecache, so that it counts the number of blocks discarded instead of the number of discard bios. Make it consistent with the read and write statistics counters that were changed to count the number of blocks instead of bios. Fixes: e3a35d03407c ("dm writecache: add event counters") Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin --- Documentation/admin-guide/device-mapper/writecache.rst | 2 +- drivers/md/dm-writecache.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/device-mapper/writecache.rst b/Documentation/admin-guide/device-mapper/writecache.rst index 6c9a2c74df8a..724e028d1858 100644 --- a/Documentation/admin-guide/device-mapper/writecache.rst +++ b/Documentation/admin-guide/device-mapper/writecache.rst @@ -87,7 +87,7 @@ Status: 11. the number of write blocks that are allocated in the cache 12. the number of write requests that are blocked on the freelist 13. the number of flush requests -14. the number of discard requests +14. the number of discarded blocks Messages: flush diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index c90408eb9c3a..c3e59d8af76f 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -1513,7 +1513,7 @@ static enum wc_map_op writecache_map_flush(struct dm_writecache *wc, struct bio static enum wc_map_op writecache_map_discard(struct dm_writecache *wc, struct bio *bio) { - wc->stats.discards++; + wc->stats.discards += bio->bi_iter.bi_size >> wc->block_size_bits; if (writecache_has_error(wc)) return WC_MAP_ERROR; -- 2.35.1