[linux-cifs-client] du/ls -s output

maciej maciej at killer-robot.net
Thu May 13 21:41:03 GMT 2004


A while back someone reported trouble with the output of "du" on a cifs
volume; I'm having the same issue. It appears that the problem is that
stat reports the number of blocks the file has allocated in terms
of st_blksize, rather than 512 byte blocks. Below is the relavant output
of "strace -v ls -s" on identical files on ext3 and cifs volumes:

ext3:
lstat64("./foo.zip", {st_dev=makedev(3, 3), st_ino=1308214, st_mode=S_IFREG|0644, st_nlink=1, st_uid=5000, st_gid=5000, st_blksize=4096, st_blocks=197832, st_size=101181865, st_atime=2004/05/13-16:30:13, st_mtime=2004/05/13-14:45:32, st_ctime=2004/05/13-14:45:32}) = 0

cifs:
lstat64("./foo.zip", {st_dev=makedev(0, 14), st_ino=80256, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=23, st_blksize=16384, st_blocks=6176, st_size=101181865, st_atime=2004/05/13-16:30:28, st_mtime=2004/05/13-16:30:28, st_ctime=2004/05/13-16:30:28}) = 0

Note that in the cifs case,
st_blksize * st_blocks = 16384 * 6176 = 101187584
is a good aproximation of st_size, whereas in the ext3 case,
512 * st_blocks = 512 * 197832 = 101289984 is about equal to st_size,
and
st_blksize * st_blocks  = 810319872
isn't.

                            -Maciej Babinski


More information about the linux-cifs-client mailing list