(2010/03/04 2:52), tytso@xxxxxxx wrote: > On Wed, Mar 03, 2010 at 04:47:28PM +0900, Akira Fujita wrote: >> >> In 1KB block size, the overflow occurs at above line. >> Since last_blk is set 0xffffffff when len is equal to s_maxbytes. >> Therefore ext4_fiemap() can not get correct extent information >> with 0 length. How about adding this change? > > What do you think _is_ the correct thing to do when length is 0? As > Leonard has already pointed out, fiemap_check_ranges() already filters > out the length=0 case. /mnt/mp1/file1 ext logical physical expected length flags 0 0 49153 8192 1 8192 77825 57344 2048 eof For example, we do filefrag command for a above file (file1). FS_IOC_FIEMAP tries to get whole extents information of file1, so the output has to be 2 extents. In this case, fm_length (requested block length) is passed from the user-space to the kernel-space, as follows: <user-space> filefrag: fiemap->fm_start(0) fiemap->fm_length(~0ULL) <kernel-space> fs/ioctl.c ioctl_fimap(): filemap_check_ranges(): len(~0ULL) new_len(4398046511103 = s_maxbytes) <--- Because 'len > s_maxbytes' fs/ext4/extents.c ext4_fiemap(): last_blk = start(0) + len(4398046511103) - 1 >> s_blocksize_bits(11) = 4294967295 (0xFFFFFFFF) len_blks = 4294967295 + 1 (0xFFFFFFFF + 0x00000001) = 4294967296 (0x100000000) <--- _OVERFLOW!!_ ext4_ext_walk_space(): num = 0 This overflow leads to incorrect output like the below, even though 2 extents exist. [root@bsd086 akira]# filefrag -v /mnt/mp1/file1 Filesystem type is: ef53 File size of /mnt/mp1/file1 is 10485760 (10240 blocks, blocksize 1024) ext logical physical expected length flags /mnt/mp1/file6: 1 extent found Regards, Akira Fujita -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html