diff mbox series

[4/7] btrfs-progs: tune: implement resume support for empty csum tree

Message ID 6a45bc14a406c86552e6446f9e78dae3489f26b5.1684913599.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: tune: add resume support for csum conversion | expand

Commit Message

Qu Wenruo May 24, 2023, 7:41 a.m. UTC
We have a very rare chance to hit a fs with empty csum tree but still
has CHANGING_DATA_CSUM flag.

The window is very small, but it's still possible, so handle it by
jumping directly to metadata csum change.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 tune/change-csum.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/tune/change-csum.c b/tune/change-csum.c
index 05bddaa48d27..aef3b05a0d9d 100644
--- a/tune/change-csum.c
+++ b/tune/change-csum.c
@@ -828,6 +828,13 @@  static int resume_data_csum_change(struct btrfs_fs_info *fs_info,
 	if (ret == 0)
 		new_csum_found = true;
 
+	/*
+	 * No csum item found at all, this fs has empty csum tree.
+	 * Just go metadata change.
+	 */
+	if (!old_csum_found && !new_csum_found)
+		goto new_meta_csum;
+
 	/*
 	 * Only old csums exists. This can be one of the two cases:
 	 * - Only the csum change item inserted, no new csum generated.