diff mbox

[4/6] Btrfs-progs: btrfs-restore,output resason why it fails to read root

Message ID 1403141229-25565-4-git-send-email-wangsl.fnst@cn.fujitsu.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Wang Shilong June 19, 2014, 1:27 a.m. UTC
Previously if restore could not read users specified fs root, it would
output following message:

 Error reading root

With this patch, it will output message like:

 Fail to read root 1000: No such file or directory

Signed-off-byr Wang Shilong <wangsl.fnst@cn.fujitsu.com>
---
 cmds-restore.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/cmds-restore.c b/cmds-restore.c
index 48c46ff..8267ab6 100644
--- a/cmds-restore.c
+++ b/cmds-restore.c
@@ -1257,7 +1257,8 @@  int cmd_restore(int argc, char **argv)
 		key.offset = (u64)-1;
 		root = btrfs_read_fs_root(orig_root->fs_info, &key);
 		if (IS_ERR(root)) {
-			fprintf(stderr, "Error reading root\n");
+			fprintf(stderr, "fail to read root %llu: %s\n",
+					root_objectid, strerror(-PTR_ERR(root)));
 			root = orig_root;
 			ret = 1;
 			goto out;