mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 02:55:12 +00:00
Fix diskio total computation for kernel > 2.6.31 (sf: #2942117)
This commit is contained in:
parent
000acfe0fd
commit
44e3708cdb
@ -2256,6 +2256,7 @@ void update_diskio(void)
|
|||||||
struct diskio_stat *cur;
|
struct diskio_stat *cur;
|
||||||
unsigned int reads, writes;
|
unsigned int reads, writes;
|
||||||
unsigned int total_reads = 0, total_writes = 0;
|
unsigned int total_reads = 0, total_writes = 0;
|
||||||
|
size_t len_devbuf;
|
||||||
|
|
||||||
stats.current = 0;
|
stats.current = 0;
|
||||||
stats.current_read = 0;
|
stats.current_read = 0;
|
||||||
@ -2276,8 +2277,15 @@ void update_diskio(void)
|
|||||||
* XXX: ignore devices which are part of a SW RAID (MD_MAJOR) */
|
* XXX: ignore devices which are part of a SW RAID (MD_MAJOR) */
|
||||||
if (col_count == 5 && major != LVM_BLK_MAJOR && major != NBD_MAJOR
|
if (col_count == 5 && major != LVM_BLK_MAJOR && major != NBD_MAJOR
|
||||||
&& major != RAMDISK_MAJOR && major != LOOP_MAJOR) {
|
&& major != RAMDISK_MAJOR && major != LOOP_MAJOR) {
|
||||||
|
/* If the last character of the device is a digit we assume
|
||||||
|
* it is a subdevice (needed for kernel > 2.6.31) */
|
||||||
|
if (devbuf) {
|
||||||
|
len_devbuf = strlen(devbuf);
|
||||||
|
if ((len_devbuf > 0) && !isdigit(devbuf[len_devbuf-1])) {
|
||||||
total_reads += reads;
|
total_reads += reads;
|
||||||
total_writes += writes;
|
total_writes += writes;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
col_count = sscanf(buf, "%u %u %s %*u %u %*u %u",
|
col_count = sscanf(buf, "%u %u %s %*u %u %*u %u",
|
||||||
&major, &minor, devbuf, &reads, &writes);
|
&major, &minor, devbuf, &reads, &writes);
|
||||||
|
Loading…
Reference in New Issue
Block a user