btrfs-progs: tune: implement resume support for half deleted old csums
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> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
7f077e3173
commit
1aa4a9c609
|
@ -875,6 +875,15 @@ static int resume_data_csum_change(struct btrfs_fs_info *fs_info, u16 new_csum_t
|
|||
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;
|
||||
|
||||
|
@ -885,6 +894,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;
|
||||
|
|
Loading…
Reference in New Issue