diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-09-30 18:43:39 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-09-30 21:28:39 -0400 |
commit | a00be17e4768c5ce55f74be518f35f5d5d1b158b (patch) | |
tree | 6ef9bf8d95770c5f139a55b7ab2aaf419e085be1 | |
parent | 27b422f57ba0435a53776537ba3a2f4339b350d0 (diff) | |
download | e2fsprogs-a00be17e4768c5ce55f74be518f35f5d5d1b158b.tar.gz |
filefrag: Display the number of contiguous, not physical, extents
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>
-rw-r--r-- | misc/filefrag.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/misc/filefrag.c b/misc/filefrag.c index 84417574..0131bf20 100644 --- a/misc/filefrag.c +++ b/misc/filefrag.c @@ -223,11 +223,6 @@ static int filefrag_fiemap(int fd, int blk_shift, int *num_extents) 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; @@ -244,7 +239,9 @@ static int filefrag_fiemap(int fd, int blk_shift, int *num_extents) 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) |