Skip to contentSkip to conversation

write hints with nvme fdp and scsi streams

PATCH Superseded Keith Busch 8 participants 30 messages Nov 8, 2024 – Nov 21, 2024

Subsystems (5)
VFS SCSI Block layer NVMe +1 more subsystems

v11 of 14 Superseded Latest is v14 →

lore
Share & tools
lore
#0 lore raw

v11 cover write hints with nvme fdp and scsi streams

From: Keith Busch <[email protected]>

Changes from v10:

Fixed FDP max handle size calculations (wrong type)

Defined and used FDP constants instead of literal numbers

Moved io_uring write_hint to the end of the SQE so as not to overlap with other defined fields except uring_cmd

Default partition split so partition one gets all the write hints exclusively

Folded in the fix for stacking block stream feature for nvme-multipath (from hch xfs-zoned-streams branch)

Kanchan Joshi (2):
io_uring: enable per-io hinting capability
nvme: enable FDP support

Keith Busch (7):
block: use generic u16 for write hints
block: introduce max_write_hints queue limit
statx: add write hint information
block: allow ability to limit partition write hints block, fs: add write hint to kiocb
block: export placement hint feature
scsi: set permanent stream count in block limits

 Documentation/ABI/stable/sysfs-block | 14 ++++++
 block/bdev.c                         | 22 +++++++++
 block/blk-settings.c                 |  5 ++
 block/blk-sysfs.c                    |  6 +++
 block/fops.c                         | 31 +++++++++++--
 block/partitions/core.c              | 45 +++++++++++++++++-
 drivers/nvme/host/core.c             | 69 ++++++++++++++++++++++++++++
 drivers/nvme/host/multipath.c        |  3 +-
 drivers/nvme/host/nvme.h             |  5 ++
 drivers/scsi/sd.c                    |  2 +
 fs/stat.c                            |  1 +
 include/linux/blk-mq.h               |  3 +-
 include/linux/blk_types.h            |  4 +-
 include/linux/blkdev.h               | 15 ++++++
 include/linux/fs.h                   |  1 +
 include/linux/nvme.h                 | 37 +++++++++++++++
 include/linux/stat.h                 |  1 +
 include/uapi/linux/io_uring.h        |  4 ++
 include/uapi/linux/stat.h            |  3 +-
 io_uring/io_uring.c                  |  2 +
 io_uring/rw.c                        |  2 +-
 21 files changed, 263 insertions(+), 12 deletions(-)
Signature · 1 line
2.43.5
#1 lore raw

PATCH v11 1/9 block: use generic u16 for write hints

From: Keith Busch <[email protected]>

This is still backwards compatible with lifetime hints. It just doesn't constrain the hints to that definition. Using this type doesn't change the size of either bio or request.

---
 include/linux/blk-mq.h    | 3 +--
 include/linux/blk_types.h | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
include/linux/blk-mq.h +1 -2
index 2035fad3131fb..08ed7b5c4dbbf 100644
@@ -8,7 +8,6 @@
 #include <linux/scatterlist.h>
 #include <linux/prefetch.h>
 #include <linux/srcu.h>
-#include <linux/rw_hint.h>
 
 struct blk_mq_tags;
 struct blk_flush_queue;
@@ -156,7 +155,7 @@ struct request {
 	struct blk_crypto_keyslot *crypt_keyslot;
 #endif
 
-	enum rw_hint write_hint;
+	unsigned short write_hint;
 	unsigned short ioprio;
 
 	enum mq_rq_state state;
include/linux/blk_types.h +1 -2
index dce7615c35e7e..6737795220e18 100644
@@ -10,7 +10,6 @@
 #include <linux/bvec.h>
 #include <linux/device.h>
 #include <linux/ktime.h>
-#include <linux/rw_hint.h>
 
 struct bio_set;
 struct bio;
@@ -219,7 +218,7 @@ struct bio {
 						 */
 	unsigned short		bi_flags;	/* BIO_* below */
 	unsigned short		bi_ioprio;
-	enum rw_hint		bi_write_hint;
+	unsigned short		bi_write_hint;
 	blk_status_t		bi_status;
 	atomic_t		__bi_remaining;
 
Signature · 1 line
2.43.5
#2 lore raw

PATCH v11 2/9 block: introduce max_write_hints queue limit

In reply to Keith Busch

From: Keith Busch <[email protected]>

Drivers with hardware that support write streams need a way to export how many are available so applications can generically query this.

---
 Documentation/ABI/stable/sysfs-block |  7 +++++++
 block/blk-settings.c                 |  3 +++
 block/blk-sysfs.c                    |  3 +++
 include/linux/blkdev.h               | 12 ++++++++++++
 4 files changed, 25 insertions(+)
Documentation/ABI/stable/sysfs-block +7 -0
index 8353611107154..f2db2cabb8e75 100644
@@ -506,6 +506,13 @@ Description:
 		[RO] Maximum size in bytes of a single element in a DMA
 		scatter/gather list.
 
+What:		/sys/block/<disk>/queue/max_write_hints
+Date:		October 2024
+Contact:	[email protected]
+Description:
+		[RO] Maximum number of write hints supported, 0 if not
+		supported. If supported, valid values are 1 through
+		max_write_hints, inclusive.
 
 What:		/sys/block/<disk>/queue/max_segments
 Date:		March 2010
block/blk-settings.c +3 -0
index 5ee3d6d1448df..f9f831f104615 100644
@@ -43,6 +43,7 @@ void blk_set_stacking_limits(struct queue_limits *lim)
 	lim->seg_boundary_mask = BLK_SEG_BOUNDARY_MASK;
 
 	/* Inherit limits from component devices */
+	lim->max_write_hints = USHRT_MAX;
 	lim->max_segments = USHRT_MAX;
 	lim->max_discard_segments = USHRT_MAX;
 	lim->max_hw_sectors = UINT_MAX;
@@ -544,6 +545,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
 	t->max_segment_size = min_not_zero(t->max_segment_size,
 					   b->max_segment_size);
 
+	t->max_write_hints = min(t->max_write_hints, b->max_write_hints);
+
 	alignment = queue_limit_alignment_offset(b, start);
 
 	/* Bottom device has different alignment.  Check that it is
block/blk-sysfs.c +3 -0
index 0ef4e13e247d9..1925ea23bd290 100644
@@ -104,6 +104,7 @@ QUEUE_SYSFS_LIMIT_SHOW(max_segments)
 QUEUE_SYSFS_LIMIT_SHOW(max_discard_segments)
 QUEUE_SYSFS_LIMIT_SHOW(max_integrity_segments)
 QUEUE_SYSFS_LIMIT_SHOW(max_segment_size)
+QUEUE_SYSFS_LIMIT_SHOW(max_write_hints)
 QUEUE_SYSFS_LIMIT_SHOW(logical_block_size)
 QUEUE_SYSFS_LIMIT_SHOW(physical_block_size)
 QUEUE_SYSFS_LIMIT_SHOW(chunk_sectors)
@@ -457,6 +458,7 @@ QUEUE_RO_ENTRY(queue_max_hw_sectors, "max_hw_sectors_kb");
 QUEUE_RO_ENTRY(queue_max_segments, "max_segments");
 QUEUE_RO_ENTRY(queue_max_integrity_segments, "max_integrity_segments");
 QUEUE_RO_ENTRY(queue_max_segment_size, "max_segment_size");
+QUEUE_RO_ENTRY(queue_max_write_hints, "max_write_hints");
 QUEUE_RW_LOAD_MODULE_ENTRY(elv_iosched, "scheduler");
 
 QUEUE_RO_ENTRY(queue_logical_block_size, "logical_block_size");
@@ -591,6 +593,7 @@ static struct attribute *queue_attrs[] = {
 	&queue_max_discard_segments_entry.attr,
 	&queue_max_integrity_segments_entry.attr,
 	&queue_max_segment_size_entry.attr,
+	&queue_max_write_hints_entry.attr,
 	&queue_hw_sector_size_entry.attr,
 	&queue_logical_block_size_entry.attr,
 	&queue_physical_block_size_entry.attr,
include/linux/blkdev.h +12 -0
index 1b51a7c92e9be..1477f751ad8bd 100644
@@ -394,6 +394,8 @@ struct queue_limits {
 	unsigned short		max_integrity_segments;
 	unsigned short		max_discard_segments;
 
+	unsigned short		max_write_hints;
+
 	unsigned int		max_open_zones;
 	unsigned int		max_active_zones;
 
@@ -1198,6 +1200,11 @@ static inline unsigned short queue_max_segments(const struct request_queue *q)
 	return q->limits.max_segments;
 }
 
+static inline unsigned short queue_max_write_hints(struct request_queue *q)
+{
+	return q->limits.max_write_hints;
+}
+
 static inline unsigned short queue_max_discard_segments(const struct request_queue *q)
 {
 	return q->limits.max_discard_segments;
@@ -1245,6 +1252,11 @@ static inline unsigned int bdev_max_segments(struct block_device *bdev)
 	return queue_max_segments(bdev_get_queue(bdev));
 }
 
+static inline unsigned short bdev_max_write_hints(struct block_device *bdev)
+{
+	return queue_max_write_hints(bdev_get_queue(bdev));
+}
+
 static inline unsigned queue_logical_block_size(const struct request_queue *q)
 {
 	return q->limits.logical_block_size;
Signature · 1 line
2.43.5
#3 lore raw

PATCH v11 3/9 statx: add write hint information

In reply to Keith Busch

From: Keith Busch <[email protected]>

If requested on a raw block device, report the maximum write hint the block device supports.

---
 block/bdev.c              | 5 +++++
 fs/stat.c                 | 1 +
 include/linux/stat.h      | 1 +
 include/uapi/linux/stat.h | 3 ++-
 4 files changed, 9 insertions(+), 1 deletion(-)
block/bdev.c +5 -0
index 738e3c8457e7f..9a59f0c882170 100644
@@ -1296,6 +1296,11 @@ void bdev_statx(struct path *path, struct kstat *stat,
 		stat->result_mask |= STATX_DIOALIGN;
 	}
 
+	if (request_mask & STATX_WRITE_HINT) {
+		stat->write_hint_max = bdev_max_write_hints(bdev);
+		stat->result_mask |= STATX_WRITE_HINT;
+	}
+
 	if (request_mask & STATX_WRITE_ATOMIC && bdev_can_atomic_write(bdev)) {
 		struct request_queue *bd_queue = bdev->bd_queue;
 
fs/stat.c +1 -0
index 41e598376d7e3..60bcd5c2e2a1d 100644
@@ -704,6 +704,7 @@ cp_statx(const struct kstat *stat, struct statx __user *buffer)
 	tmp.stx_atomic_write_unit_min = stat->atomic_write_unit_min;
 	tmp.stx_atomic_write_unit_max = stat->atomic_write_unit_max;
 	tmp.stx_atomic_write_segments_max = stat->atomic_write_segments_max;
+	tmp.stx_write_hint_max = stat->write_hint_max;
 
 	return copy_to_user(buffer, &tmp, sizeof(tmp)) ? -EFAULT : 0;
 }
include/linux/stat.h +1 -0
index 3d900c86981c5..48f0f64846a02 100644
@@ -57,6 +57,7 @@ struct kstat {
 	u32		atomic_write_unit_min;
 	u32		atomic_write_unit_max;
 	u32		atomic_write_segments_max;
+	u32		write_hint_max;
 };
 
 /* These definitions are internal to the kernel for now. Mainly used by nfsd. */
include/uapi/linux/stat.h +2 -1
index 887a252864416..10f5622c21113 100644
@@ -132,7 +132,7 @@ struct statx {
 	__u32	stx_atomic_write_unit_max;	/* Max atomic write unit in bytes */
 	/* 0xb0 */
 	__u32   stx_atomic_write_segments_max;	/* Max atomic write segment count */
-	__u32   __spare1[1];
+	__u32   stx_write_hint_max;
 	/* 0xb8 */
 	__u64	__spare3[9];	/* Spare space for future expansion */
 	/* 0x100 */
@@ -164,6 +164,7 @@ struct statx {
 #define STATX_MNT_ID_UNIQUE	0x00004000U	/* Want/got extended stx_mount_id */
 #define STATX_SUBVOL		0x00008000U	/* Want/got stx_subvol */
 #define STATX_WRITE_ATOMIC	0x00010000U	/* Want/got atomic_write_* fields */
+#define STATX_WRITE_HINT	0x00020000U	/* Want/got write_hint_max */
 
 #define STATX__RESERVED		0x80000000U	/* Reserved for future struct statx expansion */
 
Signature · 1 line
2.43.5
#4 lore raw

PATCH v11 4/9 block: allow ability to limit partition write hints

In reply to Keith Busch

From: Keith Busch <[email protected]>

When multiple partitions are used, you may want to enforce different subsets of the available write hints for each partition. Provide a bitmap attribute of the available write hints, and allow an admin to write a different mask to set the partition's allowed write hints.

---
 Documentation/ABI/stable/sysfs-block |  7 +++++
 block/bdev.c                         | 17 +++++++++++
 block/partitions/core.c              | 45 ++++++++++++++++++++++++++--
 include/linux/blk_types.h            |  1 +
 4 files changed, 68 insertions(+), 2 deletions(-)
Documentation/ABI/stable/sysfs-block +7 -0
index f2db2cabb8e75..fa2db6b638d63 100644
@@ -187,6 +187,13 @@ Description:
 		partition is offset from the internal allocation unit's
 		natural alignment.
 
+What:		/sys/block/<disk>/<partition>/write_hint_mask
+Date:		October 2024
+Contact:	[email protected]
+Description:
+		The mask of allowed write hints. You can limit which hints the
+		block layer will use by writing a new mask.  Only the first
+		partition can access all the write hints by default.
 
 What:		/sys/block/<disk>/<partition>/stat
 Date:		February 2008
block/bdev.c +17 -0
index 9a59f0c882170..e6f9d19db599b 100644
@@ -415,6 +415,7 @@ void __init bdev_cache_init(void)
 struct block_device *bdev_alloc(struct gendisk *disk, u8 partno)
 {
 	struct block_device *bdev;
+	unsigned short write_hint;
 	struct inode *inode;
 
 	inode = new_inode(blockdev_superblock);
@@ -440,6 +441,22 @@ struct block_device *bdev_alloc(struct gendisk *disk, u8 partno)
 		return NULL;
 	}
 	bdev->bd_disk = disk;
+
+	write_hint = bdev_max_write_hints(bdev);
+	if (write_hint) {
+		bdev->write_hint_mask = bitmap_alloc(write_hint, GFP_KERNEL);
+		if (!bdev->write_hint_mask) {
+			free_percpu(bdev->bd_stats);
+			iput(inode);
+			return NULL;
+		}
+
+		if (partno == 1)
+			bitmap_set(bdev->write_hint_mask, 0, write_hint);
+		else
+			bitmap_clear(bdev->write_hint_mask, 0, write_hint);
+	}
+
 	return bdev;
 }
 
block/partitions/core.c +43 -2

69 lines not on this page · raw message

include/linux/blk_types.h +1 -0
index 6737795220e18..af430e543f7f7 100644
@@ -73,6 +73,7 @@ struct block_device {
 #ifdef CONFIG_SECURITY
 	void			*bd_security;
 #endif
+	unsigned long		*write_hint_mask;
 	/*
 	 * keep this out-of-line as it's both big and not needed in the fast
 	 * path
Signature · 1 line
2.43.5
#5 lore raw

PATCH v11 5/9 block, fs: add write hint to kiocb

In reply to Keith Busch

From: Keith Busch <[email protected]>

This prepares for sources other than the inode to provide a write hint. The block layer will use it for direct IO if the requested hint is within the block device's allowed hints. The hint field in the kiocb structure fits in an existing 2-byte hole, so its size is not changed.

---
 block/fops.c       | 31 ++++++++++++++++++++++++++++---
 include/linux/fs.h |  1 +
 2 files changed, 29 insertions(+), 3 deletions(-)
block/fops.c +28 -3
index 2d01c90076813..bb3855ee044f0 100644
@@ -71,7 +71,7 @@ static ssize_t __blkdev_direct_IO_simple(struct kiocb *iocb,
 		bio_init(&bio, bdev, vecs, nr_pages, dio_bio_write_op(iocb));
 	}
 	bio.bi_iter.bi_sector = pos >> SECTOR_SHIFT;
-	bio.bi_write_hint = file_inode(iocb->ki_filp)->i_write_hint;
+	bio.bi_write_hint = iocb->ki_write_hint;
 	bio.bi_ioprio = iocb->ki_ioprio;
 	if (iocb->ki_flags & IOCB_ATOMIC)
 		bio.bi_opf |= REQ_ATOMIC;
@@ -200,7 +200,7 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
 
 	for (;;) {
 		bio->bi_iter.bi_sector = pos >> SECTOR_SHIFT;
-		bio->bi_write_hint = file_inode(iocb->ki_filp)->i_write_hint;
+		bio->bi_write_hint = iocb->ki_write_hint;
 		bio->bi_private = dio;
 		bio->bi_end_io = blkdev_bio_end_io;
 		bio->bi_ioprio = iocb->ki_ioprio;
@@ -316,7 +316,7 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb,
 	dio->flags = 0;
 	dio->iocb = iocb;
 	bio->bi_iter.bi_sector = pos >> SECTOR_SHIFT;
-	bio->bi_write_hint = file_inode(iocb->ki_filp)->i_write_hint;
+	bio->bi_write_hint = iocb->ki_write_hint;
 	bio->bi_end_io = blkdev_bio_end_io_async;
 	bio->bi_ioprio = iocb->ki_ioprio;
 
@@ -362,6 +362,23 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb,
 	return -EIOCBQUEUED;
 }
 
+static int blkdev_write_hint(struct kiocb *iocb, struct block_device *bdev)
+{
+	u16 hint = iocb->ki_write_hint;
+
+	if (!hint)
+		return file_inode(iocb->ki_filp)->i_write_hint;
+
+	if (hint > bdev_max_write_hints(bdev))
+		return -EINVAL;
+
+	if (bdev_is_partition(bdev) &&
+	    !test_bit(hint - 1, bdev->write_hint_mask))
+		return -EINVAL;
+
+	return hint;
+}
+
 static ssize_t blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 {
 	struct block_device *bdev = I_BDEV(iocb->ki_filp->f_mapping->host);
@@ -373,6 +390,14 @@ static ssize_t blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 	if (blkdev_dio_invalid(bdev, iocb, iter))
 		return -EINVAL;
 
+	if (iov_iter_rw(iter) == WRITE) {
+		int hint = blkdev_write_hint(iocb, bdev);
+
+		if (hint < 0)
+			return hint;
+		iocb->ki_write_hint = hint;
+	}
+
 	nr_pages = bio_iov_vecs_to_alloc(iter, BIO_MAX_VECS + 1);
 	if (likely(nr_pages <= BIO_MAX_VECS)) {
 		if (is_sync_kiocb(iocb))
include/linux/fs.h +1 -0
index 4b5cad44a1268..1a00accf412e5 100644
@@ -370,6 +370,7 @@ struct kiocb {
 	void			*private;
 	int			ki_flags;
 	u16			ki_ioprio; /* See linux/ioprio.h */
+	u16			ki_write_hint;
 	union {
 		/*
 		 * Only used for async buffered reads, where it denotes the
Signature · 1 line
2.43.5
#6 lore raw

PATCH v11 6/9 io_uring: enable per-io hinting capability

In reply to Keith Busch

From: Kanchan Joshi <[email protected]>

With F_SET_RW_HINT fcntl, user can set a hint on the file inode, and all the subsequent writes on the file pass that hint value down. This can be limiting for block device as all the writes will be tagged with only one lifetime hint value. Concurrent writes (with different hint values) are hard to manage. Per-IO hinting solves that problem.

Allow userspace to pass additional metadata in the SQE.

	__u16 write_hint;

If the hint is provided, filesystems may optionally use it. A filesytem may ignore this field if it does not support per-io hints, or if the value is invalid for its backing storage. Just like the inode hints, requesting values that are not supported by the hardware are not an error.

---
 include/uapi/linux/io_uring.h | 4 ++++
 io_uring/io_uring.c           | 2 ++
 io_uring/rw.c                 | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)
include/uapi/linux/io_uring.h +4 -0
index 56cf30b49ef5f..4a6c95c923eb4 100644
@@ -98,6 +98,10 @@ struct io_uring_sqe {
 			__u64	addr3;
 			__u64	__pad2[1];
 		};
+		struct {
+			__u64	__pad4[1];
+			__u16	write_hint;
+		};
 		__u64	optval;
 		/*
 		 * If the ring is initialized with IORING_SETUP_SQE128, then
io_uring/io_uring.c +2 -0
index 076171977d5e3..115af82b9151f 100644
@@ -4169,6 +4169,8 @@ static int __init io_uring_init(void)
 	BUILD_BUG_SQE_ELEM(46, __u16,  __pad3[0]);
 	BUILD_BUG_SQE_ELEM(48, __u64,  addr3);
 	BUILD_BUG_SQE_ELEM_SIZE(48, 0, cmd);
+	BUILD_BUG_SQE_ELEM(48, __u64,  __pad4);
+	BUILD_BUG_SQE_ELEM(56, __u16,  write_hint);
 	BUILD_BUG_SQE_ELEM(56, __u64,  __pad2);
 
 	BUILD_BUG_ON(sizeof(struct io_uring_files_update) !=
io_uring/rw.c +1 -1
index 93526a64ccd60..fdab23424f386 100644
@@ -279,7 +279,7 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
 		rw->kiocb.ki_ioprio = get_current_ioprio();
 	}
 	rw->kiocb.dio_complete = NULL;
-
+	rw->kiocb.ki_write_hint = READ_ONCE(sqe->write_hint);
 	rw->addr = READ_ONCE(sqe->addr);
 	rw->len = READ_ONCE(sqe->len);
 	rw->flags = READ_ONCE(sqe->rw_flags);
Signature · 1 line
2.43.5
#7 lore raw

PATCH v11 7/9 block: export placement hint feature

In reply to Keith Busch

From: Keith Busch <[email protected]>

Add a feature flag for devices that support generic placement hints in write commands. This is in contrast to data lifetime hints.

---
 block/blk-settings.c   | 2 ++
 block/blk-sysfs.c      | 3 +++
 include/linux/blkdev.h | 3 +++
 3 files changed, 8 insertions(+)
block/blk-settings.c +2 -0
index f9f831f104615..b809f31ad84f2 100644
@@ -518,6 +518,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
 		t->features &= ~BLK_FEAT_NOWAIT;
 	if (!(b->features & BLK_FEAT_POLL))
 		t->features &= ~BLK_FEAT_POLL;
+	if (!(b->features & BLK_FEAT_PLACEMENT_HINTS))
+		t->features &= ~BLK_FEAT_PLACEMENT_HINTS;
 
 	t->flags |= (b->flags & BLK_FLAG_MISALIGNED);
 
block/blk-sysfs.c +3 -0
index 1925ea23bd290..6280c5f89b8b7 100644
@@ -260,6 +260,7 @@ static ssize_t queue_##_name##_show(struct gendisk *disk, char *page)	\
 QUEUE_SYSFS_FEATURE_SHOW(poll, BLK_FEAT_POLL);
 QUEUE_SYSFS_FEATURE_SHOW(fua, BLK_FEAT_FUA);
 QUEUE_SYSFS_FEATURE_SHOW(dax, BLK_FEAT_DAX);
+QUEUE_SYSFS_FEATURE_SHOW(placement_hints, BLK_FEAT_PLACEMENT_HINTS);
 
 static ssize_t queue_zoned_show(struct gendisk *disk, char *page)
 {
@@ -497,6 +498,7 @@ QUEUE_RW_ENTRY(queue_poll_delay, "io_poll_delay");
 QUEUE_RW_ENTRY(queue_wc, "write_cache");
 QUEUE_RO_ENTRY(queue_fua, "fua");
 QUEUE_RO_ENTRY(queue_dax, "dax");
+QUEUE_RO_ENTRY(queue_placement_hints, "placement_hints");
 QUEUE_RW_ENTRY(queue_io_timeout, "io_timeout");
 QUEUE_RO_ENTRY(queue_virt_boundary_mask, "virt_boundary_mask");
 QUEUE_RO_ENTRY(queue_dma_alignment, "dma_alignment");
@@ -626,6 +628,7 @@ static struct attribute *queue_attrs[] = {
 	&queue_wc_entry.attr,
 	&queue_fua_entry.attr,
 	&queue_dax_entry.attr,
+	&queue_placement_hints_entry.attr,
 	&queue_poll_delay_entry.attr,
 	&queue_virt_boundary_mask_entry.attr,
 	&queue_dma_alignment_entry.attr,
include/linux/blkdev.h +3 -0
index 1477f751ad8bd..2ffe9a3b9dbff 100644
@@ -333,6 +333,9 @@ typedef unsigned int __bitwise blk_features_t;
 #define BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE \
 	((__force blk_features_t)(1u << 15))
 
+/* supports generic write placement hints */
+#define BLK_FEAT_PLACEMENT_HINTS	((__force blk_features_t)(1u << 16))
+
 /*
  * Flags automatically inherited when stacking limits.
  */
Signature · 1 line
2.43.5
#8 lore raw

PATCH v11 8/9 nvme: enable FDP support

In reply to Keith Busch

From: Kanchan Joshi <[email protected]>

Flexible Data Placement (FDP), as ratified in TP 4146a, allows the host to control the placement of logical blocks so as to reduce the SSD WAF. Userspace can send the write hint information using io_uring or fcntl.

Fetch the placement-identifiers if the device supports FDP. The incoming write-hint is mapped to a placement-identifier, which in turn is set in the DSPEC field of the write command.

---
 drivers/nvme/host/core.c      | 69 +++++++++++++++++++++++++++++++++++
 drivers/nvme/host/multipath.c |  3 +-
 drivers/nvme/host/nvme.h      |  5 +++
 include/linux/nvme.h          | 37 +++++++++++++++++++
 4 files changed, 113 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +69 -0
index b5b5d5dd6b517..356bf7ba4f4de 100644
@@ -668,6 +668,7 @@ static void nvme_free_ns_head(struct kref *ref)
 	ida_free(&head->subsys->ns_ida, head->instance);
 	cleanup_srcu_struct(&head->srcu);
 	nvme_put_subsystem(head->subsys);
+	kfree(head->plids);
 	kfree(head);
 }
 
@@ -985,6 +986,12 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
 	if (req->cmd_flags & REQ_RAHEAD)
 		dsmgmt |= NVME_RW_DSM_FREQ_PREFETCH;
 
+	if (req->write_hint && ns->head->nr_plids) {
+		u16 hint = max(req->write_hint, ns->head->nr_plids);
+		dsmgmt |= ns->head->plids[hint - 1] << 16;
+		control |= NVME_RW_DTYPE_DPLCMT;
+	}
+
 	if (req->cmd_flags & REQ_ATOMIC && !nvme_valid_atomic_write(req))
 		return BLK_STS_INVAL;
 
@@ -2133,6 +2140,52 @@ static int nvme_update_ns_info_generic(struct nvme_ns *ns,
 	return ret;
 }
 
+static int nvme_fetch_fdp_plids(struct nvme_ns *ns, u32 nsid)
+{
+	struct nvme_fdp_ruh_status_desc *ruhsd;
+	struct nvme_ns_head *head = ns->head;
+	struct nvme_fdp_ruh_status *ruhs;
+	struct nvme_command c = {};
+	int size, ret, i;
+
+	if (head->plids)
+		return 0;
+
+	size = struct_size(ruhs, ruhsd, NVME_MAX_PLIDS);
+	ruhs = kzalloc(size, GFP_KERNEL);
+	if (!ruhs)
+		return -ENOMEM;
+
+	c.imr.opcode = nvme_cmd_io_mgmt_recv;
+	c.imr.nsid = cpu_to_le32(nsid);
+	c.imr.mo = NVME_IO_MGMT_RECV_MO_RUHS;
+	c.imr.numd = cpu_to_le32(nvme_bytes_to_numd(size));
+
+	ret = nvme_submit_sync_cmd(ns->queue, &c, ruhs, size);
+	if (ret)
+		goto out;
+
+	ns->head->nr_plids = le16_to_cpu(ruhs->nruhsd);
+	if (!ns->head->nr_plids)
+		goto out;
+
+	ns->head->nr_plids = min(ns->head->nr_plids, NVME_MAX_PLIDS);
+	head->plids = kcalloc(ns->head->nr_plids, sizeof(head->plids),
+			      GFP_KERNEL);
+	if (!head->plids) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	for (i = 0; i < ns->head->nr_plids; i++) {
+		ruhsd = &ruhs->ruhsd[i];
+		head->plids[i] = le16_to_cpu(ruhsd->pid);
+	}
+out:
+	kfree(ruhs);
+	return ret;
+}
+
 static int nvme_update_ns_info_block(struct nvme_ns *ns,
 		struct nvme_ns_info *info)
 {
@@ -2169,6 +2222,19 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
 			goto out;
 	}
 
+	if (ns->ctrl->ctratt & NVME_CTRL_ATTR_FDPS) {
+		ret = nvme_fetch_fdp_plids(ns, info->nsid);
+		if (ret)
+			dev_warn(ns->ctrl->device,
+				"FDP failure status:0x%x\n", ret);
+		if (ret < 0)
+			goto out;
+	} else {
+		ns->head->nr_plids = 0;
+		kfree(ns->head->plids);
+		ns->head->plids = NULL;
+	}
+
 	blk_mq_freeze_queue(ns->disk->queue);
 	ns->head->lba_shift = id->lbaf[lbaf].ds;
 	ns->head->nuse = le64_to_cpu(id->nuse);
@@ -2199,6 +2265,9 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
 	if (!nvme_init_integrity(ns->head, &lim, info))
 		capacity = 0;
 
+	lim.max_write_hints = ns->head->nr_plids;
+	if (lim.max_write_hints)
+		lim.features |= BLK_FEAT_PLACEMENT_HINTS;
 	ret = queue_limits_commit_update(ns->disk->queue, &lim);
 	if (ret) {
 		blk_mq_unfreeze_queue(ns->disk->queue);
drivers/nvme/host/multipath.c +2 -1
index 6a15873055b95..1b9d9d6c18e0b 100644
@@ -632,7 +632,8 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
 
 	blk_set_stacking_limits(&lim);
 	lim.dma_alignment = 3;
-	lim.features |= BLK_FEAT_IO_STAT | BLK_FEAT_NOWAIT | BLK_FEAT_POLL;
+	lim.features |= BLK_FEAT_IO_STAT | BLK_FEAT_NOWAIT | BLK_FEAT_POLL |
+			BLK_FEAT_PLACEMENT_HINTS;
 	if (head->ids.csi == NVME_CSI_ZNS)
 		lim.features |= BLK_FEAT_ZONED;
 	else
drivers/nvme/host/nvme.h +5 -0
index 093cb423f536b..a2a97fd3fde16 100644
@@ -454,6 +454,8 @@ struct nvme_ns_ids {
 	u8	csi;
 };
 
+#define NVME_MAX_PLIDS   (NVME_CTRL_PAGE_SIZE / sizeof(u16))
+
 /*
  * Anchor structure for namespaces.  There is one for each namespace in a
  * NVMe subsystem that any of our controllers can see, and the namespace
@@ -490,6 +492,9 @@ struct nvme_ns_head {
 	struct device		cdev_device;
 
 	struct gendisk		*disk;
+
+	u16                     nr_plids;
+	u16			*plids;
 #ifdef CONFIG_NVME_MULTIPATH
 	struct bio_list		requeue_list;
 	spinlock_t		requeue_lock;
include/linux/nvme.h +37 -0
index b58d9405d65e0..8930f643bdc11 100644
@@ -275,6 +275,7 @@ enum nvme_ctrl_attr {
 	NVME_CTRL_ATTR_HID_128_BIT	= (1 << 0),
 	NVME_CTRL_ATTR_TBKAS		= (1 << 6),
 	NVME_CTRL_ATTR_ELBAS		= (1 << 15),
+	NVME_CTRL_ATTR_FDPS		= (1 << 19),
 };
 
 struct nvme_id_ctrl {
@@ -843,6 +844,7 @@ enum nvme_opcode {
 	nvme_cmd_resv_register	= 0x0d,
 	nvme_cmd_resv_report	= 0x0e,
 	nvme_cmd_resv_acquire	= 0x11,
+	nvme_cmd_io_mgmt_recv	= 0x12,
 	nvme_cmd_resv_release	= 0x15,
 	nvme_cmd_zone_mgmt_send	= 0x79,
 	nvme_cmd_zone_mgmt_recv	= 0x7a,
@@ -864,6 +866,7 @@ enum nvme_opcode {
 		nvme_opcode_name(nvme_cmd_resv_register),	\
 		nvme_opcode_name(nvme_cmd_resv_report),		\
 		nvme_opcode_name(nvme_cmd_resv_acquire),	\
+		nvme_opcode_name(nvme_cmd_io_mgmt_recv),	\
 		nvme_opcode_name(nvme_cmd_resv_release),	\
 		nvme_opcode_name(nvme_cmd_zone_mgmt_send),	\
 		nvme_opcode_name(nvme_cmd_zone_mgmt_recv),	\
@@ -1015,6 +1018,7 @@ enum {
 	NVME_RW_PRINFO_PRCHK_GUARD	= 1 << 12,
 	NVME_RW_PRINFO_PRACT		= 1 << 13,
 	NVME_RW_DTYPE_STREAMS		= 1 << 4,
+	NVME_RW_DTYPE_DPLCMT		= 2 << 4,
 	NVME_WZ_DEAC			= 1 << 9,
 };
 
@@ -1102,6 +1106,38 @@ struct nvme_zone_mgmt_recv_cmd {
 	__le32			cdw14[2];
 };
 
+struct nvme_io_mgmt_recv_cmd {
+	__u8			opcode;
+	__u8			flags;
+	__u16			command_id;
+	__le32			nsid;
+	__le64			rsvd2[2];
+	union nvme_data_ptr	dptr;
+	__u8			mo;
+	__u8			rsvd11;
+	__u16			mos;
+	__le32			numd;
+	__le32			cdw12[4];
+};
+
+enum {
+	NVME_IO_MGMT_RECV_MO_RUHS	= 1,
+};
+
+struct nvme_fdp_ruh_status_desc {
+	u16 pid;
+	u16 ruhid;
+	u32 earutr;
+	u64 ruamw;
+	u8  rsvd16[16];
+};
+
+struct nvme_fdp_ruh_status {
+	u8  rsvd0[14];
+	__le16 nruhsd;
+	struct nvme_fdp_ruh_status_desc ruhsd[];
+};
+
 enum {
 	NVME_ZRA_ZONE_REPORT		= 0,
 	NVME_ZRASF_ZONE_REPORT_ALL	= 0,
@@ -1822,6 +1858,7 @@ struct nvme_command {
 		struct nvmf_auth_receive_command auth_receive;
 		struct nvme_dbbuf dbbuf;
 		struct nvme_directive_cmd directive;
+		struct nvme_io_mgmt_recv_cmd imr;
 	};
 };
 
Signature · 1 line
2.43.5
#9 lore raw

PATCH v11 9/9 scsi: set permanent stream count in block limits

In reply to Keith Busch

From: Keith Busch <[email protected]>

The block limits exports the number of write hints, so set this limit if the device reports support for the lifetime hints. Not only does this inform the user of which hints are possible, it also allows scsi devices supporting the feature to utilize the full range through raw block device direct-io.

---
 drivers/scsi/sd.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/sd.c +2 -0
index ca4bc0ac76adc..235dd6e5b6688 100644
@@ -3768,6 +3768,8 @@ static int sd_revalidate_disk(struct gendisk *disk)
 		sd_config_protection(sdkp, &lim);
 	}
 
+	lim.max_write_hints = sdkp->permanent_stream_count;
+
 	/*
 	 * We now have all cache related info, determine how we deal
 	 * with flush requests.
Signature · 1 line
2.43.5
#10 lore raw
In reply to Keith Busch
Quoted 2 lines · Keith Busch

Default partition split so partition one gets all the write hints exclusively

I still don't think this actually works as expected, as the user interface says the write streams are contigous, and with the bitmap they aren't.

As I seem to have a really hard time to get my point across, I instead spent this morning doing a POC of what I mean, and pushed it here:

http://git.infradead.org/?p=users/hch/misc.git;a=shortlog;h=refs/heads/block-write-streams

The big differences are:

- there is a separate write_stream value now instead of overloading the write hint. For now it is an 8-bit field for the internal data structures so that we don't have to grow the bio, but all the user interfaces are kept at 16 bits (or in case of statx reduced to it). If this becomes now enough because we need to support devices with multiple reclaim groups we'll have to find some space by using unions or growing structures
- block/fops.c is the place to map the existing write hints into the write streams instead of the driver
- the stream granularity is added, because adding it to statx at a later time would be nasty. Getting it in nvme is actually amazingly cumbersome so I gave up on that and just fed a dummy value for testing, though
- the partitions remapping is now done using an offset into the global write stream space so that the there is a contiguous number space. The interface for this is rather hacky, so only treat it as a start for interface and use case discussions.
- the generic stack limits code stopped stacking the max write streams. While it does the right thing for simple things like multipath and mirroring/striping is is wrong for anything non-trivial like parity raid. I've left this as a separate fold patch for the discussion.

maintainer
#11 lore raw
Quoted 4 lines · Christoph Hellwig
Quoted 2 lines · Keith Busch

Default partition split so partition one gets all the write hints exclusively

Quoted 8 lines

I still don't think this actually works as expected, as the user interface says the write streams are contigous, and with the bitmap they aren't.

As I seem to have a really hard time to get my point across, I instead spent this morning doing a POC of what I mean, and pushed it here:

http://git.infradead.org/?p=users/hch/misc.git;a=shortlog;h=refs/heads/block-write-streams

Just purely for backward compatibility, I don't think you can have the nvme driver error out if a stream is too large. The fcntl lifetime hint never errored out before, which gets set unconditionally from the file_inode without considering the block device's max write stream.

Quoted 9 lines

The big differences are:

- there is a separate write_stream value now instead of overloading the write hint. For now it is an 8-bit field for the internal data structures so that we don't have to grow the bio, but all the user interfaces are kept at 16 bits (or in case of statx reduced to it). If this becomes now enough because we need to support devices with multiple reclaim groups we'll have to find some space by using unions or growing structures

As far as I know, 255 possible streams exceeds any use case I know about.

Quoted 2 lines

- block/fops.c is the place to map the existing write hints into the write streams instead of the driver

I might be something here, but that part sure looks the same as what's in this series.

Quoted 4 lines

- the stream granularity is added, because adding it to statx at a later time would be nasty. Getting it in nvme is actually amazingly cumbersome so I gave up on that and just fed a dummy value for testing, though

Just regarding the documentation on the write_stream_granularity, you don't need to discard the entire RU in a single command. You can invalidate the RU simply by overwriting the LBAs without ever issuing any discard commands.

If you really want to treat it this way, you need to ensure the first LBA written to an RU is always aligned to NPDA/NPDAL.

If this is really what you require to move this forward, though, that's fine with me.

Quoted 9 lines

- the partitions remapping is now done using an offset into the global write stream space so that the there is a contiguous number space. The interface for this is rather hacky, so only treat it as a start for interface and use case discussions.
- the generic stack limits code stopped stacking the max write streams. While it does the right thing for simple things like multipath and mirroring/striping is is wrong for anything non-trivial like parity raid. I've left this as a separate fold patch for the discussion.

#12 lore raw
Quoted 4 lines · Keith Busch

Just purely for backward compatibility, I don't think you can have the nvme driver error out if a stream is too large. The fcntl lifetime hint never errored out before, which gets set unconditionally from the file_inode without considering the block device's max write stream.

True. But block/fops.c should simply not the write hint in that case (or even do a bit of folding if we care enough).

Quoted 5 lines
Quoted 2 lines

- block/fops.c is the place to map the existing write hints into the write streams instead of the driver

I might be something here, but that part sure looks the same as what's in this series.

Your series simply mixes up the existing write (temperature) hint and the write stream, including for file system use. This version does something very similar, but only for block devices.

Quoted 10 lines
Quoted 5 lines

- the stream granularity is added, because adding it to statx at a later time would be nasty. Getting it in nvme is actually amazingly cumbersome so I gave up on that and just fed a dummy value for testing, though

Just regarding the documentation on the write_stream_granularity, you don't need to discard the entire RU in a single command. You can invalidate the RU simply by overwriting the LBAs without ever issuing any discard commands.

True. Did I managed this was a quick hack job?

Quoted 2 lines

If you really want to treat it this way, you need to ensure the first LBA written to an RU is always aligned to NPDA/NPDAL.

Those are just hints as well, but I agree you probably get much better results if they do.

Quoted 2 lines

If this is really what you require to move this forward, though, that's fine with me.

I could move it forward, but right now I'm more than over subsribed. If someone actually pushing for this work could put more effort into it it will surely be faster.

#13 lore raw
In reply to Christoph Hellwig
Quoted 10 lines · Christoph Hellwig

- there is a separate write_stream value now instead of overloading the write hint. For now it is an 8-bit field for the internal data structures so that we don't have to grow the bio, but all the user interfaces are kept at 16 bits (or in case of statx reduced to it). If this becomes now enough because we need to support devices with multiple reclaim groups we'll have to find some space by using unions or growing structures

- block/fops.c is the place to map the existing write hints into the write streams instead of the driver

Last time when I attempted this separation between temperature and placement hints, it required adding a new fcntl[*] too because per-inode/file hints continues to be useful even when they are treated as passthrough by FS.

Applications are able to use temperature hints to group multiple files on device regardless of the logical placement made by FS. The same ability is useful for write-streams/placement-hints too. But these patches reduce the scope to only block device.

IMO, passthrough propagation of hints/streams should continue to remain the default behavior as it applies on multiple filesystems. And more active placement by FS should rather be enabled by some opt in (e.g., mount option). Such opt in will anyway be needed for other reasons (like regression avoidance on a broken device).

[*]
https://lore.kernel.org/linux-nvme/[email protected]/

#14 lore raw
Quoted 5 lines · Kanchan Joshi

IMO, passthrough propagation of hints/streams should continue to remain the default behavior as it applies on multiple filesystems. And more active placement by FS should rather be enabled by some opt in (e.g., mount option). Such opt in will anyway be needed for other reasons (like regression avoidance on a broken device).

I feel like banging my head against the wall. No, passing through write streams is simply not acceptable without the file system being in control. I've said and explained this in detail about a dozend times and the file system actually needing to do data separation for it's own purpose doesn't go away by ignoring it.

maintainer
#15 lore raw
Quoted 7 lines · Christoph Hellwig
Quoted 5 lines · Kanchan Joshi

IMO, passthrough propagation of hints/streams should continue to remain the default behavior as it applies on multiple filesystems. And more active placement by FS should rather be enabled by some opt in (e.g., mount option). Such opt in will anyway be needed for other reasons (like regression avoidance on a broken device).

Quoted 5 lines

I feel like banging my head against the wall. No, passing through write streams is simply not acceptable without the file system being in control. I've said and explained this in detail about a dozend times and the file system actually needing to do data separation for it's own purpose doesn't go away by ignoring it.

But that's just an ideological decision that doesn't jive with how people use these. The applications know how they use their data better than the filesystem, so putting the filesystem in the way to force streams look like zones is just a unnecessary layer of indirection getting in the way.

#16 lore raw
Quoted 8 lines · Keith Busch
Quoted 5 lines

I feel like banging my head against the wall. No, passing through write streams is simply not acceptable without the file system being in control. I've said and explained this in detail about a dozend times and the file system actually needing to do data separation for it's own purpose doesn't go away by ignoring it.

But that's just an ideological decision that doesn't jive with how people use these.

Sorry, but no it is not. The file system is the entity that owns the block device, and it is the layer that manages the block device. Bypassing it is an layering violation that creates a lot of problems and solves none at all.

Quoted 2 lines

The applications know how they use their data better than the filesystem,

That is a very bold assumption, and a clear indication that you are actually approaching this with a rather idiological hat. If your specific application actually thinks it knows the storage better than the file system that you are using you probably should not be using that file system. Use a raw block device or even better passthrough or spdk if you really know what you are doing (or at least thing so).

Otherwise you need to agree that the file system is the final arbiter of the underlying device resource. Hint: if you have an application that knows that it is doing (there actually are a few of those) it's usually not hard to actually work with file system people to create abstractions that don't poke holes into layering but still give the applications what you want. There's also the third option of doing something like what Damien did with zonefs and actually create an abstraction for what what your are doing.

Quoted 3 lines

so putting the filesystem in the way to force
streams look like zones is just a unnecessary layer of indirection getting in the way.

Can you please stop this BS? Even if a file system doesn't treat write streams like zones keeps LBA space and physical allocation units entirely separate (for which I see no good reason, but others might disagree) you still need the file system in control of the hardware resources.

#17 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 3 lines

so putting the filesystem in the way to force
streams look like zones is just a unnecessary layer of indirection getting in the way.

Can you please stop this BS? Even if a file system doesn't treat write streams like zones keeps LBA space and physical allocation units entirely separate (for which I see no good reason, but others might disagree) you still need the file system in control of the hardware resources.

And in case this wasn't clear enough. Let's assume you want to write a low write amp flash optimized file system similar to say the storage layers of the all flash arrays of the last 10-15 years.

You really want to avoid device GC. You'd better group your data to the reclaim unit / erase block / insert name here. So you need file system control of the write streams, you need to know their size, you need to be able to query how much your wrote after a power faіl. Totally independent of how you organize your LBA space. Mapping it linearly might be the easier options without major downside, but you could also allocate them randomly for that matter.

Quoted 1 line

---end quoted text---

#18 lore raw
In reply to Keith Busch

My 2 cents.

Overall, it seems to me that the difficulty here comes from 2 things:
1) The write hints may have different semantics (temperature, FDP placement, and whatever will come next).
2) Different software layers may want to use the hints, and if several do that at the same time on the same storage that may result in a mess.

About 1)
Seems to me that having a different interface for each semantic is an overkill, extra code to maintain. And extra work when a new semantic comes along. To keep things simple, keep one set of interfaces (per IO interface, per file interface) for all write hints semantics, and carry the difference in semantic in the hint itself. For example, with 32 bits hints, store the semantic in 8 bits and the use the rest in the context of that semantic.
The storage transport driver (nvme driver for ex), based on the 8 bits semantic in the write hint, translates adequately the write hint for the storage device. The storage driver can support several translations, one for each semantics supported. Linux doesn't need to yank out a translation to replace it with a another/new one.

About 2)
Provide a simple way to the user to decide which layer generate write hints.
As an example, as some of you pointed out, what if the filesystem wants to generate write hints to optimize its [own] data handling by the storage, and at the same time the application using the FS understand the storage and also wants to optimize using write hints. Both use cases are legit, I think.
To handle that in a simple way, why not have a filesystem mount parameter enabling/disabling the use of write hints by the FS?
In the case of an application not needing/wanting to use write hints on its own, the user would mount the filesystem enabling generation of write hints. That could be the default.
On the contrary if the user decides it is best for one application to directly generate write hints to get the best performance, then mount the filesystem disabling the generation of write hints by the FS. The FS act as a passthrough regarding write hints.

Regards,

Pierre

Quoted 34 lines

-----Original Message-----
From: Keith Busch <[email protected]>
Sent: Tuesday, November 12, 2024 6:26 AM
To: Christoph Hellwig <[email protected]>
Cc: Kanchan Joshi <[email protected]>; Keith Busch <[email protected]>; [email protected]; linux- [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [EXT] Re: [PATCHv11 0/9] write hints with nvme fdp and scsi streams

CAUTION: EXTERNAL EMAIL. Do not click links or open attachments unless you recognize the sender and were expecting this message.

Quoted 7 lines · Christoph Hellwig
Quoted 5 lines · Kanchan Joshi

IMO, passthrough propagation of hints/streams should continue to remain the default behavior as it applies on multiple filesystems. And more active placement by FS should rather be enabled by some opt in (e.g., mount option). Such opt in will anyway be needed for other reasons (like regression avoidance on a broken device).

Quoted 5 lines

I feel like banging my head against the wall. No, passing through write streams is simply not acceptable without the file system being in control. I've said and explained this in detail about a dozend times and the file system actually needing to do data separation for it's own purpose doesn't go away by ignoring it.

But that's just an ideological decision that doesn't jive with how people use these. The applications know how they use their data better than the filesystem, so putting the filesystem in the way to force streams look like zones is just a unnecessary layer of indirection getting in the way.

#19 lore raw
Quoted 2 lines · Pierre Labat

Overall, it seems to me that the difficulty here comes from 2 things:
1) The write hints may have different semantics (temperature, FDP placement, and whatever will come next).

Or rather trying to claim all these are "write hints" is simply the wrong approach :)

Quoted 1 line

2) Different software layers may want to use the hints, and if several do that at the same time on the same storage that may result in a mess.

That's a very nice but almost to harmless way to phrase it.

Quoted 4 lines

About 1)
Seems to me that having a different interface for each semantic is an overkill, extra code to maintain. And extra work when a new semantic comes along. To keep things simple, keep one set of interfaces (per IO interface, per file interface) for all write hints semantics, and carry the difference in semantic in the hint itself. For example, with 32 bits hints, store the semantic in 8 bits and the use the rest in the context of that semantic.

This is very similar to what the never followed up upon Kanchan did.

I think this is a lot better than blindly overloading a generic "write hint", but still suffers from problems:

a) the code is a lot more complex and harder to maintain than just two different values
b) it still keeps the idea that a simple temperature hint and write stream or placement identifiers are someting comparable, which they really aren't.

Quoted 5 lines

About 2)
Provide a simple way to the user to decide which layer generate write hints.
As an example, as some of you pointed out, what if the filesystem wants to generate write hints to optimize its [own] data handling by the storage, and at the same time the application using the FS understand the storage and also wants to optimize using write hints. Both use cases are legit, I think.
To handle that in a simple way, why not have a filesystem mount parameter enabling/disabling the use of write hints by the FS?

The file system is, and always has been, the entity in charge of resource allocation of the underlying device. Bypassing it will get you in trouble, and a simple mount option isn't really changing that (it's also not exactly a scalable interface).

If an application wants to micro-manage placement decisions it should not use a file system, or at least not a normal one with Posix semantics. That being said we'd demonstrated that applications using proper grouping of data by file and the simple temperature hints can get very good result from file systems that can interpret them, without a lot of work in the file system. I suspect for most applications that actually want files that is actually going to give better results than trying to do the micro-management that tries to bypass the file system.

I'm not sure if Keith was just ranting last night, but IFF the assumption here is that file systems are just used as dumb containers and applications manage device level placement inside them we have a much deeper problem than just interface semantics.

#20 lore raw
Quoted 12 lines · Christoph Hellwig
Quoted 5 lines · Pierre Labat

About 2)
Provide a simple way to the user to decide which layer generate write hints.
As an example, as some of you pointed out, what if the filesystem wants to generate write hints to optimize its [own] data handling by the storage, and at the same time the application using the FS understand the storage and also wants to optimize using write hints. Both use cases are legit, I think.
To handle that in a simple way, why not have a filesystem mount parameter enabling/disabling the use of write hints by the FS?

The file system is, and always has been, the entity in charge of resource allocation of the underlying device. Bypassing it will get you in trouble, and a simple mount option isn't really changing that (it's also not exactly a scalable interface).

Quoted 8 lines

If an application wants to micro-manage placement decisions it should not use a file system, or at least not a normal one with Posix semantics. That being said we'd demonstrated that applications using proper grouping of data by file and the simple temperature hints can get very good result from file systems that can interpret them, without a lot of work in the file system. I suspect for most applications that actually want files that is actually going to give better results than trying to do the micro-management that tries to bypass the file system.

This.

The most important thing that filesystems do behind the scenes is manage -data locality-. XFS has thousands of lines of code to manage and control data locality - the allocation policy API itself has a *dozens* control parameters. We have 2 separate allocation architectures (one btree based, one bitmap based) and multiple locality policy algorithms. These juggled physical alignment, size granularity, size limits, data type being allocated for, desired locality targets, different search algorithms (e.g. first fit, best fit, exact fit by size or location, etc), multiple fallback strategies when the initial target cannot be met, etc.

Allocation policy management is the core of every block based filesystem that has ever been written.

Specifically to this "stream hint" discussion: go look at the XFS filestreams allocator.

SGI wrote an entirely new allocator for XFS whose only purpose in life is to automatically separate individual streams of user data into physically separate regions of LBA space.

This was written to optimise realtime ingest and playback of multiple uncompressed 4k and 8k video data streams from big isochronous SAN storage arrays back in ~2005. Each stream could be up to 1.2GB/s of data. If the data for each IO was not exactly placed in alignment with the storage array stripe cache granularity (2MB, IIRC), then a cache miss would occur and the IO latency would be too high and frames of data would be missed/dropped.

IOWs, we have an allocator in XFS that specifically designed to separate indepedent streams of data to independent regions of the filesystem LBA space to effcient support data IO rates in the order of tens of GB/s.

What are we talking about now? Storage hardware that might be able to do 10-15GB/s of IO that needs stream separation for efficient management of the internal storage resources.

The fact we have previously solved this class of stream separation problem at the filesystem level *without needing a user-controlled API at all* is probably the most relevant fact missing from this discussion.

As to the concern about stream/temp/hint translation consistency across different hardware: the filesystem is the perfect place to provide this abstraction to users. The block device can expose what it supports, the user API can be fixed, and the filesystem can provide the mapping between the two that won't change for the life of the filesystem...

Long story short: Christoph is right.

The OS hints/streams API needs to be aligned to the capabilities that filesystems already provide *as a primary design goal*. What the new hardware might support is a secondary concern. i.e. hardware driven software design is almost always a mistake: define the user API and abstractions first, then the OS can reduce it sanely down to what the specific hardware present is capable of supporting.

-Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#21 lore raw

Dave,

Quoted 6 lines

The OS hints/streams API needs to be aligned to the capabilities that filesystems already provide *as a primary design goal*. What the new hardware might support is a secondary concern. i.e. hardware driven software design is almost always a mistake: define the user API and abstractions first, then the OS can reduce it sanely down to what the specific hardware present is capable of supporting.

I agree completely.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#22 lore raw
In reply to Dave Chinner
Quoted 2 lines · Dave Chinner

Specifically to this "stream hint" discussion: go look at the XFS filestreams allocator.

Those are rally two different things - file streams is about how to locate data into a single hardware write streams. SCSI/NVMe streams including streams 2.0 (FDP) that this thread is about is about telling the hardware about these streams, and also about allowing the file systems (or other user of the storage) to pack into the actual underlying hardware boundaries that matter for deleting/overwriting this data.

Funnily enough Hans and I were just recently brainstorming on how to tie both together for the zoned xfs work.

Quoted 3 lines

SGI wrote an entirely new allocator for XFS whose only purpose in life is to automatically separate individual streams of user data into physically separate regions of LBA space.

One of the interesting quirks of streams/FDP is that they they operate on (semi-)physical data placement that is completely decoupled from LBA space. So if a file system or application really wants to track LBA vs physical allocations separately it gives them a way to do that. I don't really know what the advantage of having to track both is, but people smarted than me might have good uses for it.

maintainer
#23 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 3 lines · Dave Chinner

SGI wrote an entirely new allocator for XFS whose only purpose in life is to automatically separate individual streams of user data into physically separate regions of LBA space.

One of the interesting quirks of streams/FDP is that they they operate on (semi-)physical data placement that is completely decoupled from LBA space.

That's not particularly interesting about FDP. All conventional NAND SSDs operates that way. FDP just reports more stuff because that's what people kept asking for. But it doesn't require you fundamentally change how you acces it. You've singled out FDP to force a sequential write requirement that that requires unique support from every filesystem despite the feature not needing that.

We have demonstrated 40% reduction in write amplifcation from doing the most simplist possible thing that doesn't require any filesystem or kernel-user ABI changes at all. You might think that's not significant enough to let people realize those gains without more invasive block stack changes, but you may not buying NAND in bulk if that's the case.

#24 lore raw
Quoted 5 lines · Keith Busch

SSDs operates that way. FDP just reports more stuff because that's what people kept asking for. But it doesn't require you fundamentally change how you acces it. You've singled out FDP to force a sequential write requirement that that requires unique support from every filesystem despite the feature not needing that.

No I haven't. If you think so you are fundamentally misunderstanding what I'm saying.

Quoted 5 lines

We have demonstrated 40% reduction in write amplifcation from doing the most simplist possible thing that doesn't require any filesystem or kernel-user ABI changes at all. You might think that's not significant enough to let people realize those gains without more invasive block stack changes, but you may not buying NAND in bulk if that's the case.

And as iterared multiple times you are doing that by bypassing the file system layer in a forceful way that breaks all abstractions and makes your feature unavailabe for file systems.

I've also thrown your a nugget by first explaining and then even writing protype code to show how you get what you want while using the proper abstractions. But instead of a picking up on that you just whine like this. Either spend a little bit of effort to actually get the interface right or just shut up.

maintainer
#25 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 5 lines · Keith Busch

SSDs operates that way. FDP just reports more stuff because that's what people kept asking for. But it doesn't require you fundamentally change how you acces it. You've singled out FDP to force a sequential write requirement that that requires unique support from every filesystem despite the feature not needing that.

No I haven't. If you think so you are fundamentally misunderstanding what I'm saying.

We have an API that has existed for 10+ years. You are gatekeeping that interface by declaring NVMe's FDP is not allowed to use it. Do I have that wrong? You initially blocked this because you didn't like how the spec committe worked. Now you've shifted to trying to pretend FDP devices require explicit filesystem handholding that was explicely NOT part of that protocol.

Quoted 9 lines
Quoted 5 lines

We have demonstrated 40% reduction in write amplifcation from doing the most simplist possible thing that doesn't require any filesystem or kernel-user ABI changes at all. You might think that's not significant enough to let people realize those gains without more invasive block stack changes, but you may not buying NAND in bulk if that's the case.

And as iterared multiple times you are doing that by bypassing the file system layer in a forceful way that breaks all abstractions and makes your feature unavailabe for file systems.

Your filesystem layering breaks the abstraction and capabilities the drives are providing. You're doing more harm than good trying to game how the media works here.

Quoted 3 lines

I've also thrown your a nugget by first explaining and then even writing protype code to show how you get what you want while using the proper abstractions.

Oh, the untested prototype that wasn't posted to any mailing list for a serious review? The one that forces FDP to subscribe to the zoned interface only for XFS, despite these devices being squarly in the "conventional" SSD catagory and absolutely NOT zone devices? Despite I have other users using other filesystems successfuly using the existing interfaces that your prototype doesn't do a thing for? Yah, thanks...

I appreciate you put the time into getting your thoughts into actual code and it does look very valuable for ACTUAL ZONE block devices. But it seems to have missed the entire point of what this hardware feature does. If you're doing low level media garbage collection with FDP and tracking fake media write pointers, then you're doing it wrong. Please use Open Channel and ZNS SSDs if you want that interface and stop gatekeeping the EXISTING interface that has proven value in production software today.

Quoted 3 lines

But instead of a picking up on that you just whine like this. Either spend a little bit of effort to actually get the interface right or just shut up.

Why the fuck should I make an effort to do improve your pet project that I don't have a customer for? They want to use the interface that was created 10 years ago, exactly for the reason it was created, and no one wants to introduce the risks of an untested and unproven major and invasive filesystem and block stack change in the kernel in the near term!

#26 lore raw
Quoted 6 lines · Keith Busch

We have an API that has existed for 10+ years. You are gatekeeping that interface by declaring NVMe's FDP is not allowed to use it. Do I have that wrong? You initially blocked this because you didn't like how the spec committe worked. Now you've shifted to trying to pretend FDP devices require explicit filesystem handholding that was explicely NOT part of that protocol.

I'm not fucking gate keeping anything, I'm really tired of this claim with absolutely no facts backing it up.

Quoted 7 lines
Quoted 3 lines

And as iterared multiple times you are doing that by bypassing the file system layer in a forceful way that breaks all abstractions and makes your feature unavailabe for file systems.

Your filesystem layering breaks the abstraction and capabilities the drives are providing. You're doing more harm than good trying to game how the media works here.

How so?

Quoted 10 lines
Quoted 3 lines

I've also thrown your a nugget by first explaining and then even writing protype code to show how you get what you want while using the proper abstractions.

Oh, the untested prototype that wasn't posted to any mailing list for a serious review? The one that forces FDP to subscribe to the zoned interface only for XFS, despite these devices being squarly in the "conventional" SSD catagory and absolutely NOT zone devices? Despite I have other users using other filesystems successfuly using the existing interfaces that your prototype doesn't do a thing for? Yah, thanks...

What zoned interface to FDP?

The exposed interface is to:

a) pick a write stream
b) expose the size of the reclaim unit

not done yet, but needed for good operation:

c) expose how much capacity in a reclaim unit has been written

This is about as good as it gets to map the FDP (and to a lesser extent streams) interface to an abstract block layer API. If you have a better suggestion to actually expose these capabilities I'm all ears.

Now _my_ preferred use of that interface is a write out of place, map LBA regions to physical reclaim blocks file system. On the hand hand because it actually fits the file system I'm writing, on the other hand because industry experience has shown that this is a very good fit to flash storage (even without any explicit placement). If you think that's all wrong that fine, despite claims to the contrary from you absolutely nothing in the interface forced you to do that.

You can roll the dice for your LBA allocations and write them using a secure random number generator. The interface allows for all of that, but I doubt your results will all that great. Not my business.

Quoted 8 lines

I appreciate you put the time into getting your thoughts into actual code and it does look very valuable for ACTUAL ZONE block devices. But it seems to have missed the entire point of what this hardware feature does. If you're doing low level media garbage collection with FDP and tracking fake media write pointers, then you're doing it wrong. Please use Open Channel and ZNS SSDs if you want that interface and stop gatekeeping the EXISTING interface that has proven value in production software today.

Hey, feel free to come up with a better design. The whole point of a proper block layer design is that you actually can do that!

Quoted 10 lines
Quoted 3 lines

But instead of a picking up on that you just whine like this. Either spend a little bit of effort to actually get the interface right or just shut up.

Why the fuck should I make an effort to do improve your pet project that I don't have a customer for? They want to use the interface that was created 10 years ago, exactly for the reason it was created, and no one wants to introduce the risks of an untested and unproven major and invasive filesystem and block stack change in the kernel in the near term!

Because you apparently want an interface to FDP in the block layer. And if you want that you need to stop bypassing the file systems as pointed out not just by me but also at least one other file system maintainer and the maintainer of the most used block subsystem. I've thrown you some bones how that can be done while doing everything else you did before (at least assuming you get the fs side past the fs maintainers), but the only thanks for that is bullshit attacks at a personal level.

#27 lore raw
Quoted 32 lines · Christoph Hellwig
Quoted 6 lines · Keith Busch

We have an API that has existed for 10+ years. You are gatekeeping that interface by declaring NVMe's FDP is not allowed to use it. Do I have that wrong? You initially blocked this because you didn't like how the spec committe worked. Now you've shifted to trying to pretend FDP devices require explicit filesystem handholding that was explicely NOT part of that protocol.

I'm not fucking gate keeping anything, I'm really tired of this claim with absolutely no facts backing it up.

Quoted 7 lines
Quoted 3 lines

And as iterared multiple times you are doing that by bypassing the file system layer in a forceful way that breaks all abstractions and makes your feature unavailabe for file systems.

Your filesystem layering breaks the abstraction and capabilities the drives are providing. You're doing more harm than good trying to game how the media works here.

How so?

Quoted 10 lines
Quoted 3 lines

I've also thrown your a nugget by first explaining and then even writing protype code to show how you get what you want while using the proper abstractions.

Oh, the untested prototype that wasn't posted to any mailing list for a serious review? The one that forces FDP to subscribe to the zoned interface only for XFS, despite these devices being squarly in the "conventional" SSD catagory and absolutely NOT zone devices? Despite I have other users using other filesystems successfuly using the existing interfaces that your prototype doesn't do a thing for? Yah, thanks...

Quoted 5 lines

What zoned interface to FDP?

The exposed interface is to:

a) pick a write stream

How do filesystem users pick a write stream? I get a pretty strong sense that you're aiming to provide the ability for application software to group together a bunch of (potentially arbitrary) files in a cohort. Then (maybe?) you can say "This cohort of files are all expected to have data blocks related to each other in some fashion, so put them together so that the storage doesn't have to work so hard".

Part of my comprehension problem here (and probably why few fs people commented on this thread) is that I have no idea what FDP is, or what the write lifetime hints in scsi were/are, or what the current "hinting" scheme is.

Is this what we're arguing about?

enum rw_hint {
WRITE_LIFE_NOT_SET = RWH_WRITE_LIFE_NOT_SET,
WRITE_LIFE_NONE = RWH_WRITE_LIFE_NONE,
WRITE_LIFE_SHORT = RWH_WRITE_LIFE_SHORT,
WRITE_LIFE_MEDIUM = RWH_WRITE_LIFE_MEDIUM,
WRITE_LIFE_LONG = RWH_WRITE_LIFE_LONG,
WRITE_LIFE_EXTREME = RWH_WRITE_LIFE_EXTREME,
} __packed;

(What happens if you have two disjoint sets of files, both of which are MEDIUM, but they shouldn't be intertwined?)

Or are these new fdp hint things an overload of the existing write hint fields in the iocb/inode/bio? With a totally different meaning from anticipated lifetime of the data blocks?

If Christoph is going where I think he's going with xfs, then maybe the idea here is to map allocation groups on the realtime volume (i.e. rtgroups) to a zone (or a flash channel?), along with the ability for user programs to say "allocations to this cohort of files should all come from the same rtgroup".

But. The cohort associations exist entirely in the filesystem, so the filesystem gets to figure out the association between rtgroup and whatever scsi/nvme/fdp/whatever hints it sends the hardware. The mappings will all be to the same LBA space, but that's the filesystem's quirk, not necessarily a signal to the storage.

Writes within a cohort will target a single rtgroup until it fills up, at which point we pick another rtgroup and start filling that. Eventually something comes along to gc the surviving allocations in the old rtgroups. (Aside: the xfs filestreams thing that Dave mentioned upthread does something kind of like this, except that user programs cannot convey cohort associations to the filesystem.)

AFAICT the cohort associations are a file property, which the filesystem can persist in whatever way it wants -- e.g. (ab)using the u32 xfs project id. Is there any use using a different cohort id for a specific IO? I don't think there are any.

I suppose if your application wants to talk directly to a block device then I could see why you'd want to be able to send write hints or fdp placement whatevers directly to the storage, but I don't think that's the majority of application programs. Or to put it another way -- you can plumb in a blockdev-only direct interface to the storage hints, but us filesystem folks will design whatever makes the most sense for us, and will not probably not provide direct access to those hints. After all, the whole point of xfs is to virtualize a block device.

<shrug> Just my ignorant 2c. Did that help, or did I just pour gasoline on a flamewar?

--D

Quoted 53 lines

b) expose the size of the reclaim unit

not done yet, but needed for good operation:

c) expose how much capacity in a reclaim unit has been written

This is about as good as it gets to map the FDP (and to a lesser extent streams) interface to an abstract block layer API. If you have a better suggestion to actually expose these capabilities I'm all ears.

Now _my_ preferred use of that interface is a write out of place, map LBA regions to physical reclaim blocks file system. On the hand hand because it actually fits the file system I'm writing, on the other hand because industry experience has shown that this is a very good fit to flash storage (even without any explicit placement). If you think that's all wrong that fine, despite claims to the contrary from you absolutely nothing in the interface forced you to do that.

You can roll the dice for your LBA allocations and write them using a secure random number generator. The interface allows for all of that, but I doubt your results will all that great. Not my business.

Quoted 8 lines

I appreciate you put the time into getting your thoughts into actual code and it does look very valuable for ACTUAL ZONE block devices. But it seems to have missed the entire point of what this hardware feature does. If you're doing low level media garbage collection with FDP and tracking fake media write pointers, then you're doing it wrong. Please use Open Channel and ZNS SSDs if you want that interface and stop gatekeeping the EXISTING interface that has proven value in production software today.

Hey, feel free to come up with a better design. The whole point of a proper block layer design is that you actually can do that!

Quoted 10 lines
Quoted 3 lines

But instead of a picking up on that you just whine like this. Either spend a little bit of effort to actually get the interface right or just shut up.

Why the fuck should I make an effort to do improve your pet project that I don't have a customer for? They want to use the interface that was created 10 years ago, exactly for the reason it was created, and no one wants to introduce the risks of an untested and unproven major and invasive filesystem and block stack change in the kernel in the near term!

Because you apparently want an interface to FDP in the block layer. And if you want that you need to stop bypassing the file systems as pointed out not just by me but also at least one other file system maintainer and the maintainer of the most used block subsystem. I've thrown you some bones how that can be done while doing everything else you did before (at least assuming you get the fs side past the fs maintainers), but the only thanks for that is bullshit attacks at a personal level.

maintainer
#28 lore raw
Quoted 8 lines · Darrick J. Wong

How do filesystem users pick a write stream? I get a pretty strong sense that you're aiming to provide the ability for application software to group together a bunch of (potentially arbitrary) files in a cohort. Then (maybe?) you can say "This cohort of files are all expected to have data blocks related to each other in some fashion, so put them together so that the storage doesn't have to work so hard".

Quoted 4 lines

Part of my comprehension problem here (and probably why few fs people commented on this thread) is that I have no idea what FDP is, or what the write lifetime hints in scsi were/are, or what the current "hinting" scheme is.

FDP is just the "new" version of NVMe's streams. Support for its predecessor was added in commit f5d118406247acf ("nvme: add support for streams")

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f5d118406247acfc4fc481e441e01ea4d6318fdc

Various applications were written to that interface and showed initial promise, but production quality hardware never materialized. Some of these applications are still setting the write hints today, and the filesystems are all passing through the block stack, but there's just currently no nvme driver listening on the other side.

Contrast to the older nvme streams, capable hardware subscribing to this newer FDP scheme have been developed, and so people want to use those same applications using those same hints in the exact same way that it was originally designed. Enabling them could be just be a simple driver patch like the above without bothering the filesystem people :)

Quoted 11 lines

Is this what we're arguing about?

enum rw_hint {
WRITE_LIFE_NOT_SET = RWH_WRITE_LIFE_NOT_SET,
WRITE_LIFE_NONE = RWH_WRITE_LIFE_NONE,
WRITE_LIFE_SHORT = RWH_WRITE_LIFE_SHORT,
WRITE_LIFE_MEDIUM = RWH_WRITE_LIFE_MEDIUM,
WRITE_LIFE_LONG = RWH_WRITE_LIFE_LONG,
WRITE_LIFE_EXTREME = RWH_WRITE_LIFE_EXTREME,
} __packed;

Quoted 2 lines

(What happens if you have two disjoint sets of files, both of which are MEDIUM, but they shouldn't be intertwined?)

It's not going to perform as well. You'd be advised against over subscribing the hint value among applications with different relative expectations, but it generally (but not always) should be no worse than if you hadn't given any hints at all.

Quoted 3 lines

Or are these new fdp hint things an overload of the existing write hint fields in the iocb/inode/bio? With a totally different meaning from anticipated lifetime of the data blocks?

The meaning assigned to an FDP stream is whatever the user wants it to mean. It's not strictly a lifetime hint, but that is certainly a valid way to use them. The contract on the device's side is that writes to one stream won't create media interfere or contention with writes to other streams. This is the same as nvme's original streams, which for some reason did not carry any of this controversy.

#29 lore raw
Quoted 2 lines · Keith Busch

Various applications were written to that interface and showed initial promise, but production quality hardware never materialized.

FYI, production grade NVMe streams hardware did materialize and is still is shipped and used by multiple storage OEMS. Like most things in enterprise storage you're unlikely to see it outside the firmware builds for those few customers that actually require and QAed it.

Quoted 4 lines

Some of
these applications are still setting the write hints today, and the filesystems are all passing through the block stack, but there's just currently no nvme driver listening on the other side.

The only source available application we could fine that is using these hints is rocksb, which got the fcntl interface wrong so that it did not have a chance to actually work until Hans fixed it recently. Once he fixed it, it shows great results when using file system based hinting, although it still needs tuning to align it's internal file size to the hardware reclaim unit size, i.e. it either needs behind the scenes knowledge or an improved interface to be properly optimized.

Quoted 6 lines

The meaning assigned to an FDP stream is whatever the user wants it to mean. It's not strictly a lifetime hint, but that is certainly a valid way to use them. The contract on the device's side is that writes to one stream won't create media interfere or contention with writes to other streams. This is the same as nvme's original streams, which for some reason did not carry any of this controversy.

Maybe people realized how badly that works outside a few very special purpose uses?

I've said it before, but if you really do want to bypass the file systems (and there's very good reasons for that for some workloads), bypass it entirely. Don't try to micro-manage the layer below the file system from the application without any chance for the file system to even be in the known.

The entire discussion also seems to treat file systems as simple containers for blocks that are static. While that is roughly true for a lot of older file system designs, once you implement things like snapshots, data checksums, data journalling or in general flash friendly metadata write patterns that is very wrong, and the file systems will want to be able to separate write streams independently of the pure application write streams.