[2/3] btrfs-progs: convert: update error message to reflect original fs unmodified cases
diff mbox series

Message ID 20200729084038.78151-3-wqu@suse.com
State New
Headers show
  • btrfs-progs: convert: better ENOSPC handling
Related show

Commit Message

Qu Wenruo July 29, 2020, 8:40 a.m. UTC
The original fs is not touched until we migrate the super blocks.

Under most error cases, we fail before that thus the original fs is
still safe.

So change the error message according the stages we failed to reflect

Signed-off-by: Qu Wenruo <wqu@suse.com>
 convert/main.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff mbox series

diff --git a/convert/main.c b/convert/main.c
index df6a2ae32722..451e4f158689 100644
--- a/convert/main.c
+++ b/convert/main.c
@@ -1123,6 +1123,7 @@  static int do_convert(const char *devname, u32 convert_flags, u32 nodesize,
 	struct task_ctx ctx;
 	char features_buf[64];
 	struct btrfs_mkfs_config mkfs_cfg;
+	bool btrfs_sb_commited = false;
 	ret = convert_open_fs(devname, &cctx);
@@ -1270,6 +1271,7 @@  static int do_convert(const char *devname, u32 convert_flags, u32 nodesize,
 		error("unable to migrate super block: %d", ret);
 		goto fail;
+	btrfs_sb_commited = true;
 	root = open_ctree_fd(fd, devname, 0,
@@ -1287,8 +1289,12 @@  fail:
 	if (fd != -1)
-	warning(
+	if (btrfs_sb_commited)
+		warning(
 "an error occurred during conversion, filesystem is partially created but not finalized and not mountable");
+	else
+		warning(
+"an error occurred during conversion, the original filesystem is not modified");
 	return -1;