summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2014-08-13 15:59:20 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-08-13 15:59:20 -0400
commitc47cd4f28768bd3768c1074ac6b9274fcfddd3cd (patch)
treedc616cceb5c5d20e13c693e6b7c579012792a3aa
parent6197c10c580657b95de1abbcb3ca9b3a1d9bf943 (diff)
downloade2fsprogs-c47cd4f28768bd3768c1074ac6b9274fcfddd3cd.tar.gz
filefrag: fix extent count calculation when using FIBMAP
The extent count calculation works correctly with the FIBMAP ioctl in verbose (-v) mode, but without the verbose option, the calculation was broken because we weren't properly updating the fm_ext data structures in non-verbose mode. Addresses-Launchpad-Bug: #1356496 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--misc/filefrag.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/misc/filefrag.c b/misc/filefrag.c
index d71bf43e..c1a86840 100644
--- a/misc/filefrag.c
+++ b/misc/filefrag.c
@@ -329,16 +329,17 @@ static int filefrag_fibmap(int fd, int blk_shift, int *num_extents,
print_extent_info(&fm_ext, *num_extents - 1,
(last_block + 1) * st->st_blksize,
blk_shift, st);
- fm_ext.fe_logical = logical;
- fm_ext.fe_physical = block * st->st_blksize;
fm_ext.fe_length = 0;
(*num_extents)++;
} else if (last_block && (block != last_block + 1)) {
if (verbose)
printf("Discontinuity: Block %ld is at %lu (was "
"%lu)\n", i, block, last_block + 1);
+ fm_ext.fe_length = 0;
(*num_extents)++;
}
+ fm_ext.fe_logical = logical;
+ fm_ext.fe_physical = block * st->st_blksize;
fm_ext.fe_length += st->st_blksize;
last_block = block;
}