[PATCH v3] erofs: fix blksize < PAGE_SIZE for file-backed mounts
Hongzhen Luo
hongzhen at linux.alibaba.com
Tue Oct 15 21:34:23 AEDT 2024
On 2024/10/15 15:52, Gao Xiang wrote:
>
>
> On 2024/10/15 15:07, Hongzhen Luo wrote:
>> Adjust sb->s_blocksize{,_bits} directly for file-backed
>> mounts when the fs block size is smaller than PAGE_SIZE.
>>
>> Previously, EROFS used sb_set_blocksize(), which caused
>> a panic if bdev-backed mounts is not used.
>>
>> Fixes: fb176750266a ("erofs: add file-backed mount support")
>> Signed-off-by: Hongzhen Luo <hongzhen at linux.alibaba.com>
>> ---
>> v3: Fix trivial typos.
>> v2:
>> https://lore.kernel.org/linux-erofs/20241015064007.3449582-1-hongzhen@linux.alibaba.com/
>> v1:
>> https://lore.kernel.org/linux-erofs/20241015033601.3206952-1-hongzhen@linux.alibaba.com/
>> ---
>> fs/erofs/super.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
>> index 320d586c3896..ca45dfb17d7c 100644
>> --- a/fs/erofs/super.c
>> +++ b/fs/erofs/super.c
>> @@ -631,7 +631,11 @@ static int erofs_fc_fill_super(struct
>> super_block *sb, struct fs_context *fc)
>> errorfc(fc, "unsupported blksize for fscache mode");
>> return -EINVAL;
>> }
>> - if (!sb_set_blocksize(sb, 1 << sbi->blkszbits)) {
>> +
>> + if (erofs_is_fileio_mode(sbi)) {
>> + sb->s_blocksize = (1 << sbi->blkszbits);
>
> Why needing parentheses here?
>
> Thanks,
> Gao Xiang
I will resend a version without the parentheses soon.
---
Thanks,
Hongzhen
>
>> + sb->s_blocksize_bits = sbi->blkszbits;
>> + } else if (!sb_set_blocksize(sb, 1 << sbi->blkszbits)) {
>> errorfc(fc, "failed to set erofs blksize");
>> return -EINVAL;
>> }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linux-erofs/attachments/20241015/cc2954c1/attachment.htm>
More information about the Linux-erofs
mailing list