On Wed, May 04, 2005 at 03:09:26AM -0400, Anthony DeRobertis wrote: > Package: e2fsprogs > Version: 1.35-6 > Severity: minor > File: /usr/sbin/filefrag > > bohr:/tmp# dd if=/dev/zero of=test bs=1 count=1 seek=$((1024*1024)) > 1+0 records in > 1+0 records out > 1 bytes transferred in 0.009811 seconds (102 bytes/sec) > bohr:/tmp# filefrag test > test: 257 extents found, perfection would be 1 extent > > Something seems wrong there....
This was mostly fixed in e2fsprogs 1.37, but it was still not quite right: # ./build/misc/filefrag -v test Checking test Filesystem type is: ef53 Filesystem cylinder groups is approximately 33856 Blocksize of file test is 4096 File size of test is 1048577 (257 blocks) First block: 0 Last block: 12477365 Discontinuity: Block 256 is at 12477365 (was 1) test: 2 extents found, perfection would be 1 extent The following patch is needed to get it completely right: --- 1.10/misc/filefrag.c 2005-04-09 01:24:03 -04:00 +++ edited/misc/filefrag.c 2005-05-05 22:44:27 -04:00 @@ -127,7 +127,7 @@ get_bmap(fd, 0), get_bmap(fd, numblocks - 1)); } for (i=0; i < numblocks; i++) { - if (is_ext2) { + if (is_ext2 && last_block) { if (((i-EXT2_DIRECT) % bpib) == 0) last_block++; if (((i-EXT2_DIRECT-bpib) % (bpib*bpib)) == 0) Now it gives the correct answer: # ./build/misc/filefrag -v test Checking test Filesystem type is: ef53 Filesystem cylinder groups is approximately 33856 Blocksize of file test is 4096 File size of test is 1048577 (257 blocks) First block: 0 Last block: 12477365 test: 1 extent found - Ted -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]