[PATCH 0/2] block: Add done_split_bio() for chained bio post-processing
From: Li kunyu
Date: Fri Oct 30 2026 - 03:04:07 EST
[Problems encountered]
The split-out chained bio path has a QoS accounting issue. In a complete
chained bio composed of 10 bio headers and 1 sub-bio (produced by
repeatedly splitting a large block), only the first bio header among the
10 bio headers, the one that satisfies atomic_dec_and_test(&bio->
__bi_remaining) and the single sub-bio can execute rq_qos_done_bio(bio)
to update the QoS-related accounting.
This prevents other bio headers from updating QoS-related information
such as inflight counts. The inflight counts added in
rq_qos_throttle(rq->q, bio) are not subtracted, so the inflight count in
the bio's QoS area gradually increases. As a result, it can no longer be
used as a reference value.
Reproducible scenarios are detailed below(blk-iolatency):
1. fio is used to issue at least 1024 consecutive reads or writes, each 1MB
or larger, thereby exceeding the maximum single I/O size supported by the
hardware device.
2. The 'inflight' count described in the text is observed by printing
inflight = atomic_dec_return(&rqw->inflight); in blkcg_iolatency_done_bio.
[Implementation]
patch 1: Introduce a new abstract function 'done_split_bio' and call it
from bio_remaining_done to resolve this issue.
patch 2: Implement the blkcg_iolatency_done_split_bio callback in
blk-iolatency to correctly decrement the inflight count when the other
bio headers, which have not called rq_qos_done_bio(bio), complete.
Li kunyu (2):
block: Add done_split_bio() for chained bio post-processing
block/blk-iolatency: Fix inflight decrement for chained bio sub-bios
block/bio.c | 2 ++
block/blk-iolatency.c | 42 +++++++++++++++++++++++++++++++++++++++
block/blk-merge.c | 4 +++-
block/blk-rq-qos.c | 9 +++++++++
block/blk-rq-qos.h | 23 +++++++++++++++++++++
include/linux/blk_types.h | 6 ++++++
6 files changed, 85 insertions(+), 1 deletion(-)
--
2.47.3