All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org
Subject: [PATCH 4/4] block: merge part_{inc,dev}_in_flight into their only callers
Date: Wed, 13 May 2020 12:49:35 +0200	[thread overview]
Message-ID: <20200513104935.2338779-5-hch@lst.de> (raw)
In-Reply-To: <20200513104935.2338779-1-hch@lst.de>

part_inc_in_flight and part_dec_in_flight only have one caller each, and
those callers are purely for bio based drivers.  Merge each function into
the only caller, and remove the superflous blk-mq checks.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/bio.c   | 10 ++++++++--
 block/blk.h   |  4 ----
 block/genhd.c | 20 --------------------
 3 files changed, 8 insertions(+), 26 deletions(-)

diff --git a/block/bio.c b/block/bio.c
index e4c46e2bd5ba5..1d93d74bf7f30 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1390,13 +1390,16 @@ void generic_start_io_acct(struct request_queue *q, int op,
 			   unsigned long sectors, struct hd_struct *part)
 {
 	const int sgrp = op_stat_group(op);
+	int rw = op_is_write(op);
 
 	part_stat_lock();
 
 	update_io_ticks(part, jiffies, false);
 	part_stat_inc(part, ios[sgrp]);
 	part_stat_add(part, sectors[sgrp], sectors);
-	part_inc_in_flight(q, part, op_is_write(op));
+	part_stat_local_inc(part, in_flight[rw]);
+	if (part->partno)
+		part_stat_local_inc(&part_to_disk(part)->part0, in_flight[rw]);
 
 	part_stat_unlock();
 }
@@ -1408,12 +1411,15 @@ void generic_end_io_acct(struct request_queue *q, int req_op,
 	unsigned long now = jiffies;
 	unsigned long duration = now - start_time;
 	const int sgrp = op_stat_group(req_op);
+	int rw = op_is_write(req_op);
 
 	part_stat_lock();
 
 	update_io_ticks(part, now, true);
 	part_stat_add(part, nsecs[sgrp], jiffies_to_nsecs(duration));
-	part_dec_in_flight(q, part, op_is_write(req_op));
+	part_stat_local_dec(part, in_flight[rw]);
+	if (part->partno)
+		part_stat_local_dec(&part_to_disk(part)->part0, in_flight[rw]);
 
 	part_stat_unlock();
 }
diff --git a/block/blk.h b/block/blk.h
index a813c573a48d5..7fe3d6ed22356 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -354,10 +354,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 part_dec_in_flight(struct request_queue *q, struct hd_struct *part,
-			int rw);
-void part_inc_in_flight(struct request_queue *q, struct hd_struct *part,
-			int rw);
 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);
 
diff --git a/block/genhd.c b/block/genhd.c
index 56e0560738c49..094ed90964964 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -119,26 +119,6 @@ static void part_stat_read_all(struct hd_struct *part, struct disk_stats *stat)
 }
 #endif /* CONFIG_SMP */
 
-void part_inc_in_flight(struct request_queue *q, struct hd_struct *part, int rw)
-{
-	if (queue_is_mq(q))
-		return;
-
-	part_stat_local_inc(part, in_flight[rw]);
-	if (part->partno)
-		part_stat_local_inc(&part_to_disk(part)->part0, in_flight[rw]);
-}
-
-void part_dec_in_flight(struct request_queue *q, struct hd_struct *part, int rw)
-{
-	if (queue_is_mq(q))
-		return;
-
-	part_stat_local_dec(part, in_flight[rw]);
-	if (part->partno)
-		part_stat_local_dec(&part_to_disk(part)->part0, in_flight[rw]);
-}
-
 static unsigned int part_in_flight(struct request_queue *q,
 		struct hd_struct *part)
 {
-- 
2.26.2


  parent reply	other threads:[~2020-05-13 10:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13 10:49 small block accounting cleanups Christoph Hellwig
2020-05-13 10:49 ` [PATCH 1/4] block: mark blk_account_io_completion static Christoph Hellwig
2020-05-13 11:44   ` Johannes Thumshirn
2020-05-13 10:49 ` [PATCH 2/4] block: move the blk-mq calls out of part_in_flight{,_rw} Christoph Hellwig
2020-05-13 11:54   ` Johannes Thumshirn
2020-05-13 10:49 ` [PATCH 3/4] block: don't call part_{inc,dec}_in_flight for blk-mq devices Christoph Hellwig
2020-05-13 12:10   ` Johannes Thumshirn
2020-05-13 10:49 ` Christoph Hellwig [this message]
2020-05-13 11:56   ` [PATCH 4/4] block: merge part_{inc,dev}_in_flight into their only callers Johannes Thumshirn
2020-05-19 15:43 ` small block accounting cleanups Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200513104935.2338779-5-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.