Linux block layer
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <kch@nvidia.com>
To: <linux-block@vger.kernel.org>
Cc: <axboe@kernel.dk>, Chaitanya Kulkarni <kch@nvidia.com>
Subject: [PATCH 0/2] block: remove unnecessary helpers
Date: Mon, 27 Mar 2023 00:34:25 -0700	[thread overview]
Message-ID: <20230327073427.4403-1-kch@nvidia.com> (raw)

Hi,

There is only one caller for __blk_account_io_start() and
__blk_account_io_done(), both function are small enough to fit in their
respective callers blk_account_io_start() and blk_account_io_done().

Remove both the functions and opencode in the their respective callers
blk_account_io_start() and blk_account_io_done().

Below is a testlog with simple dd write command on null_blk

-ck

Chaitanya Kulkarni (2):
  block: open code __blk_account_io_start()
  block: open code __blk_account_io_done()

 block/blk-mq.c | 56 ++++++++++++++++++++++----------------------------
 1 file changed, 24 insertions(+), 32 deletions(-)

Debug diff :-

linux-block (for-next) # git diff 
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 1b304f66f4e8..c04fbe7cebc1 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -960,6 +960,7 @@ static inline void blk_account_io_done(struct request *req, u64 now)
         * normal IO on queueing nor completion.  Accounting the
         * containing request is enough.
         */
+       printk(KERN_INFO" <<<<< -%s %d\n", __func__, __LINE__);
        if (blk_do_io_stat(req) && req->part &&
            !(req->rq_flags & RQF_FLUSH_SEQ)) {
                const int sgrp = op_stat_group(req_op(req));
@@ -969,11 +970,13 @@ static inline void blk_account_io_done(struct request *req, u64 now)
                part_stat_inc(req->part, ios[sgrp]);
                part_stat_add(req->part, nsecs[sgrp], now - req->start_time_ns);
                part_stat_unlock();
+               printk(KERN_INFO" <<<<< -%s %d\n", __func__, __LINE__);
        }
 }
 
 static inline void blk_account_io_start(struct request *req)
 {
+       printk(KERN_INFO" <>>>>>> -%s %d\n", __func__, __LINE__);
        if (blk_do_io_stat(req)) {
                /*
                 * All non-passthrough requests are created from a bio with one
@@ -989,6 +992,7 @@ static inline void blk_account_io_start(struct request *req)
                part_stat_lock();
                update_io_ticks(req->part, jiffies, false);
                part_stat_unlock();
+               printk(KERN_INFO" <>>>>>> -%s %d\n", __func__, __LINE__);
        }
 }

[   79.477154]  <<<<< -blk_account_io_done 963
[   79.477155]  <<<<< -blk_account_io_done 973
[   79.477157]  <>>>>>> -blk_account_io_start 979
[   79.477158]  <>>>>>> -blk_account_io_start 995
[   79.477343]  <<<<< -blk_account_io_done 963
[   79.477347]  <<<<< -blk_account_io_done 973
[   79.477354]  <>>>>>> -blk_account_io_start 979
[   79.477355]  <>>>>>> -blk_account_io_start 995
[   79.477538]  <<<<< -blk_account_io_done 963
[   79.477540]  <<<<< -blk_account_io_done 973
[   79.477542]  <>>>>>> -blk_account_io_start 979
[   79.477543]  <>>>>>> -blk_account_io_start 995
[   79.477721]  <<<<< -blk_account_io_done 963
[   79.477722]  <<<<< -blk_account_io_done 973
[   79.477724]  <>>>>>> -blk_account_io_start 979
[   79.477725]  <>>>>>> -blk_account_io_start 995
[   79.477752]  <>>>>>> -blk_account_io_start 979
[   79.477755]  <>>>>>> -blk_account_io_start 995
[   79.477910]  <<<<< -blk_account_io_done 963
[   79.477912]  <<<<< -blk_account_io_done 973
[   79.478005]  <>>>>>> -blk_account_io_start 979
[   79.478006]  <>>>>>> -blk_account_io_start 995
[   79.478091]  <<<<< -blk_account_io_done 963
[   79.478093]  <<<<< -blk_account_io_done 973
[   79.478348]  <<<<< -blk_account_io_done 963
[   79.478353]  <<<<< -blk_account_io_done 973
[   79.478360]  <>>>>>> -blk_account_io_start 979
[   79.478361]  <>>>>>> -blk_account_io_start 995
[   79.478551]  <<<<< -blk_account_io_done 963
[   79.478553]  <<<<< -blk_account_io_done 973
[   79.478556]  <>>>>>> -blk_account_io_start 979
[   79.478557]  <>>>>>> -blk_account_io_start 995
[   79.478731]  <<<<< -blk_account_io_done 963
[   79.478733]  <<<<< -blk_account_io_done 973
[   79.478735]  <>>>>>> -blk_account_io_start 979
[   79.478736]  <>>>>>> -blk_account_io_start 995
[   79.478906]  <<<<< -blk_account_io_done 963
[   79.478907]  <<<<< -blk_account_io_done 973
[   79.478909]  <>>>>>> -blk_account_io_start 979
[   79.478910]  <>>>>>> -blk_account_io_start 995
[   79.479086]  <<<<< -blk_account_io_done 963
[   79.479087]  <<<<< -blk_account_io_done 973
[   79.479089]  <>>>>>> -blk_account_io_start 979
[   79.479090]  <>>>>>> -blk_account_io_start 995
[   79.479262]  <<<<< -blk_account_io_done 963
[   79.479266]  <<<<< -blk_account_io_done 973
[   79.479273]  <>>>>>> -blk_account_io_start 979
[   79.479274]  <>>>>>> -blk_account_io_start 995
[   79.479448]  <<<<< -blk_account_io_done 963
[   79.479449]  <<<<< -blk_account_io_done 973
[   79.479451]  <>>>>>> -blk_account_io_start 979
[   79.479452]  <>>>>>> -blk_account_io_start 995
[   79.479631]  <<<<< -blk_account_io_done 963
[   79.479633]  <<<<< -blk_account_io_done 973
[   79.479635]  <>>>>>> -blk_account_io_start 979
[   79.479636]  <>>>>>> -blk_account_io_start 995
[   79.479797]  <<<<< -blk_account_io_done 963
[   79.479798]  <<<<< -blk_account_io_done 973

-- 
2.29.0


             reply	other threads:[~2023-03-27  7:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27  7:34 Chaitanya Kulkarni [this message]
2023-03-27  7:34 ` [PATCH 1/2] block: open code __blk_account_io_start() Chaitanya Kulkarni
2023-03-27 22:12   ` Christoph Hellwig
2023-03-27 22:23     ` Chaitanya Kulkarni
2023-03-27 22:43     ` Jens Axboe
2023-03-27  7:34 ` [PATCH 2/2] block: open code __blk_account_io_done() Chaitanya Kulkarni
2023-03-27 19:23 ` [PATCH 0/2] block: remove unnecessary helpers 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=20230327073427.4403-1-kch@nvidia.com \
    --to=kch@nvidia.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox