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

Johannes Thumshirn
2024-02-12T10:25:47Z

On 12.02.24 10:50, 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.

All good, I didn't have enough coffee.