On 2017年09月01日 19:28, Austin S. Hemmelgarn wrote:
On 2017-08-31 20:13, Qu Wenruo wrote:


On 2017年09月01日 01:27, Goffredo Baroncelli wrote:
Hi All,


I found a bug in mkfs.btrfs, when it is used the option '-r'. It seems that it is not visible the full disk.

Despite the new bug you found, -r has several existing bugs.
Is this actually a bug though?  Every other filesystem creation  tool that I know of that offers functionality like this generates the filesystem just large enough to contain the data you want in it, so I would argue that making this use the whole device is actually breaking consistency with other tools, not to mention removing functionality that is useful (even aside from the system image generation use case I mentioned, there are other practical applications (seed 'device' generation comes to mind).

Well, then documentation bug.

And I'm not sure the chunk size is correct or optimized.
Even for btrfs-convert, which will make data chunks very scattered, we still try to make a large chunk to cover scattered data extents.

At least to me, it's not the case for chunk created by -r option.

BTW, seed device is RO anyway, how much or how less spare space we have is not a problem at all.

So to me, even follow other tools -r, we should follow the normal extent allocator behavior to create data/metadata, and then set the device size to end of its dev extents.


For example it will create dev extent starting from physical offset 0, while kernel and mkfs will avoid that range, as 0~1M on each device is reserved.

According to the code, -r will modify chunk layout by itself, not the traditional way kernel is doing.

I'll fix them (if I'm not a lazybone), before that fix, please don't use -r option as it's not well maintained or fully tested.
FWIW, based on my own testing, filesystems generated with '-r' work just fine as long as you don't try to embed boot code in the FS itself.

It works fine because btrfs extent allocator will try to avoid superblock.
But it doesn't mean we should put dev extents into 0~1M range.

In fact, there is a deprecated mount option, alloc_start, to set how many bytes we should reserve for *each* device. And since it's deprecated, we'd better follow the 1M reservation for each device.

Anyway, kernel balance and plain mkfs won't create chunk stripe in 0~1M range of each device, mkfs -r should also follow it.

Thanks,
Qu


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to