From a bug report filed by Ibragimov Rinat:
When filefrag uses FIEMAP ioctl its logic differs for ordinary and
verbose (-v) modes. ext4 returns extent on every 32768 block so on
large files it is possible that `filefrag large-file' tells about 4
extents while `filefrag -v large-file' finds only one.
Also when I tried to use generic_block_fiemap function to add
FIEMAP for reiserfs, every block was reported as a new extent
resulting in thousands "extents" for continuous files.
I think filefrag should merge adjacent extents even when -v is not
specified.
Addresses-Debian-Bug: #631498
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fiemap_header_printed = 1;
}
- if (!verbose) {
- *num_extents = fiemap->fm_mapped_extents;
- goto out;
- }
-
/* If 0 extents are returned, then more ioctls are not needed */
if (fiemap->fm_mapped_extents == 0)
break;
tot_extents++;
else
last_blk = 0;
- print_extent_info(&fm_ext[i], n, last_blk, blk_shift);
+ if (verbose)
+ print_extent_info(&fm_ext[i], n, last_blk,
+ blk_shift);
last_blk = phy_blk + ext_len - 1;
if (fm_ext[i].fe_flags & FIEMAP_EXTENT_LAST)