public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-erofs@lists.ozlabs.org, LKML <linux-kernel@vger.kernel.org>,
	syzbot+0b1279812c46e48bb0c1@syzkaller.appspotmail.com
Subject: Re: [PATCH] erofs: fix file-backed mounts over FUSE
Date: Thu, 14 Nov 2024 14:23:27 +0800	[thread overview]
Message-ID: <61c24337-798d-4a2e-82bf-996e86d0c0fb@linux.alibaba.com> (raw)
In-Reply-To: <20241114060434.GL3387508@ZenIV>

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

  reply	other threads:[~2024-11-14  6:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-14  5:19 [PATCH] erofs: fix file-backed mounts over FUSE Gao Xiang
2024-11-14  6:04 ` Al Viro
2024-11-14  6:23   ` Gao Xiang [this message]
2024-11-14  6:34     ` Al Viro
2024-11-14  6:38       ` Gao Xiang
  -- strict thread matches above, loose matches on Subject: below --
2024-11-14 23:46 Gao Xiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=61c24337-798d-4a2e-82bf-996e86d0c0fb@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+0b1279812c46e48bb0c1@syzkaller.appspotmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox