From: Jens Axboe <axboe@kernel.dk>
To: Chao Yu <chao@kernel.org>, hanqi <hanqi@vivo.com>, jaegeuk@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: f2fs supports uncached buffered I/O read
Date: Sat, 2 Aug 2025 09:35:13 -0600 [thread overview]
Message-ID: <e163bbcd-b4d7-4a76-a42f-950f3cb5a644@kernel.dk> (raw)
In-Reply-To: <68c061ad-cbb7-44e8-a905-c13b9ec81c62@kernel.org>
On 7/30/25 8:35 PM, Chao Yu wrote:
> On 7/30/25 23:20, Jens Axboe wrote:
>> On 7/28/25 2:28 AM, hanqi wrote:
>>> ? 2025/7/28 16:07, Chao Yu ??:
>>>> On 7/28/25 16:03, hanqi wrote:
>>>>> ? 2025/7/28 15:38, Chao Yu ??:
>>>>>
>>>>>> On 7/25/25 15:53, Qi Han wrote:
>>>>>>> Jens has already completed the development of uncached buffered I/O
>>>>>>> in git [1], and in f2fs, uncached buffered I/O read can be enabled
>>>>>>> simply by setting the FOP_DONTCACHE flag in f2fs_file_operations.
>>>>>> IIUC, we may suffer lock issue when we call pwritev(.. ,RWF_DONTCACHE)?
>>>>>> as Jen mentioned in below path, right?
>>>>>>
>>>>>> soft-irq
>>>>>> - folio_end_writeback()
>>>>>> - filemap_end_dropbehind_write()
>>>>>> - filemap_end_dropbehind()
>>>>>> - folio_unmap_invalidate()
>>>>>> - lock i_lock
>>>>>>
>>>>>> Thanks,
>>>>> That's how I understand it.
>>>> So I guess we need to wait for the support RWF_DONTCACHE on write path, unless
>>>> you can walk around for write path in this patch.
>>>>
>>>> Thanks,
>>>
>>> I think the read and write paths can be submitted separately.
>>> Currently, uncached buffered I/O write requires setting the
>>> FGP_DONTCACHE flag when the filesystem allocates a folio. In
>>> f2fs, this is done in the following path:
>>>
>>> - write_begin
>>> - f2fs_write_begin
>>> - __filemap_get_folio
>>> As I understand it, if we don't set the FGP_DONTCACHE flag here, this
>>> issue shouldn't occur.
>>
>> It won't cause an issue, but it also won't work in the sense that the
>> intent is that if the file system doesn't support DONTCACHE, it would
>> get errored at submission time. Your approach would just ignore the flag
>> for writes, rather than return -EOPNOTSUPP as would be expected.
>
> Jens,
>
> Do you mean like what we have done in kiocb_set_rw_flags()?
>
> if (flags & RWF_DONTCACHE) {
> /* file system must support it */
> if (!(ki->ki_filp->f_op->fop_flags & FOP_DONTCACHE))
> return -EOPNOTSUPP;
> ...
> }
>
> IIUC, it's better to have this in original patch, let me know if I'm
> missing something.
Right, that would certainly be required to have it functional on the
read side but not yet on the write side. Still leaves a weirder gap
where other file systems (like XFS and ext4) you can rely on if read or
write support is there, then the other direction is supported too. f2fs
would be the only one where the read side works, but you get -EOPNOTSUPP
on the write side.
Unless there's a rush on the read side for some reason, I think it'd be
better to have with setting FOP_DONTCACHE until the write side has been
completed too.
--
Jens Axboe
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
From: Jens Axboe <axboe@kernel.dk>
To: Chao Yu <chao@kernel.org>, hanqi <hanqi@vivo.com>, jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] f2fs: f2fs supports uncached buffered I/O read
Date: Sat, 2 Aug 2025 09:35:13 -0600 [thread overview]
Message-ID: <e163bbcd-b4d7-4a76-a42f-950f3cb5a644@kernel.dk> (raw)
In-Reply-To: <68c061ad-cbb7-44e8-a905-c13b9ec81c62@kernel.org>
On 7/30/25 8:35 PM, Chao Yu wrote:
> On 7/30/25 23:20, Jens Axboe wrote:
>> On 7/28/25 2:28 AM, hanqi wrote:
>>> ? 2025/7/28 16:07, Chao Yu ??:
>>>> On 7/28/25 16:03, hanqi wrote:
>>>>> ? 2025/7/28 15:38, Chao Yu ??:
>>>>>
>>>>>> On 7/25/25 15:53, Qi Han wrote:
>>>>>>> Jens has already completed the development of uncached buffered I/O
>>>>>>> in git [1], and in f2fs, uncached buffered I/O read can be enabled
>>>>>>> simply by setting the FOP_DONTCACHE flag in f2fs_file_operations.
>>>>>> IIUC, we may suffer lock issue when we call pwritev(.. ,RWF_DONTCACHE)?
>>>>>> as Jen mentioned in below path, right?
>>>>>>
>>>>>> soft-irq
>>>>>> - folio_end_writeback()
>>>>>> - filemap_end_dropbehind_write()
>>>>>> - filemap_end_dropbehind()
>>>>>> - folio_unmap_invalidate()
>>>>>> - lock i_lock
>>>>>>
>>>>>> Thanks,
>>>>> That's how I understand it.
>>>> So I guess we need to wait for the support RWF_DONTCACHE on write path, unless
>>>> you can walk around for write path in this patch.
>>>>
>>>> Thanks,
>>>
>>> I think the read and write paths can be submitted separately.
>>> Currently, uncached buffered I/O write requires setting the
>>> FGP_DONTCACHE flag when the filesystem allocates a folio. In
>>> f2fs, this is done in the following path:
>>>
>>> - write_begin
>>> - f2fs_write_begin
>>> - __filemap_get_folio
>>> As I understand it, if we don't set the FGP_DONTCACHE flag here, this
>>> issue shouldn't occur.
>>
>> It won't cause an issue, but it also won't work in the sense that the
>> intent is that if the file system doesn't support DONTCACHE, it would
>> get errored at submission time. Your approach would just ignore the flag
>> for writes, rather than return -EOPNOTSUPP as would be expected.
>
> Jens,
>
> Do you mean like what we have done in kiocb_set_rw_flags()?
>
> if (flags & RWF_DONTCACHE) {
> /* file system must support it */
> if (!(ki->ki_filp->f_op->fop_flags & FOP_DONTCACHE))
> return -EOPNOTSUPP;
> ...
> }
>
> IIUC, it's better to have this in original patch, let me know if I'm
> missing something.
Right, that would certainly be required to have it functional on the
read side but not yet on the write side. Still leaves a weirder gap
where other file systems (like XFS and ext4) you can rely on if read or
write support is there, then the other direction is supported too. f2fs
would be the only one where the read side works, but you get -EOPNOTSUPP
on the write side.
Unless there's a rush on the read side for some reason, I think it'd be
better to have with setting FOP_DONTCACHE until the write side has been
completed too.
--
Jens Axboe
next prev parent reply other threads:[~2025-08-02 15:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-25 7:53 [f2fs-dev] [PATCH] f2fs: f2fs supports uncached buffered I/O read Qi Han via Linux-f2fs-devel
2025-07-25 7:53 ` Qi Han
2025-07-28 7:38 ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2025-07-28 7:38 ` Chao Yu
2025-07-28 8:03 ` [f2fs-dev] " hanqi via Linux-f2fs-devel
2025-07-28 8:03 ` hanqi
2025-07-28 8:07 ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2025-07-28 8:07 ` Chao Yu
2025-07-28 8:28 ` [f2fs-dev] " hanqi via Linux-f2fs-devel
2025-07-28 8:28 ` hanqi
2025-07-30 15:20 ` [f2fs-dev] " Jens Axboe
2025-07-30 15:20 ` Jens Axboe
2025-07-31 1:58 ` [f2fs-dev] " hanqi via Linux-f2fs-devel
2025-07-31 1:58 ` hanqi
2025-07-31 2:05 ` [f2fs-dev] " Jens Axboe
2025-07-31 2:05 ` Jens Axboe
2025-07-31 2:35 ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2025-07-31 2:35 ` Chao Yu
2025-08-02 15:35 ` Jens Axboe [this message]
2025-08-02 15:35 ` Jens Axboe
2025-08-05 1:32 ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2025-08-05 1:32 ` Chao Yu
2025-07-30 8:14 ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2025-07-30 8:14 ` Chao Yu
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=e163bbcd-b4d7-4a76-a42f-950f3cb5a644@kernel.dk \
--to=axboe@kernel.dk \
--cc=chao@kernel.org \
--cc=hanqi@vivo.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.