linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chandan Rajendra <chandan@linux.vnet.ibm.com>
To: Liu Bo <bo.li.liu@oracle.com>
Cc: linux-btrfs@vger.kernel.org, Eryu Guan <guaneryu@gmail.com>,
	David Sterba <dsterba@suse.com>
Subject: Re: [PATCH] Btrfs: let super_stripesize match with sectorsize
Date: Wed, 15 Jun 2016 09:12:28 +0530	[thread overview]
Message-ID: <1561797.nA26SuRYQT@localhost.localdomain> (raw)
In-Reply-To: <1465940023-27773-1-git-send-email-bo.li.liu@oracle.com>

On Tuesday, June 14, 2016 02:33:43 PM Liu Bo wrote:
> Right now stripesize is set to 4096 while sectorsize is set to
> max(4096, pagesize).  However, kernel requires super_stripesize
> to match with sectorsize.
> 
> Reported-by: Eryu Guan <guaneryu@gmail.com>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> ---
>  mkfs.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/mkfs.c b/mkfs.c
> index a3a3c14..8d00766 100644
> --- a/mkfs.c
> +++ b/mkfs.c
> @@ -1482,6 +1482,8 @@ int main(int argc, char **argv)
>  	}
> 
>  	sectorsize = max(sectorsize, (u32)sysconf(_SC_PAGESIZE));
> +	stripesize = sectorsize;
> +
>  	saved_optind = optind;
>  	dev_cnt = argc - optind;
>  	if (dev_cnt == 0)

Hello Liu Bo,

We have to fix the following check in check_super() as well,

       if (btrfs_super_stripesize(sb) != 4096) {
                error("invalid stripesize %u", btrfs_super_stripesize(sb));
                goto error_out;
        }

i.e. btrfs_super_stripesize(sb) must be equal to
btrfs_super_sectorsize(sb).

However in btrfs-progs (mkfs.c to be precise) since we had stripesize
hardcoded to 4096, setting stripesize to the value of sectorsize in
mkfs.c will cause the following to occur when mkfs.btrfs is invoked for
devices with existing Btrfs filesystem instances,

NOTE: Assume we have changed the stripesize validation in btrfs-progs'
check_super() to,

        if (btrfs_super_stripesize(sb) != btrfs_super_sectorsize(sb)) {
                error("invalid stripesize %u", btrfs_super_stripesize(sb));
                goto error_out;
        }


main()
 for each device file passed as an argument,
   test_dev_for_mkfs()
     check_mounted
       check_mounted_where
         btrfs_scan_one_device
           btrfs_read_dev_super
             check_super() call will fail for existing filesystems which have
             stripesize set to 4k. All existing filesystem instances will fall
             into this category.

This error value is pushed up the call stack and this causes the device to not
get added to the fs_devices_mnt list in check_mounted_where(). Hence we would
fail to correctly check the mount status of the multi-device btrfs
filesystems.

I will try to figure out a solution to this problem.

-- 
chandan


  reply	other threads:[~2016-06-15  3:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-14 21:33 [PATCH] Btrfs: let super_stripesize match with sectorsize Liu Bo
2016-06-15  3:42 ` Chandan Rajendra [this message]
2016-06-15 10:20   ` Chandan Rajendra
2016-06-16  0:09     ` Liu Bo
2016-06-16  8:23       ` Chandan Rajendra
2016-06-16 17:01         ` Liu Bo
2016-06-17  5:18           ` Chandan Rajendra
2016-06-17  6:08             ` Liu Bo
2016-06-17  6:51               ` Chandan Rajendra
2016-06-17 16:30                 ` 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=1561797.nA26SuRYQT@localhost.localdomain \
    --to=chandan@linux.vnet.ibm.com \
    --cc=bo.li.liu@oracle.com \
    --cc=dsterba@suse.com \
    --cc=guaneryu@gmail.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 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).