]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
nfsstat: add a comment to has_stats()
authordavid m. richter <richterd@citi.umich.edu>
Tue, 7 Aug 2007 23:52:50 +0000 (19:52 -0400)
committerNeil Brown <neilb@suse.de>
Thu, 9 Aug 2007 01:08:28 +0000 (11:08 +1000)
Clarify what has_stats() is actually doing.

Signed-off-by: David M. Richter <richterd@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
utils/nfsstat/nfsstat.c

index d27624e4b5a544d49a8ffa5764825056f847093a..eb6e45d2a7f11056bcec5105884f80ebd1cf17c4 100644 (file)
@@ -638,10 +638,16 @@ get_stats(const char *file, statinfo *info, int *opt, int other_opt, const char
        }
 }
 
        }
 }
 
+/*
+ * This is for proc2/3/4-type stats, where, in the /proc files, the first entry's value
+ * denotes the number of subsequent entries.  statinfo value arrays contain an additional
+ * field at the end which contains the sum of all previous elements in the array -- so,
+ * there are stats if the sum's greater than the entry-count.
+ */
 static int
 has_stats(const unsigned int *info)
 {
 static int
 has_stats(const unsigned int *info)
 {
-       return (info[0] && info[info[0] + 1] != info[0]);
+       return (info[0] && info[info[0] + 1] > info[0]);
 }
 
 /* clone 'src' to 'dest' */
 }
 
 /* clone 'src' to 'dest' */