Message ID | 20240903054012.1238270-1-j.xia@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fs/btrfs: Pass write-hint for buffered IO | expand |
On 18.09.24 02:16, j.xia wrote: > 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(). > write-hint for buffered IO from btrfs file system to block layer > by filling bi_write_hint of struct bio in alloc_new_bio(). > > Signed-off-by: j.xia <j.xia@samsung.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
On Tue, Sep 03, 2024 at 01:40:12PM +0800, j.xia wrote: > 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(). 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.
> On Tue, Sep 03, 2024 at 01:40:12PM +0800, j.xia wrote: > > 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(). > > What's the status of the write hints? The commit chain is revert, "enum rw_hint" include/linux/rw_hint.h defines the status. > 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 Link: https://lore.kernel.org/all/20240910150200.6589-6-joshi.k@samsung.com > > 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.
> > On Tue, Sep 03, 2024 at 01:40:12PM +0800, j.xia wrote: > > > 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(). > > > > What's the status of the write hints? The commit chain is revert, > > "enum rw_hint" include/linux/rw_hint.h defines the status. > > > 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 > Link: https://lore.kernel.org/all/20240910150200.6589-6-joshi.k@samsung.com > > > > > 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. >
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index bd1a7b2fc71a..90413ae9c0ac 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -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;
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(). Signed-off-by: j.xia <j.xia@samsung.com> --- fs/btrfs/extent_io.c | 1 + 1 file changed, 1 insertion(+)