[PATCH v2] erofs: fix file-backed mounts over FUSE
Gao Xiang
hsiangkao at linux.alibaba.com
Fri Nov 15 10:26:31 AEDT 2024
On 2024/11/15 00:18, Al Viro wrote:
> On Thu, Nov 14, 2024 at 05:01:09PM +0800, Gao Xiang wrote:
>> --- a/fs/erofs/data.c
>> +++ b/fs/erofs/data.c
>> @@ -38,7 +38,9 @@ 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->file ? read_mapping_folio(buf->file->f_mapping,
>> + index, buf->file) :
>> + read_mapping_folio(buf->mapping, index, NULL);
>> if (IS_ERR(folio))
>> return folio;
>> }
>> @@ -61,8 +63,8 @@ void erofs_init_metabuf(struct erofs_buf *buf, struct super_block *sb)
>> {
>> struct erofs_sb_info *sbi = EROFS_SB(sb);
>>
>> - if (erofs_is_fileio_mode(sbi))
>> - buf->mapping = file_inode(sbi->fdev)->i_mapping;
>> + if (erofs_is_fileio_mode(sbi)) /* some fs like FUSE needs it */
>> + buf->file = sbi->fdev;
>
> Would be easier to set *both* ->mapping and ->file at that point, so that
> erofs_bread() would just have read_mapping_folio(buf->mapping, index, buf->file),
> unconditionally...
Ok, will do the next version.
Thanks,
Gao Xiang
More information about the Linux-erofs
mailing list