[PATCH] erofs: fix file-backed mounts over FUSE
Gao Xiang
hsiangkao at linux.alibaba.com
Thu Nov 14 17:23:27 AEDT 2024
Hi Al,
On 2024/11/14 14:04, Al Viro wrote:
> On Thu, Nov 14, 2024 at 01:19:57PM +0800, Gao Xiang wrote:
>
>> diff --git a/fs/erofs/data.c b/fs/erofs/data.c
>> index 6355866220ff..43c89194d348 100644
>> --- a/fs/erofs/data.c
>> +++ b/fs/erofs/data.c
>> @@ -38,7 +38,10 @@ void *erofs_bread(struct erofs_buf *buf, erofs_off_t offset,
>> }
>> if (!folio || !folio_contains(folio, index)) {
>> erofs_put_metabuf(buf);
>> - folio = read_mapping_folio(buf->mapping, index, NULL);
>> + folio = buf->use_fp ?
>> + read_mapping_folio(file_inode(buf->filp)->i_mapping,
>> + index, buf->filp) :
>> + read_mapping_folio(buf->mapping, index, NULL);
>
> UGH...
>
> 1) 'filp' is an atrocious identifier. Please, don't perpetuate
> the piss-poor taste of AST - if you want to say 'file', say so.
ok.
>
> 2) there's ->f_mapping; no need to go through the file_inode().
Yeah, thanks for the suggestion.
>
> 3) AFAICS, (buf->kmap_type == EROFS_KMAP) == (buf->base != NULL). What's
> the point of having that as a separate field?
Once buf->kmap_type has EROFS_KMAP and EROFS_KMAP_ATOMIC, but it
seems that it can be cleaned up now.
I will clean up later but it's a seperate story.
>
> 4) Why bother with union? Just have buf->file serve as your buf->use_fp
> and be done with that...
I'd like to leave `struct erofs_buf` as small as possible since
it's on stack.
Leave two fields for this are also ok for me anyway.
Thanks,
Gao Xiang
More information about the Linux-erofs
mailing list