Skip to content

Commit 013adcb

Browse files
Chengming Zhouaxboe
authored andcommitted
blk-iocost: skip empty flush bio in iocost
The flush bio may have data, may have no data (empty flush), we couldn't calculate cost for empty flush bio. So we'd better just skip it for now. Another side effect is that empty flush bio's bio_end_sector() is 0, cause iocg->cursor reset to 0, may break the cost calculation of other bios. This isn't good enough, since flush bio still consume the device bandwidth, but flush request is special, can be merged randomly in the flush state machine, we don't know how to calculate cost for it for now. Its completion time also has flaws, which may include the pre-flush or post-flush completion time, but I don't know if we need to fix that and how to fix it. Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com> Acked-by: Tejun Heo <tj@kernel.org> Link: https://lore.kernel.org/r/20230720121441.1408522-1-chengming.zhou@linux.dev Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 3641c90 commit 013adcb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

block/blk-iocost.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,6 +2516,10 @@ static void calc_vtime_cost_builtin(struct bio *bio, struct ioc_gq *iocg,
25162516
u64 seek_pages = 0;
25172517
u64 cost = 0;
25182518

2519+
/* Can't calculate cost for empty bio */
2520+
if (!bio->bi_iter.bi_size)
2521+
goto out;
2522+
25192523
switch (bio_op(bio)) {
25202524
case REQ_OP_READ:
25212525
coef_seqio = ioc->params.lcoefs[LCOEF_RSEQIO];

0 commit comments

Comments
 (0)