Skip to content

Commit

Permalink
block: open code __blk_account_io_start()
Browse files Browse the repository at this point in the history
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>
Link: https://lore.kernel.org/r/20230327073427.4403-2-kch@nvidia.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Chaitanya Kulkarni authored and Jens Axboe committed Mar 27, 2023
1 parent 54bdd67 commit e165fb4
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e165fb4

Please sign in to comment.