Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3705914imw; Mon, 11 Jul 2022 14:07:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tPycNFtdOj8btqs1SoKK3s3BBG9RaJny0iMfIS2Xux8WvACN2IJl9CvSTCLZ8Ep43VDSDG X-Received: by 2002:a05:6402:1914:b0:43a:d59b:5e79 with SMTP id e20-20020a056402191400b0043ad59b5e79mr9331866edz.124.1657573633778; Mon, 11 Jul 2022 14:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657573633; cv=none; d=google.com; s=arc-20160816; b=sz1IQSxOBm5Bc5/8coilxnILY/1COKCXEwj8KxSU6dGytIqoc5cFypU42/Pfqp3gKZ KuUQBU8uPAK8Nkn+9aLdfhzpVSvxxSc0ASn3+He5nfcqc9RIp1esKQYgt9UJ6gODl+NU GeJOZTGYD1Bp3oo5VlKSlLVmTk9vjhrMPf9PYG61E0+9K/JyFK/tIvRm/HZ+ElE4rqEs rL8tMKb/Jbh/ThaLZcUemDqk2Rsmf2V06e1lV+UigU2DTFjED7hIC79meq56TCNWUs+i xnehslwRpUyRcUh0BEjSMNVX0ESfPdfYedyg6EM6g2iPLGw7RBWbdkNxd7H1IOVcOsTD ACSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=UKJ4oj2UiV/tUg28XSAFfYDURbHg6O4Bi1B7FR3XWgQ=; b=BdbLnNHjay+YNqCBc7P2XZ5NTjqf5pBaj6wZTfHrEpS0+nfvRlobYMJFci+Vfohr4d vUl2WFgikFBH3RqSSqxGkWcFrLSg7knHpNFghxk66AIw7NVxyTVKotnrI919P8XWkicb k0Jzx8C1QtzKBIfBRP0NQlZzvJefbpHTfDHKDpZoD58DIMGz6cFZy7Xnihv+pM/V0aQQ vAoOT0L3ZRunADYnqGS1eghDj41hC8amp89Ti43zQOZznwlkh7fX+71d2HFQ0bX4F003 QvtS2BHnKHEHe7dNXEdsj4bQkmtjpsRDahtRtnCfndjduJ+2ZTlwjv+0p27UHVW0+9Yi 0gaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CUCtbNsP; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g16-20020a056402425000b0043ac66b0d92si9486849edb.379.2022.07.11.14.06.47; Mon, 11 Jul 2022 14:07:13 -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=@redhat.com header.s=mimecast20190719 header.b=CUCtbNsP; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231357AbiGKUcZ (ORCPT + 99 others); Mon, 11 Jul 2022 16:32:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229796AbiGKUcE (ORCPT ); Mon, 11 Jul 2022 16:32:04 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A5855E009 for ; Mon, 11 Jul 2022 13:31:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657571462; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UKJ4oj2UiV/tUg28XSAFfYDURbHg6O4Bi1B7FR3XWgQ=; b=CUCtbNsP4NKalLuuChCo12v9tcxmh5gIHlEoDpDNRqLxtM6JIh0/D1UeUvIZ92hT6pr4dv KITH2qiqxVmU1V1eACjpgxDae947/gyTRRlEXjxtgoOlJ90yFlD0SiksD6kyRLHZtysBbu J9fLKYl7Bi9xxN6V8aazmN74NjpKvqU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-186-n-gZLs3CPPO6cRTJza7piw-1; Mon, 11 Jul 2022 16:30:53 -0400 X-MC-Unique: n-gZLs3CPPO6cRTJza7piw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 57C74801590; Mon, 11 Jul 2022 20:30:53 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4BFCC18EA8; Mon, 11 Jul 2022 20:30:53 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id 26BKUrXb005616; Mon, 11 Jul 2022 16:30:53 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id 26BKUqlo005612; Mon, 11 Jul 2022 16:30:53 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Mon, 11 Jul 2022 16:30:52 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Yu Kuai , Mike Snitzer cc: agk@redhat.com, dm-devel@redhat.com, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yi.zhang@huawei.com Subject: [PATCH 2/4] dm-writecache: count the number of blocks read, not the number of read bios In-Reply-To: Message-ID: References: <20220706093146.1961598-1-yukuai1@huaweicloud.com> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,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 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 of bios provided inaccurate results. Signed-off-by: Mikulas Patocka Reported-by: Yu Kuai Index: linux-2.6/drivers/md/dm-writecache.c =================================================================== --- linux-2.6.orig/drivers/md/dm-writecache.c +++ linux-2.6/drivers/md/dm-writecache.c @@ -1365,6 +1365,7 @@ read_next_block: } } 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; } Index: linux-2.6/Documentation/admin-guide/device-mapper/writecache.rst =================================================================== --- linux-2.6.orig/Documentation/admin-guide/device-mapper/writecache.rst +++ linux-2.6/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