summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2015-08-05 16:03:12 +0800
committerDavid Sterba <dsterba@suse.com>2015-08-31 19:25:11 +0200
commit1ffa833a910b5a7070d9ee4456fb833aab7cf91d (patch)
tree798d6ff46f815db09d5dd7c0c640bc4e668f1d7a
parent7c41d25ec63addd0f6661dac20532a18237c039f (diff)
btrfs-progs: fsck: print correct file hole
If a file lost all its extents, fsck will unable to print out the hole. Add an extra check to print out the hole range. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--cmds-check.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmds-check.c b/cmds-check.c
index 50bb6f35..31ed5894 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -616,15 +616,20 @@ static void print_inode_error(struct btrfs_root *root, struct inode_record *rec)
if (errors & I_ERR_FILE_EXTENT_DISCOUNT) {
struct file_extent_hole *hole;
struct rb_node *node;
+ int found = 0;
node = rb_first(&rec->holes);
fprintf(stderr, "Found file extent holes:\n");
while (node) {
+ found = 1;
hole = rb_entry(node, struct file_extent_hole, node);
- fprintf(stderr, "\tstart: %llu, len:%llu\n",
+ fprintf(stderr, "\tstart: %llu, len: %llu\n",
hole->start, hole->len);
node = rb_next(node);
}
+ if (!found)
+ fprintf(stderr, "\tstart: 0, len: %llu\n",
+ round_up(rec->isize, root->sectorsize));
}
}