From: Chao Yu <chao@kernel.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Wenjie Qi <qwjhust@gmail.com>
Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, qiwenjie@xiaomi.com
Subject: Re: [PATCH] f2fs: honor per-I/O write streams for direct writes
Date: Wed, 10 Jun 2026 19:24:36 +0800 [thread overview]
Message-ID: <d3cc94c7-ac79-4789-9adb-24d5947c54e6@kernel.org> (raw)
In-Reply-To: <aiiyiBkRYm2XgCtZ@google.com>
On 6/10/26 08:40, Jaegeuk Kim wrote:
> On 05/22, Wenjie Qi wrote:
>> io_uring can pass a per-I/O write stream through kiocb->ki_write_stream,
>> and block direct I/O propagates that value to bio->bi_write_stream.
>>
>> F2FS added FDP stream mapping for DATA writes, but its direct write
>> submit hook always rewrites bio->bi_write_stream from the inode write
>> hint and F2FS temperature. As a result, a direct write with an explicit
>> io_uring write_stream is submitted to the F2FS-selected stream instead
>> of the user-requested stream.
>>
>> Validate an explicit write stream before starting F2FS direct I/O, pass
>> the kiocb through the iomap private pointer, and preserve the per-I/O
>> stream in the direct write bio. When no per-I/O stream is supplied, keep
>> using the existing F2FS temperature-to-stream mapping.
>>
>> Fixes: 42f7a7a50a33 ("f2fs: map data writes to FDP streams")
>> Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
>> ---
>> fs/f2fs/file.c | 30 +++++++++++++++++++++++++++---
>> 1 file changed, 27 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
>> index 71385ca4163d..20d6e7ab7416 100644
>> --- a/fs/f2fs/file.c
>> +++ b/fs/f2fs/file.c
>> @@ -5074,17 +5074,36 @@ static int f2fs_dio_write_end_io(struct kiocb *iocb, ssize_t size, int error,
>> return 0;
>> }
>>
>> +static bool f2fs_valid_write_stream(struct f2fs_sb_info *sbi, u8 write_stream)
>> +{
>> + int i;
>> +
>> + if (!write_stream)
>> + return true;
>> + if (!f2fs_is_multi_device(sbi))
>> + return write_stream <= bdev_max_write_streams(sbi->sb->s_bdev);
>> +
>> + for (i = 0; i < sbi->s_ndevs; i++)
>> + if (write_stream > bdev_max_write_streams(FDEV(i).bdev))
>> + return false;
>> + return true;
>> +}
>> +
>> static void f2fs_dio_write_submit_io(const struct iomap_iter *iter,
>> struct bio *bio, loff_t file_offset)
>> {
>> struct inode *inode = iter->inode;
>> struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
>> + struct kiocb *iocb = iter->private;
>> enum log_type type = f2fs_rw_hint_to_seg_type(sbi, inode->i_write_hint);
>> enum temp_type temp = f2fs_get_segment_temp(sbi, type);
>>
>> bio->bi_write_hint = f2fs_io_type_to_rw_hint(sbi, DATA, temp);
>> - bio->bi_write_stream =
>> - f2fs_io_type_to_write_stream(bio->bi_bdev, DATA, temp);
>> + if (iocb->ki_write_stream)
>> + bio->bi_write_stream = iocb->ki_write_stream;
>> + else
>> + bio->bi_write_stream =
>> + f2fs_io_type_to_write_stream(bio->bi_bdev, DATA, temp);
>
> Let me apply as below.
>
> bio->bi_write_stream =
> + iocb->ki_write_stream ? iocb->ki_write_stream :
> f2fs_io_type_to_write_stream(bio->bi_bdev, DATA, temp);
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
prev parent reply other threads:[~2026-06-10 11:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 6:12 Wenjie Qi
2026-06-10 0:40 ` Jaegeuk Kim
2026-06-10 11:24 ` Chao Yu [this message]
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=d3cc94c7-ac79-4789-9adb-24d5947c54e6@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=qiwenjie@xiaomi.com \
--cc=qwjhust@gmail.com \
/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
all inboxes | Powered by JetHome®