Message ID | 20230327073427.4403-2-kch@nvidia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] block: open code __blk_account_io_start() | expand |
On Mon, Mar 27, 2023 at 12:34:26AM -0700, Chaitanya Kulkarni wrote: > There is only one caller for __blk_account_io_start(), the function > is small enough to fit in its caller blk_account_io_start(). > > Remove the function and opencode in the its caller > blk_account_io_start(). Having the account slow path in a separate function actually is nice, same for the next patch. > + /* > + * All non-passthrough requests are created from a bio with one > + * exception: when a flush command that is part of a flush sequence > + * generated by the state machine in blk-flush.c is cloned onto the > + * lower device by dm-multipath we can get here without a bio. > + */ ... and now you've created a totally messed up block comment expanding over 80 characters.
On 3/27/23 15:12, Christoph Hellwig wrote: > On Mon, Mar 27, 2023 at 12:34:26AM -0700, Chaitanya Kulkarni wrote: >> There is only one caller for __blk_account_io_start(), the function >> is small enough to fit in its caller blk_account_io_start(). >> >> Remove the function and opencode in the its caller >> blk_account_io_start(). > Having the account slow path in a separate function actually is nice, > same for the next patch. > >> + /* >> + * All non-passthrough requests are created from a bio with one >> + * exception: when a flush command that is part of a flush sequence >> + * generated by the state machine in blk-flush.c is cloned onto the >> + * lower device by dm-multipath we can get here without a bio. >> + */ > ... and now you've created a totally messed up block comment expanding > over 80 characters. ohh, checkpatch didn't spit out any warning [1]. -ck [1] ----------------------------------------------------------------------- p/blk-account-cleanup/0001-block-open-code-__blk_account_io_start.patch ----------------------------------------------------------------------- total: 0 errors, 0 warnings, 44 lines checked p/blk-account-cleanup/0001-block-open-code-__blk_account_io_start.patch has no obvious style problems and is ready for submission. ---------------------------------------------------------------------- p/blk-account-cleanup/0002-block-open-code-__blk_account_io_done.patch ---------------------------------------------------------------------- total: 0 errors, 0 warnings, 34 lines checked p/blk-account-cleanup/0002-block-open-code-__blk_account_io_done.patch has no obvious style problems and is ready for submission. NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.
On 3/27/23 4:12 PM, Christoph Hellwig wrote: > On Mon, Mar 27, 2023 at 12:34:26AM -0700, Chaitanya Kulkarni wrote: >> There is only one caller for __blk_account_io_start(), the function >> is small enough to fit in its caller blk_account_io_start(). >> >> Remove the function and opencode in the its caller >> blk_account_io_start(). > > Having the account slow path in a separate function actually is nice, > same for the next patch. Then it should be made explicitly out-of-line, the compiler would've inlined that anyway.
diff --git a/block/blk-mq.c b/block/blk-mq.c index 4d8d88d55217..f514128f7dad 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -976,28 +976,24 @@ static inline void blk_account_io_done(struct request *req, u64 now) __blk_account_io_done(req, now); } -static void __blk_account_io_start(struct request *rq) -{ - /* - * All non-passthrough requests are created from a bio with one - * exception: when a flush command that is part of a flush sequence - * generated by the state machine in blk-flush.c is cloned onto the - * lower device by dm-multipath we can get here without a bio. - */ - if (rq->bio) - rq->part = rq->bio->bi_bdev; - else - rq->part = rq->q->disk->part0; - - part_stat_lock(); - update_io_ticks(rq->part, jiffies, false); - part_stat_unlock(); -} - static inline void blk_account_io_start(struct request *req) { - if (blk_do_io_stat(req)) - __blk_account_io_start(req); + if (blk_do_io_stat(req)) { + /* + * All non-passthrough requests are created from a bio with one + * exception: when a flush command that is part of a flush sequence + * generated by the state machine in blk-flush.c is cloned onto the + * lower device by dm-multipath we can get here without a bio. + */ + if (req->bio) + req->part = req->bio->bi_bdev; + else + req->part = req->q->disk->part0; + + part_stat_lock(); + update_io_ticks(req->part, jiffies, false); + part_stat_unlock(); + } } static inline void __blk_mq_end_request_acct(struct request *rq, u64 now)
There is only one caller for __blk_account_io_start(), the function is small enough to fit in its caller blk_account_io_start(). Remove the function and opencode in the its caller blk_account_io_start(). Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com> --- block/blk-mq.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-)