mirror of
https://github.com/kdave/btrfs-progs
synced 2025-05-16 23:08:38 +00:00
btrfs-progs: check: fixup_extent_flags needs to deal with non-skinny metadata
When repairing a file system created by a very old kernel, I ran into issues fixing up the extent flags since fixup_extent_flags assumed that a METADATA_ITEM would be present if the record was for metadata. Since METADATA_ITEMs don't exist without skinny metadata, we need to fall back to EXTENT_ITEMs. This also falls back to EXTENT_ITEMs even with skinny metadata enabled as other parts of the tools do. Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
5672a69639
commit
50faf73f22
10
check/main.c
10
check/main.c
@ -7634,9 +7634,13 @@ static int fixup_extent_flags(struct btrfs_fs_info *fs_info,
|
||||
struct btrfs_key key;
|
||||
u64 flags;
|
||||
int ret = 0;
|
||||
bool metadata_item = rec->metadata;
|
||||
|
||||
if (!btrfs_fs_incompat(root->fs_info, SKINNY_METADATA))
|
||||
metadata_item = false;
|
||||
retry:
|
||||
key.objectid = rec->start;
|
||||
if (rec->metadata) {
|
||||
if (metadata_item) {
|
||||
key.type = BTRFS_METADATA_ITEM_KEY;
|
||||
key.offset = rec->info_level;
|
||||
} else {
|
||||
@ -7655,6 +7659,10 @@ static int fixup_extent_flags(struct btrfs_fs_info *fs_info,
|
||||
btrfs_commit_transaction(trans, root);
|
||||
return ret;
|
||||
} else if (ret) {
|
||||
if (key.type == BTRFS_METADATA_ITEM_KEY) {
|
||||
metadata_item = false;
|
||||
goto retry;
|
||||
}
|
||||
fprintf(stderr, "Didn't find extent for %llu\n",
|
||||
(unsigned long long)rec->start);
|
||||
btrfs_release_path(&path);
|
||||
|
Loading…
Reference in New Issue
Block a user