linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, dsterba@suse.cz, nborisov@suse.com
Subject: Re: [PATCH 1/2] btrfs-progs: mkfs: Prevent temporary system chunk to use space in reserved 1M range
Date: Tue, 23 Jan 2018 17:42:53 +0100	[thread overview]
Message-ID: <20180123164253.GN15713@twin.jikos.cz> (raw)
In-Reply-To: <20180110045648.3239-1-wqu@suse.com>

On Wed, Jan 10, 2018 at 12:56:47PM +0800, Qu Wenruo wrote:
> When creating btrfs, mkfs.btrfs will firstly create a temporary system
> chunk as basis, and then created needed trees or new devices.
> 
> However the layout temporary system chunk is hard-coded and uses
> reserved [0, 1M) range of devid 1.
> 
> Change the temporary chunk layout from old:
> 
> 0	1M				4M	5M
> |<----------- temp chunk -------------->|
>   And it's 1:1 mapped, which means it's a SINGLE chunk,
>   and stripe offset is also 0.
> 
> to new layout:
> 
> 0	1M				4M	5M
> 	|<----------- temp chunk -------------->|
>   And still keeps the 1:1 mapping.
> 
> The problem can only be exposed by "-m single" or "-M" where we reuse the
> temporary chunk.
> 
> With other meta profiles, system and meta chunks are allocated by later
> btrfs_alloc_chunk() call, and old SINGLE chunks are removed, so it will
> be no such problem for other meta profiles.
> 
> Reported-by: Nikolay Borisov <nborisov@suse.com>
> Signed-off-by: Qu Wenruo <wqu@suse.com>

The test mkfs-tests/010-minimal-size fails with this patch (devel
branch). I've added some debugging and the requested minimal size by
mkfs is not sufficient. I think it's because of the 1MB shift but
haven't looked closely.

The math in "btrfs-progs: mkfs: move source dir size calculation to its
own files" may need to be updated, I'm not sure how exactly to do that.
It would be good if you find the fix and we'll then see where to put it
(separate patch or fold it to some other one).

Otherwise I'm going to apply patches 1 and 2, thanks.

  parent reply	other threads:[~2018-01-23 16:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10  4:56 [PATCH 1/2] btrfs-progs: mkfs: Prevent temporary system chunk to use space in reserved 1M range Qu Wenruo
2018-01-10  4:56 ` [PATCH 2/2] btrfs-progs: mkfs-tests: Add test case to check if the first device extent is occupying reserved 0~1M range Qu Wenruo
2018-01-10  8:57   ` Nikolay Borisov
2018-01-10  8:37 ` [PATCH 1/2] btrfs-progs: mkfs: Prevent temporary system chunk to use space in reserved 1M range Nikolay Borisov
2018-01-10 14:14 ` Nikolay Borisov
2018-01-10 14:27   ` Qu Wenruo
2018-01-23 16:42 ` David Sterba [this message]
2018-01-24  0:42   ` Qu Wenruo

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=20180123164253.GN15713@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=wqu@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;
as well as URLs for NNTP newsgroup(s).