Whamcloud - gitweb
filefrag: fix block size value
authorRakesh Pandit <rakesh@tuxera.com>
Mon, 28 Jul 2014 00:04:48 +0000 (20:04 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 28 Jul 2014 00:24:23 +0000 (20:24 -0400)
commit01824c9bbcd2c1037085213f6cd7d591f78db9c5
tree06ca1daa8848790ff4d09372b6fb4ac93fa23876
parentabc4697d5ae65052d766effa9e3d254673fd3ac4
filefrag: fix block size value

ioctl(FIGETBSZ) was used to get block size earlier but 2508eaa7
(filefrag: improvements to filefrag FIEMAP handling) moved to fstatfs
f_bsize which doesn't work well for many files systems.

Block size returned using fstatfs isn't block size but "optimal
transfer block size" as per man page.  Even stat st_blksize is
"preferred I/O block size" and in may file systems it may even vary
from file to file (POSIX).  This patch changes filefrag to use
FIGETBSZ preferentially over f_bsize.

[ Modified by tytso to add the fallback to f_bsize if FIGETBSZ fails
  for some reason ]

Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/filefrag.c