[PATCH 1/3] btrfs-progs: fsck: Print correct file hole

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If a file lost all its file extents, fsck will unable to print out the
hole.

Add an extra judgment to print out the hole range.

Signed-off-by: Qu Wenruo <quwenruo@xxxxxxxxxxxxxx>
---
 cmds-check.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/cmds-check.c b/cmds-check.c
index 50bb6f3..31ed589 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));
 	}
 }
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux