Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2928107rwb; Mon, 15 Aug 2022 14:13:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR44EROOySQh1ATrd0iZS4Va0+LSPGj0EXAteEFUKWdr7YZ94uFExE0kFbvl7fZjxugx+zKW X-Received: by 2002:a17:907:2888:b0:730:d9ca:34e with SMTP id em8-20020a170907288800b00730d9ca034emr11635717ejc.634.1660598018864; Mon, 15 Aug 2022 14:13:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598018; cv=none; d=google.com; s=arc-20160816; b=T97Byz93hbuvdUidlMHo0AZjzerQoNzlrVbaABR0dVkQjze+AY7mj1MgIQen2pjF9R Kdb3tIBIhkgjipKdcaE1sqc7XBRIi+NnainKhtCtPMSHTJ62k1doJnldq4dPlmg7QB6c BhxfJl48xFhRJUxWhYEKsv+I2BiqMsykZUvWHtrNu3PJ7dZn61YywFodJyEdnUEVgCK3 HPRjdcw5lpDFPtLUODS1iXGf2KhttV8gLoGMt6rcxC8lRjrGKkpiOVdAkCPfmfpMrvwt 3VdF3yhCVWS6nmSvMHNOd+NXrlMg14aPZ6fROx73H7Fwz/U/c09ydW+JhMA0LLbbNC2+ zcAQ== 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=Hl9ouppBHn/basekv/zPxf9x1W/OHPSVFKr/vbm5PCk=; b=a4sx0BgS9TtKPqVNjzyYFSkcxSvzsicUyK//t+Vgcw8wTZ95Ot4wr74mTZj15GByvE qeWaEtPlGV1rNiemH4MIsN/r6aOPJOks5oWGFBiNKJIOONpCievudWuRsHYnaviBSPZ3 NZ+0dhUzDHQrDv0LX0CJwPG7vl0qNllXdYDUSLXhDPSWuXk8Pl604maNyFgYVJeR0dKh UZUflIsO/m6SOt+mjbgp8R0CNkx1PUvffeQ13429RutpozMWtcgC7LpN7qWgXj3b+661 Bt0VkNUDJCob4QkFe2ey1Cd6ZKzJ7oGLKFBpUrE+kEEXlPItYXE7SC1wzyLQf8z3ShxE PkCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UHzSWUXh; 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 f27-20020a170906049b00b007311b7d141dsi8126038eja.595.2022.08.15.14.13.13; Mon, 15 Aug 2022 14:13:38 -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=UHzSWUXh; 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 S1346000AbiHOUpj (ORCPT + 99 others); Mon, 15 Aug 2022 16:45:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347788AbiHOUnM (ORCPT ); Mon, 15 Aug 2022 16:43:12 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D14BB5E53; Mon, 15 Aug 2022 12:08:11 -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 sin.source.kernel.org (Postfix) with ESMTPS id 2276CCE10E7; Mon, 15 Aug 2022 19:08:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E905AC433D6; Mon, 15 Aug 2022 19:08:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590488; bh=KdT6OdPtJ0WC0bsnZs/Ssa740D193ke143bebXcN3r4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UHzSWUXhn3QvA/HoPmseQO0N0ZZxuM4iQNR955aIBjBly9eanxg8Qr49MzqDr2mGu phBaEumIfnzO3+GWvMs6c2VqVIDQbMYJtyiHXTh3zfnBXPJoLej9m7IvG9CFyjX4Jt 0hofN3+Rfo9ru8z3WK5XxeXVqcpLnoCuLv7jZ2sY= 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.18 0276/1095] dm writecache: count number of blocks read, not number of read bios Date: Mon, 15 Aug 2022 19:54:35 +0200 Message-Id: <20220815180441.187748615@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 688b6b3bcd7b..3bec493cccb2 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