* [PATCH] fs/btrfs: Pass write-hint for buffered IO
[not found] <CGME20240903054032epcas5p41a43b67314c727e07a049344adbca480@epcas5p4.samsung.com>
@ 2024-09-03 5:40 ` j.xia
2024-09-18 8:36 ` Johannes Thumshirn
2024-09-19 18:45 ` David Sterba
0 siblings, 2 replies; 6+ messages in thread
From: j.xia @ 2024-09-03 5:40 UTC (permalink / raw)
To: clm, josef, dsterba; +Cc: linux-btrfs, 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 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(+)
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;
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] fs/btrfs: Pass write-hint for buffered IO
2024-09-03 5:40 ` [PATCH] fs/btrfs: Pass write-hint for buffered IO j.xia
@ 2024-09-18 8:36 ` Johannes Thumshirn
2024-09-19 18:45 ` David Sterba
1 sibling, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2024-09-18 8:36 UTC (permalink / raw)
To: j.xia, clm@fb.com, josef@toxicpanda.com, dsterba@suse.com
Cc: linux-btrfs@vger.kernel.org
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>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] fs/btrfs: Pass write-hint for buffered IO
2024-09-03 5:40 ` [PATCH] fs/btrfs: Pass write-hint for buffered IO j.xia
2024-09-18 8:36 ` Johannes Thumshirn
@ 2024-09-19 18:45 ` David Sterba
2024-09-20 5:52 ` j.xia
1 sibling, 1 reply; 6+ messages in thread
From: David Sterba @ 2024-09-19 18:45 UTC (permalink / raw)
To: j.xia; +Cc: clm, josef, dsterba, linux-btrfs
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: [PATCH] fs/btrfs: Pass write-hint for buffered IO
2024-09-19 18:45 ` David Sterba
@ 2024-09-20 5:52 ` j.xia
2024-11-15 3:05 ` Jing Xia
0 siblings, 1 reply; 6+ messages in thread
From: j.xia @ 2024-09-20 5:52 UTC (permalink / raw)
To: dsterba; +Cc: clm, dsterba, j.xia, josef, linux-btrfs
> 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: Re: [PATCH] fs/btrfs: Pass write-hint for buffered IO
2024-09-20 5:52 ` j.xia
@ 2024-11-15 3:05 ` Jing Xia
2025-01-09 17:54 ` David Sterba
0 siblings, 1 reply; 6+ messages in thread
From: Jing Xia @ 2024-11-15 3:05 UTC (permalink / raw)
To: dsterba; +Cc: clm, dsterba, j.xia, josef, linux-btrfs
> > 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.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: Re: [PATCH] fs/btrfs: Pass write-hint for buffered IO
2024-11-15 3:05 ` Jing Xia
@ 2025-01-09 17:54 ` David Sterba
0 siblings, 0 replies; 6+ messages in thread
From: David Sterba @ 2025-01-09 17:54 UTC (permalink / raw)
To: Jing Xia; +Cc: clm, dsterba, josef, linux-btrfs, johannes.thumshirn
On Fri, Nov 15, 2024 at 11:05:12AM +0800, Jing Xia wrote:
> > > 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.
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-01-09 17:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20240903054032epcas5p41a43b67314c727e07a049344adbca480@epcas5p4.samsung.com>
2024-09-03 5:40 ` [PATCH] fs/btrfs: Pass write-hint for buffered IO j.xia
2024-09-18 8:36 ` Johannes Thumshirn
2024-09-19 18:45 ` David Sterba
2024-09-20 5:52 ` j.xia
2024-11-15 3:05 ` Jing Xia
2025-01-09 17:54 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).