* Questions about mkfs -A option
@ 2012-10-17 7:02 Wang Sheng-Hui
[not found] ` <CAOcd+r1aPGGh4zHYzeMMuE01j4Nr+aiMmHBCAWqqCXvZZTb2XQ@mail.gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Wang Sheng-Hui @ 2012-10-17 7:02 UTC (permalink / raw)
To: linux-btrfs
Hi,
I'm reading the mkfs code, and confused by its -A option.
>From its comments, the value specified by -A should be regarded as
the start of the filesystem. But mkfs will always zero some area
at the beginning of the first dev, regardless -r specified or not.
My question is:
Why mkfs zeros the beginning of the first dev? Is that expected?
And any use case for -A option?
thanks,
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CAOcd+r1aPGGh4zHYzeMMuE01j4Nr+aiMmHBCAWqqCXvZZTb2XQ@mail.gmail.com>]
* Re: Questions about mkfs -A option [not found] ` <CAOcd+r1aPGGh4zHYzeMMuE01j4Nr+aiMmHBCAWqqCXvZZTb2XQ@mail.gmail.com> @ 2012-10-24 0:48 ` Wang Sheng-Hui 2012-10-24 9:44 ` Alex Lyakas 0 siblings, 1 reply; 4+ messages in thread From: Wang Sheng-Hui @ 2012-10-24 0:48 UTC (permalink / raw) To: Alex Lyakas; +Cc: linux-btrfs On 2012年10月23日 01:49, Alex Lyakas wrote: > Wang, > I would say that zeroing is done to prevent from seeing some other superblock (besides btrfs) there. That make sense. > > Alex. > > But I still confused by the -A option? In mkfs, we always write the sb info into BTRFS_SUPER_INFO_OFFSET. >From the -A comment, I think btrfs would be places after the -A value. What would happen if we specify a -A value larger than it? Thanks, Sheng-Hui ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Questions about mkfs -A option 2012-10-24 0:48 ` Wang Sheng-Hui @ 2012-10-24 9:44 ` Alex Lyakas 2012-10-25 3:01 ` Wang Sheng-Hui 0 siblings, 1 reply; 4+ messages in thread From: Alex Lyakas @ 2012-10-24 9:44 UTC (permalink / raw) To: Wang Sheng-Hui; +Cc: linux-btrfs Hi Wang, if you just look at the code in find_free_dev_extent(): u64 search_start = 0; ... search_start = max((u64)1024 * 1024, search_start); if (root->fs_info->alloc_start + num_bytes <= device->total_bytes) search_start = max(root->fs_info->alloc_start, search_start); ... key.objectid = device->devid; key.offset = search_start; key.type = BTRFS_DEV_EXTENT_KEY; You see that it will search for DEV_EXTENTs (when allocating chunks) that begin after the value you specified. So it will not use some space at the beginning of the device for allocations. Same behavior in the kernel can be caused by using "alloc_start=X" mount option. What is the purpose of this I don't know, but what it does looks pretty clear. The (first copy of the) superblock, though, is always written to BTRFS_SUPER_INFO_OFFSET, as you mentioned. Alex. On Wed, Oct 24, 2012 at 2:48 AM, Wang Sheng-Hui <shhuiw@gmail.com> wrote: > On 2012年10月23日 01:49, Alex Lyakas wrote: > >> Wang, >> I would say that zeroing is done to prevent from seeing some other superblock (besides btrfs) there. > > > That make sense. > >> >> Alex. >> >> > > > But I still confused by the -A option? > > In mkfs, we always write the sb info into BTRFS_SUPER_INFO_OFFSET. > From the -A comment, I think btrfs would be places after the -A value. > What would happen if we specify a -A value larger than it? > > > Thanks, > Sheng-Hui ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Questions about mkfs -A option 2012-10-24 9:44 ` Alex Lyakas @ 2012-10-25 3:01 ` Wang Sheng-Hui 0 siblings, 0 replies; 4+ messages in thread From: Wang Sheng-Hui @ 2012-10-25 3:01 UTC (permalink / raw) To: Alex Lyakas; +Cc: linux-btrfs On 2012年10月24日 17:44, Alex Lyakas wrote: > Hi Wang, > if you just look at the code in find_free_dev_extent(): > u64 search_start = 0; > ... > search_start = max((u64)1024 * 1024, search_start); > if (root->fs_info->alloc_start + num_bytes <= device->total_bytes) > search_start = max(root->fs_info->alloc_start, search_start); > ... > key.objectid = device->devid; > key.offset = search_start; > key.type = BTRFS_DEV_EXTENT_KEY; > > You see that it will search for DEV_EXTENTs (when allocating chunks) > that begin after the value you specified. So it will not use some > space at the beginning of the device for allocations. Same behavior in > the kernel can be caused by using "alloc_start=X" mount option. > What is the purpose of this I don't know, but what it does looks pretty clear. > The (first copy of the) superblock, though, is always written to > BTRFS_SUPER_INFO_OFFSET, as you mentioned. > > Alex. > > Thanks, Alex. > > > On Wed, Oct 24, 2012 at 2:48 AM, Wang Sheng-Hui <shhuiw@gmail.com> wrote: >> On 2012年10月23日 01:49, Alex Lyakas wrote: >> >>> Wang, >>> I would say that zeroing is done to prevent from seeing some other superblock (besides btrfs) there. >> >> >> That make sense. >> >>> >>> Alex. >>> >>> >> >> >> But I still confused by the -A option? >> >> In mkfs, we always write the sb info into BTRFS_SUPER_INFO_OFFSET. >> From the -A comment, I think btrfs would be places after the -A value. >> What would happen if we specify a -A value larger than it? >> >> >> Thanks, >> Sheng-Hui ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-10-25 3:01 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-10-17 7:02 Questions about mkfs -A option Wang Sheng-Hui [not found] ` <CAOcd+r1aPGGh4zHYzeMMuE01j4Nr+aiMmHBCAWqqCXvZZTb2XQ@mail.gmail.com> 2012-10-24 0:48 ` Wang Sheng-Hui 2012-10-24 9:44 ` Alex Lyakas 2012-10-25 3:01 ` Wang Sheng-Hui
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).