[PATCH] erofs: fix file-backed mounts over FUSE
Al Viro
viro at zeniv.linux.org.uk
Thu Nov 14 17:04:34 AEDT 2024
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.
2) there's ->f_mapping; no need to go through the file_inode().
3) AFAICS, (buf->kmap_type == EROFS_KMAP) == (buf->base != NULL). What's
the point of having that as a separate field?
4) Why bother with union? Just have buf->file serve as your buf->use_fp
and be done with that...
More information about the Linux-erofs
mailing list