* Re: [PATCH v2 1/5] fs: add generic write-stream management ioctl [not found] ` <20260309052944.156054-2-joshi.k@samsung.com> @ 2026-03-09 16:33 ` Darrick J. Wong 2026-03-10 17:55 ` Kanchan Joshi 0 siblings, 1 reply; 3+ messages in thread From: Darrick J. Wong @ 2026-03-09 16:33 UTC (permalink / raw) To: Kanchan Joshi Cc: brauner, hch, jack, cem, kbusch, axboe, linux-xfs, linux-fsdevel, gost.dev, linux-api [cc linux-api because this is certainly an API definition] On Mon, Mar 09, 2026 at 10:59:40AM +0530, Kanchan Joshi wrote: > 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 <joshi.k@samsung.com> > --- > 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 > > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/5] fs: add generic write-stream management ioctl 2026-03-09 16:33 ` [PATCH v2 1/5] fs: add generic write-stream management ioctl Darrick J. Wong @ 2026-03-10 17:55 ` Kanchan Joshi 2026-03-10 20:44 ` Darrick J. Wong 0 siblings, 1 reply; 3+ messages in thread From: Kanchan Joshi @ 2026-03-10 17:55 UTC (permalink / raw) To: Darrick J. Wong Cc: brauner, hch, jack, cem, kbusch, axboe, linux-xfs, linux-fsdevel, gost.dev, linux-api On 3/9/2026 10:03 PM, Darrick J. Wong wrote: >> +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? >> +#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! ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/5] fs: add generic write-stream management ioctl 2026-03-10 17:55 ` Kanchan Joshi @ 2026-03-10 20:44 ` Darrick J. Wong 0 siblings, 0 replies; 3+ messages in thread From: Darrick J. Wong @ 2026-03-10 20:44 UTC (permalink / raw) To: Kanchan Joshi Cc: brauner, hch, jack, cem, kbusch, axboe, linux-xfs, linux-fsdevel, gost.dev, linux-api On Tue, Mar 10, 2026 at 11:25:25PM +0530, Kanchan Joshi wrote: > On 3/9/2026 10:03 PM, Darrick J. Wong wrote: > >> +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 > >> +#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! > ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-10 20:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260309052944.156054-1-joshi.k@samsung.com>
[not found] ` <CGME20260309053427epcas5p23419afbe49e4e35526388601e162ee94@epcas5p2.samsung.com>
[not found] ` <20260309052944.156054-2-joshi.k@samsung.com>
2026-03-09 16:33 ` [PATCH v2 1/5] fs: add generic write-stream management ioctl Darrick J. Wong
2026-03-10 17:55 ` Kanchan Joshi
2026-03-10 20:44 ` Darrick J. Wong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox