Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp598715ybm; Wed, 27 May 2020 03:24:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAirGvR6Xb5I2V3BNAscDFDwKk4ydmb+bR7+JdzSAKC3xu0pKpS8Yd41hrQ3aETMoHCI+w X-Received: by 2002:a17:906:5f98:: with SMTP id a24mr5494571eju.214.1590575093085; Wed, 27 May 2020 03:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590575093; cv=none; d=google.com; s=arc-20160816; b=rWQsQa+m/HuELO/LIFGVXf3ZooaeGSvHV/LVrRE3GIlvDxH4XTWRGu42hYg8o7k3Bs 7H2xHryY9z07ljHdei4CvZGExKH4AFC0mapS1sY1GkxRW/ySazzXXmaJc8VwRv2yPZfu 4AguguglQB9GX6VAS9XC4xxIs9tRsyzwRFbLuSWsUEAkdD+nqLTClUgIy6Zan2EYbFjK CTvr9wL20NuW3VMmYqn8195cvmvtHPv0gv4ufkhoDfo1vv81+6BaGZZfEpL9HjFTqmde /wHR8iZfQXvr1RkRvRY1EecR0sX92yQbo2/MDmGn/0vQaiyooNal/p6ujlovQEM5PX3Z 2dUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jAURZKlR3wABF7HVZ7jgwwb3T9+sEOkFONnpRICBtxk=; b=V8Ds7KvbJpDc+Jy/2wFP6sRxkzniYUkSwolV4MdCRy1M8T/MUrNMkGqvgSXsXlFUU5 O664nd8gR1WPv/rb45tskbFwfemlXFfd1U7tLnHg/pHENtqYS//JURiZSi5DLOqDb4DO 3tEqv9gXnMd5iTkGNAg9jPlf9Lg+5uW3VBVHxiTUvuFd5j0XFy4eq4BTHiZxfU/jqvFi 0msTSYMM6D8k3a51OZnK09QlmBWW5U87fY8ERQvpIAg2+ty30zyzUO5GGyJeGFB3GAjQ oF2xCRy2CTgVZzELCPDWx4Yk/EqE1AX5N7Bi1J90wD6Qn8s7priVAYojbiWGAOfwQGxm DrdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=b9lpto70; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t25si1727590eju.743.2020.05.27.03.24.29; Wed, 27 May 2020 03:24:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=b9lpto70; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729053AbgE0FY6 (ORCPT + 99 others); Wed, 27 May 2020 01:24:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729033AbgE0FYx (ORCPT ); Wed, 27 May 2020 01:24:53 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F8EEC061A0F; Tue, 26 May 2020 22:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=jAURZKlR3wABF7HVZ7jgwwb3T9+sEOkFONnpRICBtxk=; b=b9lpto70CQqiKdI3uzCEpMlbCf S0IgWN79A13NXEagh9OH9+Qh+JTDTOeMoPjVIuUNfJiAQ+P7WzUbKwDKQk3vPhbGqHsJrVSk4utl2 rE2/SU1j43BMRA/XFHmWBPxMeSz9zQ0oiXDhfvPgsGJAMrsPJXTrGLcxfBBf8qGIfJynA3Mobq3E+ mjfsUtnhu0yeIU4MY49hiV9ahnzRBQyET4zmj6BzzQpIjttHnvEwO+71DYXKl/DaMmQljzKYxd6aJ NND9YGXuZ3liozt0LHGnA/lee1fDLPc7pwEf9Q19tbT96+Z0qcD37iWSLoJ4ojAms6K5BNdcZ5fSX fU8Jbe+Q==; Received: from [2001:4bb8:18c:5da7:8164:affc:3c20:853d] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdoYb-0000s4-VW; Wed, 27 May 2020 05:24:50 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Konstantin Khlebnikov , Minchan Kim , Nitin Gupta , dm-devel@redhat.com, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/16] block: move update_io_ticks to blk-core.c Date: Wed, 27 May 2020 07:24:13 +0200 Message-Id: <20200527052419.403583-11-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527052419.403583-1-hch@lst.de> References: <20200527052419.403583-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All callers are in blk-core.c, so move update_io_ticks over. Signed-off-by: Christoph Hellwig Reviewed-by: Konstantin Khlebnikov --- block/bio.c | 16 ---------------- block/blk-core.c | 15 +++++++++++++++ block/blk.h | 1 - 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/block/bio.c b/block/bio.c index 3e89c7b37855a..5235da6434aab 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1376,22 +1376,6 @@ void bio_check_pages_dirty(struct bio *bio) schedule_work(&bio_dirty_work); } -void update_io_ticks(struct hd_struct *part, unsigned long now, bool end) -{ - unsigned long stamp; -again: - stamp = READ_ONCE(part->stamp); - if (unlikely(stamp != now)) { - if (likely(cmpxchg(&part->stamp, stamp, now) == stamp)) { - __part_stat_add(part, io_ticks, end ? now - stamp : 1); - } - } - if (part->partno) { - part = &part_to_disk(part)->part0; - goto again; - } -} - static inline bool bio_remaining_done(struct bio *bio) { /* diff --git a/block/blk-core.c b/block/blk-core.c index 8973104f88d90..c1675d43c2da0 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1381,6 +1381,21 @@ unsigned int blk_rq_err_bytes(const struct request *rq) } EXPORT_SYMBOL_GPL(blk_rq_err_bytes); +static void update_io_ticks(struct hd_struct *part, unsigned long now, bool end) +{ + unsigned long stamp; +again: + stamp = READ_ONCE(part->stamp); + if (unlikely(stamp != now)) { + if (likely(cmpxchg(&part->stamp, stamp, now) == stamp)) + __part_stat_add(part, io_ticks, end ? now - stamp : 1); + } + if (part->partno) { + part = &part_to_disk(part)->part0; + goto again; + } +} + static void blk_account_io_completion(struct request *req, unsigned int bytes) { if (req->part && blk_do_io_stat(req)) { diff --git a/block/blk.h b/block/blk.h index 5db4ec1e85f7b..bdf5e94467aa2 100644 --- a/block/blk.h +++ b/block/blk.h @@ -344,7 +344,6 @@ void blk_queue_free_zone_bitmaps(struct request_queue *q); static inline void blk_queue_free_zone_bitmaps(struct request_queue *q) {} #endif -void update_io_ticks(struct hd_struct *part, unsigned long now, bool end); struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, sector_t sector); int blk_alloc_devt(struct hd_struct *part, dev_t *devt); -- 2.26.2