Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2814430rwb; Mon, 15 Aug 2022 11:53:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR4LTXsJcYwNaM3vlz9ayGlacGz+Mw0w0splyxBCeDe7pyK6cFfihDZdgT+/h7nkHjN2PpYF X-Received: by 2002:a05:6402:5ca:b0:43b:6e01:482c with SMTP id n10-20020a05640205ca00b0043b6e01482cmr15993359edx.189.1660589630870; Mon, 15 Aug 2022 11:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660589630; cv=none; d=google.com; s=arc-20160816; b=SwjootrZIX7pItgft3WA9RNgWlvZWJe1pmd06qmbc9RuYUQiNO3xkEnHOOEfDTJ16i Cuwr+U+XtZeVETsv4rYopYMduijEY4QWAqPKsOarwgh9svyyQlrcRFE5jzOnqU5UR7QH EfggIBz7JcfCRPFTNm72Jbtl49OO37V3mOj4I66qCcSIRoD680czryxzxeQ3vYwZnol6 koq/3U9r88zCGXkUFZf54o5yDm26GR0cb878kHSiHH9hAZliqEWtxiB8A9MaUYhxB7RN cq2yD5tSt6uL9hzlyyiMI8MkGvlvJQ7W6/kPD9qFcgZtnkrLOPK/dgEfxweCGQCiJS+d VbXw== 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=A0tJNoYO7W3SSZG6yJSpi+OnvA7mW8xrhGExjWjOdtY=; b=Lg3kZW6pwW9qAs7Texv9hjYNsEl3ukT/CKKqUpYktySGHdbcEtkrRhRy9Eku2w19C7 x83qdWq36eAi7Myn/8BptCGxtRxg2VXoYWfjYfG0VEnU/LqRkZnRhXd7MDNkJEIkjU0C dNVaUppwbkjJtDWU+VokbkK7XjTqY1s1Us34dvAwMRzhtphH9p8GhFHVHVYv/aOJ90hi Mz7c4zEDjkQOIjx+I/X+BDQc81NwEYvw/ENOcWi5E7wvzIBO7qk1ojU7njY09v8v2HJg xRY016dI+4IqmISxL7+HMj7No6rWINLsJhGBf1rBAaeHagD0Rfuul93E45lwDz8+I+Fy 1YBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PlTSO8p3; 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 gu20-20020a170906f29400b00715867834e3si7079386ejb.506.2022.08.15.11.53.22; Mon, 15 Aug 2022 11:53:50 -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=PlTSO8p3; 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 S242587AbiHOSmu (ORCPT + 99 others); Mon, 15 Aug 2022 14:42:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242019AbiHOSkP (ORCPT ); Mon, 15 Aug 2022 14:40:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCBCA2E6AE; Mon, 15 Aug 2022 11:24:14 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 9EC0560FA3; Mon, 15 Aug 2022 18:24:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B90EC433D6; Mon, 15 Aug 2022 18:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587853; bh=fMnFgYb+bYaDSGvOdBhrx5oW0FvbsyErxXYJwlmU99o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PlTSO8p3LRwkLmHdXmtMmEMmRvmSqkEhTOVXlRAFjVivP6Tsc9lCyc39JhuQ96BDF TJf0mml10ydhCXgGCkWDdpbkJTJGTR4vZn2gtXMR5XHs6L9FDwh+87SRgT6y44WrXq DFe+K/m2eItCKUwAWTipzdAS5DRnrINARzhF/Zrs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.15 215/779] dm writecache: count number of blocks read, not number of read bios Date: Mon, 15 Aug 2022 19:57:39 +0200 Message-Id: <20220815180346.465007955@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 2c6e755b49d273243431f5f1184654e71221fc78 ] Change dm-writecache, so that it counts the number of blocks read instead of the number of read bios. Bios can be split and requeued using the dm_accept_partial_bio function, so counting bios caused inaccurate results. Fixes: e3a35d03407c ("dm writecache: add event counters") Reported-by: Yu Kuai Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin --- Documentation/admin-guide/device-mapper/writecache.rst | 4 ++-- drivers/md/dm-writecache.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/device-mapper/writecache.rst b/Documentation/admin-guide/device-mapper/writecache.rst index 10429779a91a..7bead3b52690 100644 --- a/Documentation/admin-guide/device-mapper/writecache.rst +++ b/Documentation/admin-guide/device-mapper/writecache.rst @@ -78,8 +78,8 @@ Status: 2. the number of blocks 3. the number of free blocks 4. the number of blocks under writeback -5. the number of read requests -6. the number of read requests that hit the cache +5. the number of read blocks +6. the number of read blocks that hit the cache 7. the number of write requests 8. the number of write requests that hit uncommitted block 9. the number of write requests that hit committed block diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index e3d0a9bb27b5..9d6b7b706a65 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -1364,6 +1364,7 @@ static enum wc_map_op writecache_map_read(struct dm_writecache *wc, struct bio * } } else { writecache_map_remap_origin(wc, bio, e); + wc->stats.reads += (bio->bi_iter.bi_size - wc->block_size) >> wc->block_size_bits; map_op = WC_MAP_REMAP_ORIGIN; } -- 2.35.1