Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong format for /proc/diskstats #807

Closed
henryx opened this issue Apr 21, 2016 · 3 comments
Closed

Wrong format for /proc/diskstats #807

henryx opened this issue Apr 21, 2016 · 3 comments
Labels

Comments

@henryx
Copy link

henryx commented Apr 21, 2016

As reported in _pslinux.py we have 3 formats for diskstats reporting information:

  1. 15 fields if we use a Linux 2.4 kernel;
  2. 14 fields if we use a Linux 2.6+ kernel and it reports a partition;
  3. 7 fields if we use a Linux 2.6+ kernel and it reports a disk.

In fact, if we use a 2.6+ kernel, we have always a 14 fields structure (I've verified on CentOS 6 and CentOS 7), so the method reports always the same data. Is a good thing to correct this documentation and remove the unused code for cleanup (it also a good thing to check if the data are correct in case of disk or partition check)

@giampaolo
Copy link
Owner

Mmmm I seem to remember I came up with that code after reading some doc ("man proc" or something) which described those 3 possible formats so I'm not sure it's a good idea to remove it.

@henryx
Copy link
Author

henryx commented Apr 22, 2016

Please note: in my issue I've swapped partition and disk, so, as reported in _pslinux.py and in the documentation, in 2.6+ we are 14 fields. But this is a sample output on CentOS 6:

$ uname -r
2.6.32-504.23.4.el6.x86_64
$ cat /proc/diskstats |grep vda
252 0 vda 40894884 762897 4732260326 79610084 32058059 40015556 534598342 81434303 0 80401326 160952373
252 1 vda1 766 349 9776 1421 2004 150893 305806 7859 0 2213 9271
252 2 vda2 40893963 762548 4732249310 79608613 26873238 39864663 534292536 78632222 0 78064225 158150740
$

As noticed, vda (disk) and vda1 (partition) have the same number of fields. At this point, I think that the Linux kernel documentation is outdated

@giampaolo
Copy link
Owner

I think I'm gonna leave it there just for extra safety: we're not sure whether the Linux doc is outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants