Re: [PATCH] btrfs: reject zoned RW mount if sectorsize is smaller than page size

Qu Wenruo
2024-02-17T00:07:31Z

在 2024/2/14 17:59, David Sterba 写道:
> On Mon, Feb 12, 2024 at 08:20:21PM +1030, Qu Wenruo wrote:
>>
>>
>> On 2024/2/12 20:15, Johannes Thumshirn wrote:
>>> On 12.02.24 06:16, Qu Wenruo wrote:
>>>> Reported-by: HAN Yuwei <hrx@bupt.moe>
>>>> Link: https://lore.kernel.org/all/1ACD2E3643008A17+da260584-2c7f-432a-9e22-9d390aae84cc@bupt.moe/
>>>> CC: stable@vger.kernel.org # 5.10+
>>>> Signed-off-by: Qu Wenruo <wqu@suse.com>
>>>> ---
>>>> fs/btrfs/disk-io.c | 3 ++-
>>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
>>>> index c3ab268533ca..85cd23aebdd6 100644
>>>> --- a/fs/btrfs/disk-io.c
>>>> +++ b/fs/btrfs/disk-io.c
>>>> @@ -3193,7 +3193,8 @@ int btrfs_check_features(struct btrfs_fs_info *fs_info, bool is_rw_mount)
>>>> * part of @locked_page.
>>>> * That's also why compression for subpage only work for page aligned ranges.
>>>> */
>>>> - if (fs_info->sectorsize < PAGE_SIZE && btrfs_is_zoned(fs_info) && is_rw_mount) {
>>>> + if (fs_info->sectorsize < PAGE_SIZE &&
>>>> + btrfs_fs_incompat(fs_info, ZONED) && is_rw_mount) {
>>>> btrfs_warn(fs_info,
>>>> "no zoned read-write support for page size %lu with sectorsize %u",
>>>> PAGE_SIZE, fs_info->sectorsize);
>>>
>>> Please keep btrfs_is_zoned(fs_info) instead of using
>>> btrfs_fs_incompat(fs_info, ZONED).
>>
>> At the time of calling, we haven't yet populate fs_info->zone_size, thus
>> we have to use super flags to verify if it's zoned.
>>
>> If needed, I can add a comment for it.
>
> Yes please add a comment the difference is quite subtle.
>

I'd say this patch can be dropped.

The reason is:

- I'm already working on the proper subpage handling for the
@locked_page of a delalloc range

The patchset is under testing now, the results looks fine for
both regular and subpage cases.
Will queue extra testing for subpage zoned.

- The rejection would cause future problems for detecting whether we
have proper subpage + zoned support.
Either we do not detect, or introduce a complex mechanism only for
this one edge case.

Thus I prefer not to detect.

- Subage + zoned is too niche for now
The most common subpage usage would be aarch64 (especially for Apple
M1/2 chips).
For those Apple based ones, they have no ability to expand, thus won't
hit any real zoned devices.
For other aarch64 servers, they should have the ability to choose a 4K
page size kernel if they really want to go zoned devices.

This bug is only exposed with a helpful reporter using 16K page sized
loongson board with SATA zoned disk.

Due to above reasons, I really prefer to keep the current situation, and
focus on the proper fix instead.

Thanks,
Qu