fs/btrfs: Pass write-hint for buffered IO
A message that is not in the archive (sent off-list or not yet received): CGME20240903054032epcas5p41a43b67314c727e07a049344adbca480@epcas5p4.samsung.com
PATCH 1/1 fs/btrfs: Pass write-hint for buffered IO
Commit 449813515d3e ("block, fs: Restore the per-bio/request data lifetime fields") restored write-hint support in btrfs. But that is applicable only for direct IO. This patch supports passing write-hint for buffered IO from btrfs file system to block layer by filling bi_write_hint of struct bio in alloc_new_bio().
--- fs/btrfs/extent_io.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/extent_io.c +1 -0
@@ -702,6 +702,7 @@ static void alloc_new_bio(struct btrfs_inode *inode, bbio =btrfs_bio_alloc (BIO_MAX_VECS , bio_ctrl->opf, fs_info, bio_ctrl->end_io_func,NULL ); bbio->bio.bi_iter.bi_sector = disk_bytenr >>SECTOR_SHIFT ; + bbio->bio.bi_write_hint = inode->vfs_inode.i_write_hint; bbio->inode = inode; bbio->file_offset = file_offset; bio_ctrl->bbio = bbio;
Signature · 1 line
2.34.1
Quoted 3 lines · j.xia
Commit
449813515d3e("block, fs: Restore the per-bio/request data lifetime fields") restored write-hint support in btrfs. But that is applicable only for direct IO. This patch supports passing
because it is set in iomap_dio_bio_iter().
Quoted 4 lines
write-hint for buffered IO from btrfs file system to block layer by filling
bi_write_hintof struct bio inalloc_new_bio().Signed-off-by j.xia <[email protected]>
Quoted 5 lines · j.xia
Commit
449813515d3e("block, fs: Restore the per-bio/request data lifetime fields") restored write-hint support in btrfs. But that is applicable only for direct IO. This patch supports passing write-hint for buffered IO from btrfs file system to block layer by fillingbi_write_hintof struct bio inalloc_new_bio().
What's the status of the write hints? The commit chain is revert, removal and mentioning that NVMe does not make use of the write hint so what hardware is using it?
The patch is probably ok as it passes the information from inode to bio, otherwise btrfs does not make any use of it, we have heuristics around extent size, not the expected write lifetime expectancy.
Quoted 8 lines · j.xia
Quoted 5 lines
Commit
449813515d3e("block, fs: Restore the per-bio/request data lifetime fields") restored write-hint support in btrfs. But that is applicable only for direct IO. This patch supports passing write-hint for buffered IO from btrfs file system to block layer by fillingbi_write_hintof struct bio inalloc_new_bio().What's the status of the write hints? The commit chain is revert,
"enum rw_hint" include/linux/rw_hint.h defines the status.
Quoted 2 lines
removal and mentioning that NVMe does not make use of the write hint so what hardware is using it?
New NVMe Flexible Data Placement (FDP) SSD (TP4146) is able to use hint to place data in different streams.
The related patch is
Quoted 4 lines
The patch is probably ok as it passes the information from inode to bio, otherwise btrfs does not make any use of it, we have heuristics around extent size, not the expected write lifetime expectancy.
Quoted 11 lines
Quoted 8 lines · j.xia
Quoted 5 lines
Commit
449813515d3e("block, fs: Restore the per-bio/request data lifetime fields") restored write-hint support in btrfs. But that is applicable only for direct IO. This patch supports passing write-hint for buffered IO from btrfs file system to block layer by fillingbi_write_hintof struct bio inalloc_new_bio().What's the status of the write hints? The commit chain is revert,
"enum
rw_hint"include/linux/rw_hint.hdefines the status.
Quoted 13 lines
Quoted 2 lines
removal and mentioning that NVMe does not make use of the write hint so what hardware is using it?
New NVMe Flexible Data Placement (FDP) SSD (TP4146) is able to use hint to place data in different streams.
The related patch isQuoted 4 lines
The patch is probably ok as it passes the information from inode to bio, otherwise btrfs does not make any use of it, we have heuristics around extent size, not the expected write lifetime expectancy.
fcntl() interface can be used to set/get write life time hints. Now the write hint can be passed from inode->i_write_hint to bio->bi_write_hint for direct IO. This patch completes this feature for buffered IO.
Quoted 1 line
Quoted 26 lines · Jing Xia
Quoted 11 lines
Quoted 8 lines · j.xia
Quoted 5 lines
Commit
449813515d3e("block, fs: Restore the per-bio/request data lifetime fields") restored write-hint support in btrfs. But that is applicable only for direct IO. This patch supports passing write-hint for buffered IO from btrfs file system to block layer by fillingbi_write_hintof struct bio inalloc_new_bio().What's the status of the write hints? The commit chain is revert,
"enum
rw_hint"include/linux/rw_hint.hdefines the status.Quoted 13 lines
Quoted 2 lines
removal and mentioning that NVMe does not make use of the write hint so what hardware is using it?
New NVMe Flexible Data Placement (FDP) SSD (TP4146) is able to use hint to place data in different streams.
The related patch isQuoted 4 lines
The patch is probably ok as it passes the information from inode to bio, otherwise btrfs does not make any use of it, we have heuristics around extent size, not the expected write lifetime expectancy.
Quoted 4 lines
fcntl()interface can be used to set/get write life time hints. Now the write hint can be passed frominode->i_write_hinttobio->bi_write_hintfor direct IO. This patch completes this feature for buffered IO.
FYI, I'm merging this to Btrfs for 6.14. I've talked to Johannes, there seems to be a use case for RocksDB at least that can set the temperatures and code-wise it's trivial change. The status of device support is still ongoing. Given the hint is only passed by the filesystem it's up to the application to use it properly.