All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Josef Bacik <jbacik@fb.com>,
	linux-btrfs@vger.kernel.org, dsterba@suse.cz
Subject: Re: [PATCH 09/16] Btrfs-progs: Introduce metadump_v2
Date: Tue, 10 Feb 2015 12:28:56 -0600	[thread overview]
Message-ID: <54DA4DE8.4070701@redhat.com> (raw)
In-Reply-To: <1423512199-16552-10-git-send-email-jbacik@fb.com>

On 2/9/15 2:03 PM, Josef Bacik wrote:
> 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,

coverity points out that the "metadump_v2" flag is never set to anything but 0.

# git show 797a937e | grep metadump_v2
    Btrfs-progs: Introduce metadump_v2
+	int metadump_v2 = 0;
+		    (!metadump_v2 &&
+	if (metadump_v2)
# 

is that ... intentional?

-Eric


> Signed-off-by: Josef Bacik <jbacik@fb.com>
> ---
>  btrfs-image.c | 3 +++
>  cmds-check.c  | 9 +++++++--
>  ctree.h       | 1 +
>  3 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/btrfs-image.c b/btrfs-image.c
> index ea85542..feb4a62 100644
> --- a/btrfs-image.c
> +++ b/btrfs-image.c
> @@ -1455,6 +1455,7 @@ static int update_super(struct mdrestore_struct *mdres, u8 *buffer)
>  	struct btrfs_chunk *chunk;
>  	struct btrfs_disk_key *disk_key;
>  	struct btrfs_key key;
> +	u64 flags = btrfs_super_flags(super);
>  	u32 new_array_size = 0;
>  	u32 array_size;
>  	u32 cur = 0;
> @@ -1510,6 +1511,8 @@ static int update_super(struct mdrestore_struct *mdres, u8 *buffer)
>  	if (mdres->clear_space_cache)
>  		btrfs_set_super_cache_generation(super, 0);
>  
> +	flags |= BTRFS_SUPER_FLAG_METADUMP_V2;
> +	btrfs_set_super_flags(super, flags);
>  	btrfs_set_super_sys_array_size(super, new_array_size);
>  	csum_block(buffer, BTRFS_SUPER_INFO_SIZE);
>  
> diff --git a/cmds-check.c b/cmds-check.c
> index 2163823..ffdfbf2 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);
> diff --git a/ctree.h b/ctree.h
> index 2d2988b..be30cb6 100644
> --- a/ctree.h
> +++ b/ctree.h
> @@ -309,6 +309,7 @@ static inline unsigned long btrfs_chunk_item_size(int num_stripes)
>  #define BTRFS_HEADER_FLAG_RELOC			(1ULL << 1)
>  #define BTRFS_SUPER_FLAG_SEEDING		(1ULL << 32)
>  #define BTRFS_SUPER_FLAG_METADUMP		(1ULL << 33)
> +#define BTRFS_SUPER_FLAG_METADUMP_V2		(1ULL << 34)
>  
>  #define BTRFS_BACKREF_REV_MAX		256
>  #define BTRFS_BACKREF_REV_SHIFT		56
> 


  reply	other threads:[~2015-02-10 18:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09 20:03 [GIT PULL] btrfsck and btrfs-image fixes Josef Bacik
2015-02-09 20:03 ` [PATCH 01/16] Btrfs-progs: let btrfs-corrupt-block specify a root Josef Bacik
2015-02-09 20:03 ` [PATCH 02/16] btrfs-progs: deal with no extent info Josef Bacik
2015-02-09 20:03 ` [PATCH 03/16] Btrfs-progs: handle -eagain properly Josef Bacik
2015-02-09 20:03 ` [PATCH 04/16] Btrfs-progs: read super properly in btrfs-image Josef Bacik
2015-02-09 20:03 ` [PATCH 05/16] Btrfs-progs: don't try to repair reloc roots Josef Bacik
2015-02-09 20:03 ` [PATCH 06/16] Btrfs-progs: don't check csums for data reloc root Josef Bacik
2015-02-09 20:03 ` [PATCH 07/16] btrfs-progs: fix btrfs-image overlapping chunks Josef Bacik
2015-02-09 20:03 ` [PATCH 08/16] Btrfs-progs: multi-thread btrfs-image restore Josef Bacik
2015-02-09 20:03 ` [PATCH 09/16] Btrfs-progs: Introduce metadump_v2 Josef Bacik
2015-02-10 18:28   ` Eric Sandeen [this message]
2015-02-10 18:39     ` Josef Bacik
2015-02-10 19:14   ` David Sterba
2015-02-10 20:12     ` Josef Bacik
2015-02-09 20:03 ` [PATCH 10/16] Btrfs-progs: only build space info's for the main flags Josef Bacik
2015-02-09 20:03 ` [PATCH 11/16] Btrfs-progs: remove global transaction from fsck Josef Bacik
2015-02-09 20:03 ` [PATCH 12/16] Btrfs-progs: unpin excluded extents as we fix things Josef Bacik
2015-02-09 20:03 ` [PATCH 13/16] Btrfs-progs: make restore update dev items Josef Bacik
2015-02-09 20:03 ` [PATCH 14/16] Btrfs-progs: make debug-tree spit out full_backref flag Josef Bacik
2015-02-09 20:03 ` [PATCH 15/16] Btrfs-progs: skip opening all devices with restore Josef Bacik
2015-02-09 20:03 ` [PATCH 16/16] Btrfs-progs: fix bad extent flag Josef Bacik
2015-02-10 14:29 ` [GIT PULL] btrfsck and btrfs-image fixes David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54DA4DE8.4070701@redhat.com \
    --to=sandeen@redhat.com \
    --cc=dsterba@suse.cz \
    --cc=jbacik@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.