]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
f2fs: map data writes to FDP streams
authorWenjie Qi <qwjhust@gmail.com>
Fri, 17 Apr 2026 03:51:26 +0000 (11:51 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 22 May 2026 03:49:06 +0000 (03:49 +0000)
commite6c8140bd06d7dd8ee1e3c690445d3cfcaf1d892
treec7d759b3d3bce5858968f897eca6cadd3164fa91
parent70eda68668d1476b459b64e69b8f36659fa9dfa8
f2fs: map data writes to FDP streams

From: Wenjie Qi <qiwenjie@xiaomi.com>

F2FS already classifies DATA writes using its existing hot, warm and cold
temperature policy, but it only passes that intent down as a write hint.
That hint alone is not sufficient for NVMe FDP placement, because the
current NVMe command path consumes `bio->bi_write_stream` rather than
`bio->bi_write_hint` when selecting a placement ID.

When the target block device exposes write streams, map the existing F2FS
DATA temperature classes onto stream IDs and set `bio->bi_write_stream`
for both buffered and direct writes. If the device exposes no write
streams, keep the current behavior by leaving the stream unset.

The stream mapping is evaluated against the target block device of each
bio, so the existing per-device fallback behavior stays unchanged for
multi-device filesystems. Existing blkzoned restrictions also remain in
place.

The mapping is intentionally small and deterministic:

- 1 stream: hot, warm and cold all use stream 1
- 2 streams: hot/warm use 1, cold uses 2
- 3+ streams: hot uses 1, warm uses 2, cold uses 3

Signed-off-by: Wenjie Qi <qwjhust@gmail.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Documentation/filesystems/f2fs.rst
fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/file.c
fs/f2fs/segment.c