afs: fs getcacheparms miscounts dcaches for large files
commitb5e4e8c14130f601bbf43dee5927222ebf7613fa
authorMark Vitale <mvitale@sinenomine.net>
Tue, 12 Jan 2016 23:06:51 +0000 (12 18:06 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Mon, 12 Dec 2016 17:24:55 +0000 (12 12:24 -0500)
treeebe3994f775dfcb8aa5a7fb1d1eaa0049fd700ae
parentc966c0b8414ef0a041b1a8d5261c9eccd4d39d99
afs: fs getcacheparms miscounts dcaches for large files

fs getcacheparms issued with the -excessive option tabulates in-memory
dcaches ("DCentries") by size.  However, any dcache with validPos > 2^31
is miscounted in the 4k-16k bucket.  This is caused by a type mismatch
between 'validPos' (afs_size_t) and 'size' (int) which leads to a
negative value for size by sign-extension.  The size comparison "sieve"
fails for negative numbers; it skips the first bucket (0-4K) and dumps
them in the second one (4k-16k).

Move the declaration of 'size' closer to its use, and declare it with
the same type as 'validPos' (afs_size_t) so the comparison sieve
correctly places these dcaches in the last (>=1M) bucket.

Change-Id: Ib0d973da92865043a4f1c068de5e9b81bcde2b9a
Reviewed-on: https://gerrit.openafs.org/12347
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/afs/afs_pioctl.c