linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Goffredo Baroncelli <kreijack@libero.it>
To: Wang Sheng-Hui <shhuiw@gmail.com>
Cc: chris.mason@fusionio.com, linux-btrfs@vger.kernel.org,
	linux-kernel@vger.kernel.org, cwillu <cwillu@cwillu.com>,
	Josef Bacik <jbacik@fusionio.com>
Subject: Re: [PATCH] btrfs: fix disk-io.c/btrfs_read_dev_super with BTRFS_SUPER_MIRROR_MAX to control the loops
Date: Tue, 11 Sep 2012 07:14:34 +0200	[thread overview]
Message-ID: <504EC8BA.7010706@libero.it> (raw)
In-Reply-To: <504D8AEB.9090401@gmail.com>

Hi,

On 09/10/2012 08:38 AM, Wang Sheng-Hui wrote:
> To check the duplicated super blocks, use BTRFS_SUPER_MIRROR_MAX
> as the loops limit.
>
> Signed-off-by: Wang Sheng-Hui<shhuiw@gmail.com>
> ---
>   fs/btrfs/disk-io.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 22e98e0..a431144 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -2723,7 +2723,7 @@ struct buffer_head *btrfs_read_dev_super(struct block_device *bdev)
>   	 * So, we need to add a special mount option to scan for
>   	 * later supers, using BTRFS_SUPER_MIRROR_MAX instead
>   	 */
> -	for (i = 0; i<  1; i++) {
> +	for (i = 0; i<  BTRFS_SUPER_MIRROR_MAX; i++) {
>   		bytenr = btrfs_sb_offset(i);
>   		if (bytenr + 4096>= i_size_read(bdev->bd_inode))
>   			break;


Pay attention that when a device is removed from a filesystem by the 
command "btrfs device delete", *only* the 1st superblock btrfs signature 
is zeroed [1]. This means that the other (backup) superblocks will be 
considered valid with your change.



[1] See the function btrfs_rm_device() in volume.c





      parent reply	other threads:[~2012-09-11  5:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-10  6:38 [PATCH] btrfs: fix disk-io.c/btrfs_read_dev_super with BTRFS_SUPER_MIRROR_MAX to control the loops Wang Sheng-Hui
2012-09-10  7:24 ` cwillu
2012-09-10 16:14 ` Josef Bacik
2012-09-11  5:14 ` Goffredo Baroncelli [this message]

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=504EC8BA.7010706@libero.it \
    --to=kreijack@libero.it \
    --cc=chris.mason@fusionio.com \
    --cc=cwillu@cwillu.com \
    --cc=jbacik@fusionio.com \
    --cc=kreijack@inwind.it \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shhuiw@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).