public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Anand Jain <anand.jain@oracle.com>, David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org, Nikolay Borisov <nborisov@suse.com>
Subject: Re: [PATCH] btrfs-progs: convert, warn if converting a fs which won't mount
Date: Fri, 28 Feb 2020 17:11:00 +0800	[thread overview]
Message-ID: <0013fd01-9138-57bf-c118-0b780b4f6422@gmx.com> (raw)
In-Reply-To: <39c3e381-b49e-a571-d058-a01734b8b4a9@oracle.com>



On 2020/2/28 下午5:06, Anand Jain wrote:
>
>
> On 2/28/20 4:27 PM, Qu Wenruo wrote:
>>
>>
>> On 2020/2/28 下午4:03, Anand Jain wrote:
>>> On aarch64 with pagesize 64k, btrfs-convert of ext4 is successful,
>>> but it won't mount because we don't yet support subpage blocksize/
>>> sectorsize.
>>>
>>>   BTRFS error (device vda): sectorsize 4096 not supported yet, only
>>> support 65536
>>>
>>> So in this case during convert provide a warning and a 10s delay to
>>> terminate the command.
>>
>> This is no different than calling mkfs.btrfs -s 64k on x86 system.
>> And I see no warning from mkfs.btrfs.
>>
>> Thus I don't see the point of only introducing such warning to
>> btrfs-convert.
>>
>
> I have equal weight-age on the choices if blocksize != pagesize viz..
>   delay and warn (this patch)
>   quit (Nikolay).
>   keep it as it is without warning (Qu).
>
>  Here we are dealing with already user data. Should it be different
>  from mkfs?
>  Quit is fine, but convert tool should it be system neutral?

If we can't mount, btrfs-convert can easily do a revert without anything
touched for the original fs.

And, convert tool is not that system neutral.
It needs the source fs has a sector size that matches btrfs.

E.g. ext2 with 512/1K/2K sector size can't be supported by btrfs-convert
at all.

Thanks,
Qu

>
>  I am not sure.
>
>  David, any idea?
>
> Thanks, Anand
>
>> Thanks,
>> Qu
>>
>>>
>>> For example:
>>>
>>> WARNING: Blocksize 4096 is not equal to the pagesize 65536,
>>>           converted filesystem won't mount on this system.
>>>           The operation will start in 10 seconds. Use Ctrl-c to stop it.
>>> 10 9 8 7 6 5 4^C
>>>
>>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>>> ---
>>>   convert/main.c | 15 +++++++++++++++
>>>   1 file changed, 15 insertions(+)
>>>
>>> diff --git a/convert/main.c b/convert/main.c
>>> index a04ec7a36abf..f936ec37d30a 100644
>>> --- a/convert/main.c
>>> +++ b/convert/main.c
>>> @@ -1140,6 +1140,21 @@ static int do_convert(const char *devname, u32
>>> convert_flags, u32 nodesize,
>>>           error("block size is too small: %u < 4096", blocksize);
>>>           goto fail;
>>>       }
>>> +    if (blocksize != getpagesize()) {
>>> +        int delay = 10;
>>> +
>>> +        warning("Blocksize %u is not equal to the pagesize %u,\n\
>>> +         converted filesystem won't mount on this system.\n\
>>> +         The operation will start in %d seconds. Use Ctrl-C to stop
>>> it.",
>>> +            blocksize, getpagesize(), delay);
>>> +
>>> +        while (delay) {
>>> +            printf("%2d", delay--);
>>> +            fflush(stdout);
>>> +            sleep(1);
>>> +        }
>>> +    }
>>> +
>>>       if (btrfs_check_nodesize(nodesize, blocksize, features))
>>>           goto fail;
>>>       fd = open(devname, O_RDWR);
>>>
>>

  reply	other threads:[~2020-02-28  9:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28  8:03 [PATCH] btrfs-progs: convert, warn if converting a fs which won't mount Anand Jain
2020-02-28  8:13 ` Nikolay Borisov
2020-02-28 10:17   ` Roman Mamedov
2020-02-28  8:27 ` Qu Wenruo
2020-02-28  9:06   ` Anand Jain
2020-02-28  9:11     ` Qu Wenruo [this message]
2020-03-03 17:44     ` David Sterba
2020-03-04  2:14       ` Anand Jain
2020-03-04  2:55         ` Qu Wenruo
2020-03-04 13:32         ` David Sterba
2020-03-04 15:22           ` Anand Jain

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=0013fd01-9138-57bf-c118-0b780b4f6422@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=anand.jain@oracle.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.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