Message ID | 20241017160937.2283225-5-kbusch@meta.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | write hints for nvme fdp | expand |
On Thu, Oct 17, 2024 at 09:09:35AM -0700, Keith Busch wrote: > From: Keith Busch <kbusch@kernel.org> > > A block device may support write hints on a per-io basis. The raw block > file operations can effectively use these, but real filesystems are not > ready to make use of this. Provide a file_operations flag to indicate > support, and set it for the block file operations. I'm a little worried about the overly generic "hint" think again. Make it very explicit about the write streams and this make sense.
On 10/17/24 18:09, Keith Busch wrote: > From: Keith Busch <kbusch@kernel.org> > > A block device may support write hints on a per-io basis. The raw block > file operations can effectively use these, but real filesystems are not > ready to make use of this. Provide a file_operations flag to indicate > support, and set it for the block file operations. > > Signed-off-by: Keith Busch <kbusch@kernel.org> > --- > block/fops.c | 2 +- > include/linux/fs.h | 2 ++ > 2 files changed, 3 insertions(+), 1 deletion(-) > Reviewed-by: Hannes Reinecke <hare@suse.de> Cheers, Hannes
diff --git a/block/fops.c b/block/fops.c index d0b16d3975fd6..15a63e26161ea 100644 --- a/block/fops.c +++ b/block/fops.c @@ -869,7 +869,7 @@ const struct file_operations def_blk_fops = { .splice_write = iter_file_splice_write, .fallocate = blkdev_fallocate, .uring_cmd = blkdev_uring_cmd, - .fop_flags = FOP_BUFFER_RASYNC, + .fop_flags = FOP_BUFFER_RASYNC | FOP_PER_IO_HINTS, }; static __init int blkdev_init(void) diff --git a/include/linux/fs.h b/include/linux/fs.h index 04e875a37f604..026dc9801dc20 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2117,6 +2117,8 @@ struct file_operations { #define FOP_HUGE_PAGES ((__force fop_flags_t)(1 << 4)) /* Treat loff_t as unsigned (e.g., /dev/mem) */ #define FOP_UNSIGNED_OFFSET ((__force fop_flags_t)(1 << 5)) +/* File system can handle per-io hints */ +#define FOP_PER_IO_HINTS ((__force fop_flags_t)(1 << 6)) /* Wrap a directory iterator that needs exclusive inode access */ int wrap_directory_iterator(struct file *, struct dir_context *,