block: fix inflight statistics of part0
PATCH v2 1/1 block: fix inflight statistics of part0
The inflight of partition 0 doesn't include inflight IOs to all sub-partitions, since currently mq calculates inflight of specific partition by simply camparing the value of the partition pointer.
Thus the following case is possible:
$ cat /sys/block/vda/inflight 0 0 $ cat /sys/block/vda/vda1/inflight 0 128
While single queue device (on a previous version, e.g. v3.10) has no this issue:
$cat /sys/block/sda/sda3/inflight
0 33
$cat /sys/block/sda/inflight
0 33Partition 0 should be specially handled since it represents the whole disk. This issue is introduced since commit bf0ddaba65dd ("blk-mq: fix sysfs inflight counter").
Besides, this patch can also fix the inflight statistics of part 0 in /proc/diskstats. Before this patch, the inflight statistics of part 0 doesn't include that of sub partitions. (I have marked the 'inflight' field with asterisk.)
$cat /proc/diskstats
259 0 nvme0n1 45974469 0 367814768 6445794 1 0 1 0 *0* 111062 6445794 0 0 0 0 0 0
259 2 nvme0n1p1 45974058 0 367797952 6445727 0 0 0 0 *33* 111001 6445727 0 0 0 0 0 0
This is introduced since commit f299b7c7a9de ("blk-mq: provide internal in-flight variant").
---
v2: update the commit log, adding 'Fixes' tag
--- block/blk-mq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk-mq.c +2 -1
@@ -105,7 +105,8 @@ static bool blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx, {struct mq_inflight *mi = priv; -if (rq->part == mi->part &&blk_mq_rq_state (rq) ==MQ_RQ_IN_FLIGHT ) +if ((!mi->part->partno || rq->part == mi->part) && +blk_mq_rq_state (rq) ==MQ_RQ_IN_FLIGHT ) mi->inflight[rq_data_dir (rq)]++;return true;
Signature · 1 line
2.27.0
Quoted 35 lines · Jeffle Xu
The inflight of partition 0 doesn't include inflight IOs to all sub-partitions, since currently mq calculates inflight of specific partition by simply camparing the value of the partition pointer.
Thus the following case is possible:
$ cat /sys/block/vda/inflight 0 0 $ cat /sys/block/vda/vda1/inflight 0 128While single queue device (on a previous version, e.g. v3.10) has no this issue:
$cat
/sys/block/sda/sda3/inflight0 33 $cat /sys/block/sda/inflight 0 33Partition 0 should be specially handled since it represents the whole disk. This issue is introduced since commit
bf0ddaba65dd("blk-mq: fix sysfs inflight counter").Besides, this patch can also fix the inflight statistics of part 0 in
/proc/diskstats. Before this patch, the inflight statistics of part 0 doesn't include that of sub partitions. (I have marked the 'inflight' field with asterisk.)$cat
/proc/diskstats
259 0 nvme0n1 45974469 0 367814768 6445794 1 0 1 0 *0* 111062 6445794 0 0 0 0 0 0
259 2 nvme0n1p1 45974058 0 367797952 6445727 0 0 0 0 *33* 111001 6445727 0 0 0 0 0 0This is introduced since commit
f299b7c7a9de("blk-mq: provide internal in-flight variant").
Quoted 6 lines
Fixes bf0ddaba65dd ("blk-mq: fix sysfs inflight counter")Fixes f299b7c7a9de ("blk-mq: provide internal in-flight variant")Reviewed-by Christoph Hellwig <[email protected]>Signed-off-by Jeffle Xu <[email protected]>---
v2: update the commit log, adding 'Fixes' tag
Forgot to add 'stable' tag.
Quoted 19 lines
--- block/blk-mq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)block/blk-mq.c +2
-1@@ -105,7 +105,8 @@ static bool blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx, {struct mq_inflight *mi = priv; -if (rq->part == mi->part &&blk_mq_rq_state (rq) ==MQ_RQ_IN_FLIGHT ) +if ((!mi->part->partno || rq->part == mi->part) && +blk_mq_rq_state (rq) ==MQ_RQ_IN_FLIGHT ) mi->inflight[rq_data_dir (rq)]++;return true;
Signature · 2 lines
Thanks, Jeffle
Quoted 8 lines · JeffleXu
Quoted 6 lines
Fixes bf0ddaba65dd ("blk-mq: fix sysfs inflight counter")Fixes f299b7c7a9de ("blk-mq: provide internal in-flight variant")Reviewed-by Christoph Hellwig <[email protected]>Signed-off-by Jeffle Xu <[email protected]>---
v2: update the commit log, adding 'Fixes' tagForgot to add 'stable' tag.
The fixes tags take care of that automatically.
Note that this patch will cause a merge conflict with my work in linux-next, but the resolution is pretty trivial.
Jens Axboe
maintainerQuoted 8 lines · Christoph Hellwig
Quoted 7 lines · JeffleXu
Quoted 6 lines
Fixes bf0ddaba65dd ("blk-mq: fix sysfs inflight counter")Fixes f299b7c7a9de ("blk-mq: provide internal in-flight variant")Reviewed-by Christoph Hellwig <[email protected]>Signed-off-by Jeffle Xu <[email protected]>---
v2: update the commit log, adding 'Fixes' tag
Quoted 6 lines
Quoted 1 line
Forgot to add 'stable' tag.
The fixes tags take care of that automatically.
Note that this patch will cause a merge conflict with my work in linux-next, but the resolution is pretty trivial.
Might be better to handle on the stable side, and just apply this to 5.11. It's not a new regression.
Signature · 1 line
Jens Axboe
Quoted 11 lines · Jens Axboe
Quoted 10 lines · Christoph Hellwig
Quoted 8 lines · JeffleXu
Quoted 6 lines
Fixes bf0ddaba65dd ("blk-mq: fix sysfs inflight counter")Fixes f299b7c7a9de ("blk-mq: provide internal in-flight variant")Reviewed-by Christoph Hellwig <[email protected]>Signed-off-by Jeffle Xu <[email protected]>---
v2: update the commit log, adding 'Fixes' tagForgot to add 'stable' tag.
Quoted 7 lines
Quoted 4 lines
The fixes tags take care of that automatically.
Note that this patch will cause a merge conflict with my work in linux-next, but the resolution is pretty trivial.
Might be better to handle on the stable side, and just apply this to 5.11. It's not a new regression.
If you apply it to for-5.11/block it won't compile. It'll need a quick s/partno/bd_partno/ there.
Quoted 14 lines · Christoph Hellwig
Quoted 13 lines · Jens Axboe
Quoted 12 lines · Christoph Hellwig
Quoted 8 lines · JeffleXu
Quoted 6 lines
Fixes bf0ddaba65dd ("blk-mq: fix sysfs inflight counter")Fixes f299b7c7a9de ("blk-mq: provide internal in-flight variant")Reviewed-by Christoph Hellwig <[email protected]>Signed-off-by Jeffle Xu <[email protected]>---
v2: update the commit log, adding 'Fixes' tagForgot to add 'stable' tag.
The fixes tags take care of that automatically.
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
Note that this patch will cause a merge conflict with my work in linux-next, but the resolution is pretty trivial.
Might be better to handle on the stable side, and just apply this to 5.11. It's not a new regression.
If you apply it to for-5.11/block it won't compile. It'll need a quick s/partno/bd_partno/ there.
Fine. I will resend a new version later on the code base of for-5.11/block.
Signature · 2 lines
Thanks, Jeffle