@@ -876,6 +876,15 @@ static int resume_data_csum_change(struct btrfs_fs_info *fs_info,
goto new_data_csums;
}
+ /*
+ * Both old and new csum exist, and old csum is a subset of the new ones.
+ *
+ * This means we're deleting the old csums.
+ */
+ if (old_csum_found && new_csum_found && new_csum_first <= old_csum_first &&
+ new_csum_last >= old_csum_last)
+ goto delete_old;
+
/* Other cases are not yet supported. */
return -EOPNOTSUPP;
@@ -886,6 +895,7 @@ new_data_csums:
error("failed to generate new data csums: %m");
return ret;
}
+delete_old:
ret = delete_old_data_csums(fs_info);
if (ret < 0)
return ret;
If the csum conversion is interrupted when old csums are being deleted, we should resume by continue deleting the old csums. The function delete_old_data_csums() can handle half deleted cases already. Signed-off-by: Qu Wenruo <wqu@suse.com> --- tune/change-csum.c | 10 ++++++++++ 1 file changed, 10 insertions(+)