linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: dsterba@suse.cz, Qu Wenruo <wqu@suse.com>,
	linux-btrfs@vger.kernel.org, nborisov@suse.com
Subject: Re: [PATCH 1/2] btrfs-progs: mkfs: Prevent temporary system chunk to use space in reserved 1M range
Date: Wed, 24 Jan 2018 08:42:46 +0800	[thread overview]
Message-ID: <c7ce57d8-37f4-a2b0-ee12-11d9e107ef3d@gmx.com> (raw)
In-Reply-To: <20180123164253.GN15713@twin.jikos.cz>


[-- Attachment #1.1: Type: text/plain, Size: 2094 bytes --]



On 2018年01月24日 00:42, David Sterba wrote:
> 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.

Patch under the way.

And this reminds me to refactor btrfs_alloc_chunk() to allow caller get
minimal chunk size to use other than manually read the code.

Thanks,
Qu

> 
> 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.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 520 bytes --]

      reply	other threads:[~2018-01-24  0:43 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
2018-01-24  0:42   ` Qu Wenruo [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=c7ce57d8-37f4-a2b0-ee12-11d9e107ef3d@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=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).