]> git.baikalelectronics.ru Git - kernel.git/commit
block: fix inflight statistics of part0
authorJeffle Xu <jefflexu@linux.alibaba.com>
Wed, 2 Dec 2020 11:11:45 +0000 (19:11 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 2 Dec 2020 19:43:02 +0000 (12:43 -0700)
commit471efaa5f393091d1af723d7c5d859517dbd167e
treea1a301e3d055b1388291774d8bf4ab43f3decbea
parent4477cc4232968e1136a58d5a843db13a10b08dfb
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       33

Partition 0 should be specially handled since it represents the whole
disk. This issue is introduced since commit 32b4c045fd39 ("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 4c0fef6fb952 ("blk-mq: provide internal
in-flight variant").

Fixes: 32b4c045fd39 ("blk-mq: fix sysfs inflight counter")
Fixes: 4c0fef6fb952 ("blk-mq: provide internal in-flight variant")
Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
[axboe: adapt for 5.11 partition change]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c