Re: [PATCH v2 1/5] fs: add generic write-stream management ioctl
From: "Darrick J. Wong" <djwong@kernel.org>
Date: 2026-03-10 20:44:18
Also in:
linux-fsdevel, linux-xfs
On Tue, Mar 10, 2026 at 11:25:25PM +0530, Kanchan Joshi wrote:
On 3/9/2026 10:03 PM, Darrick J. Wong wrote:quoted
quoted
+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?Yeah, right. That's the trade-off with swiss army knife type ioctl which uses op_flags to decide what it should do. Apart from keeping a single ioctl I was thinking a bit about extensibility (for anything new we may be able to do a new op_flags with some rsvd or union) too. But if you feel strong about this, I can take 3 ioctl route?
struct fs_write_stream {
__u32 op_flags;
union {
__u32 stream_id;
__u32 max_ids;
};
__u64 reserved;
};
perhaps? You might want to look into whether or not we're allowed to
have anonymous unions in UAPI headers. We all ❤️ C11, right?
--D
quoted
quoted
+#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.Indeed, thanks!