diff options
author | Josef Bacik <jbacik@fb.com> | 2015-02-06 13:03:12 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fb.com> | 2015-02-09 14:53:15 -0500 |
commit | 797a937e5dd8db0092add633a80f3cd698e182df (patch) | |
tree | 8b2b49b5b4ecee6632f5fb92207979db10627590 /cmds-check.c | |
parent | c7e3b63b7e231ed1d9a47ca735a7ead112b47078 (diff) |
Btrfs-progs: Introduce metadump_v2
The METADUMP super flag makes us skip doing the chunk tree reading which isn't
helpful for the new restore since we have a valid chunk tree. But we still want
to have a way for the kernel to know that this is a metadump restore so it
doesn't do things like verify data checksums. We also want to skip some of the
device extent checks in fsck since those will obviously not match. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Diffstat (limited to 'cmds-check.c')
-rw-r--r-- | cmds-check.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cmds-check.c b/cmds-check.c index 21638235..ffdfbf27 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -7426,6 +7426,7 @@ static int check_chunk_refs(struct chunk_record *chunk_rec, u64 devid; u64 offset; u64 length; + int metadump_v2 = 0; int i; int ret = 0; @@ -7438,7 +7439,8 @@ static int check_chunk_refs(struct chunk_record *chunk_rec, cache); if (chunk_rec->length != block_group_rec->offset || chunk_rec->offset != block_group_rec->objectid || - chunk_rec->type_flags != block_group_rec->flags) { + (!metadump_v2 && + chunk_rec->type_flags != block_group_rec->flags)) { if (!silent) fprintf(stderr, "Chunk[%llu, %u, %llu]: length(%llu), offset(%llu), type(%llu) mismatch with block group[%llu, %u, %llu]: offset(%llu), objectid(%llu), flags(%llu)\n", @@ -7472,6 +7474,9 @@ static int check_chunk_refs(struct chunk_record *chunk_rec, ret = 1; } + if (metadump_v2) + return ret; + length = calc_stripe_length(chunk_rec->type_flags, chunk_rec->length, chunk_rec->num_stripes); for (i = 0; i < chunk_rec->num_stripes; ++i) { @@ -7538,7 +7543,7 @@ int check_chunks(struct cache_tree *chunk_cache, cache); err = check_chunk_refs(chunk_rec, block_group_cache, dev_extent_cache, silent); - if (err) + if (err < 0) ret = err; if (err == 0 && good) list_add_tail(&chunk_rec->list, good); |