Re: [PATCH v2 1/5] fs: add generic write-stream management ioctl
From: "Darrick J. Wong" <djwong@kernel.org>
Date: 2026-03-09 16:33:26
Also in:
linux-fsdevel, linux-xfs
[cc linux-api because this is certainly an API definition] On Mon, Mar 09, 2026 at 10:59:40AM +0530, Kanchan Joshi wrote:
quoted hunk
Wire up the userspace interface for write stream management via a new vfs ioctl 'FS_IOC_WRITE_STEAM'. Application communictes the intended operation using the 'op_flags' field of the passed 'struct fs_write_stream'. Valid flags are: FS_WRITE_STREAM_OP_GET_MAX: Returns the number of available streams. FS_WRITE_STREAM_OP_SET: Assign a specific stream value to the file. FS_WRITE_STREAM_OP_GET: Query what stream value is set on the file. Application should query the available streams by using FS_WRITE_STREAM_OP_GET_MAX first. If returned value is N, valid stream values for the file are 0 to N. Stream value 0 implies that no stream is set on the file. Setting a larger value than available streams is rejected. Signed-off-by: Kanchan Joshi <redacted> --- include/uapi/linux/fs.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 70b2b661f42c..4d0805b52949 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h@@ -338,6 +338,18 @@ struct file_attr { /* Get logical block metadata capability details */ #define FS_IOC_GETLBMD_CAP _IOWR(0x15, 2, struct logical_block_metadata_cap) +struct fs_write_stream { + __u32 op_flags; /* IN: operation flags */ + __u32 stream_id; /* IN/OUT: stream value to assign/guery */ + __u32 max_streams; /* OUT: max streams values supported */ + __u32 rsvd; +};
This isn't an very cohesive interface -- GET_MAX probably only needs op_flags and max_streams, right? And GET/SET only use op_flags and stream_id, right?
+#define FS_WRITE_STREAM_OP_GET_MAX (1 << 0)
+#define FS_WRITE_STREAM_OP_GET (1 << 1)
+#define FS_WRITE_STREAM_OP_SET (1 << 2)
+
+#define FS_IOC_WRITE_STREAM _IOWR('f', 43, struct fs_write_stream)EXT4_IOC_CHECKPOINT already took 'f' / 43. I /think/ there's no problem because its argument is a u32 and ioctl definitions incorporate the lower bits of of the argument size but you might want to be careful anyway. --D
/* * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) * -- 2.25.1