[dm-devel] Incorrect results for device mapper statistics

Drew Hastings dhastings at crucialwebhost.com
Tue May 15 00:55:28 UTC 2018


Referring to this:
https://www.kernel.org/doc/Documentation/device-mapper/statistics.txt

Basically it seems like a discard takes a certain amount of time, and the
discard can span multiple statistic areas. Each area then claims it took
that total amount of time for the discard, making the accounting of
statistics incorrect. I think a solution would be to divide the amount of
time by the number of areas, and attribute that to the individual area's
stats. It wouldn't be perfect, but it would be much closer to accurate.

root at cloudthree:~# dmsetup create testing --table "0 100000 linear
/dev/mapper/local-nvme 0"

root at cloudthree:~# stat /dev/mapper/testing
  File: /dev/mapper/testing -> ../dm-13

root at cloudthree:~# grep dm-13 /proc/diskstats
 253      13 dm-13 56 0 1312 0 0 0 0 0 0 0 0

root at cloudthree:~# dmstats create --areas 10 testing
testing: Created new region with 10 area(s) as region ID 0

root at cloudthree:~# blkdiscard /dev/dm-13

root at cloudthree:~# dmstats print --regionid 0 testing
0+10000 26 0 1072 0 1 1 10000 40 0 40 40 0 40
10000+10000 0 0 0 0 1 1 10000 40 0 40 40 0 40
20000+10000 0 0 0 0 1 1 10000 40 0 40 40 0 40
30000+10000 0 0 0 0 1 1 10000 40 0 40 40 0 40
40000+10000 0 0 0 0 1 1 10000 40 0 40 40 0 40
50000+10000 0 0 0 0 1 1 10000 40 0 40 40 0 40
60000+10000 0 0 0 0 1 1 10000 40 0 40 40 0 40
70000+10000 0 0 0 0 1 1 10000 40 0 40 40 0 40
80000+10000 0 0 0 0 1 1 10000 40 0 40 40 0 40
90000+10000 30 0 240 8 1 1 10000 40 0 48 48 8 40

root at cloudthree:~# grep dm-13 /proc/diskstats
 253      13 dm-13 112 0 2624 8 1 0 100000 40 0 48 48

The entire device has the correct stats, but the each area has the total
time spent doing the discard for all areas.

Assuming https://github.com/torvalds/linux/blob/master/drivers/md/dm-stats.c
is responsible for this, my guess is it maybe cannot account for this...
and that things like discards and flushes are dealt with elsewhere. If I
had a feature request, it would be for separate (correct) stats for
discards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20180514/0cecd5e0/attachment.htm>


More information about the dm-devel mailing list