]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
filefrag: fix -B option and extents calculation for FIBMAP
authorRakesh Pandit <rakesh@tuxera.com>
Sun, 27 Jul 2014 23:56:27 +0000 (19:56 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 27 Jul 2014 23:56:27 +0000 (19:56 -0400)
29758d2 broke -B option which is useful for filesystems not supporting
FIEMAP. Also, fix extents calculation for -B which is broken since
2508eaa7.

Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/filefrag.c

index 820821b55ff16af09cc0e56accbd05ada4d28184..bb060b6d3269857831d26598074f458d016c1154 100644 (file)
@@ -331,9 +331,10 @@ static int filefrag_fibmap(int fd, int blk_shift, int *num_extents,
                        fm_ext.fe_physical = block * st->st_blksize;
                        fm_ext.fe_length = 0;
                        (*num_extents)++;
-               } else if (verbose && last_block && (block != last_block + 1)) {
-                       printf("Discontinuity: Block %ld is at %lu (was %lu)\n",
-                              i, block, last_block + 1);
+               } 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);
                        (*num_extents)++;
                }
                fm_ext.fe_length += st->st_blksize;
@@ -439,7 +440,7 @@ static int frag_report(const char *filename)
                expected = 0;
        }
 
-       if (rc < 0) {
+       if (force_bmap || rc < 0) {
                expected = filefrag_fibmap(fd, blk_shift, &num_extents,
                                           &st, numblocks, is_ext2);
                if (expected < 0) {