From: "Darrick J. Wong" <djwong@kernel.org>
To: Kanchan Joshi <joshi.k@samsung.com>
Cc: brauner@kernel.org, hch@lst.de, dgc@kernel.org, jack@suse.cz,
cem@kernel.org, axboe@kernel.dk, kbusch@kernel.org,
ritesh.list@gmail.com, linux-xfs@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org,
gost.dev@samsung.com, Anuj Gupta <anuj20.g@samsung.com>
Subject: Re: [PATCH v4 1/6] fs: add write-stream management ioctls
Date: Mon, 20 Jul 2026 20:03:38 -0700 [thread overview]
Message-ID: <20260721030338.GU7380@frogsfrogsfrogs> (raw)
In-Reply-To: <20260717125538.508925-2-joshi.k@samsung.com>
On Fri, Jul 17, 2026 at 06:25:33PM +0530, Kanchan Joshi wrote:
> From: Anuj Gupta <anuj20.g@samsung.com>
>
> Wire up the userspace interface for write stream management via four
> ioctls:
>
> FS_IOC_WRITE_STREAM_GET_MAX query the max streams supported
> FS_IOC_WRITE_STREAM_OPEN open a stream id, returns a stream fd
> FS_IOC_WRITE_STREAM_SET attach the stream fd to an open file
> FS_IOC_WRITE_STREAM_GET query the stream id value set on a file
>
> Application should query the available streams by using
> FS_IOC_WRITE_STREAM_GET_MAX. If returned value is N, valid stream id for
> the file are 1 to N.
>
> Application calls FS_IOC_WRITE_STREAM_OPEN to get fd for a stream-id.
> By default, kernel picks an available stream-id and returns the fd for
> it. The flag FS_WRITE_STREAM_OPEN_EXACT can be used to request a
> specific stream_id. This is useful if application cares about keeping a
> stable stream-id-to-spatial-isolation-bucket mapping across restarts.
Hmm. If FS_IOC_WRITE_STREAM_OPEN returns an fd that represents an open
stream id, then why does STREAM_SET below take a pointer to a signed
s32? And why does STREAM_GET take a pointer to a u32?
IOWs it'd be much easier to distinguish these things if the ioctls took
pointers to structs instead of u32/s32 pointers directly.
Also it's a little weird that STREAM_SET associates an open file with a
stream fd, but STREAM_GET returns the stream *id* (not the fd)
associated with an open file.
Can you extract the stream id from the fd that FS_IOC_WRITE_STREAM_OPEN
returns?
--D
> Suggested-by: Christoph Hellwig <hch@lst.de>
> Co-developed-by: Kanchan Joshi <joshi.k@samsung.com>
> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
> ---
> include/uapi/linux/fs.h | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
> index bd87262f2e34..a756d27bdf84 100644
> --- a/include/uapi/linux/fs.h
> +++ b/include/uapi/linux/fs.h
> @@ -345,6 +345,22 @@ 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_open {
> + __u32 stream_id; /* IN: requested id if OPEN_EXACT set; OUT: assigned id */
> + __u32 flags; /* IN: FS_WRITE_STREAM_OPEN_* */
> +};
> +
> +/*
> + * Flag to ask for specific stream_id, otherwise kernel can return any.
> + * Fails with -EBUSY if that stream_id is already held
> + */
> +#define FS_WRITE_STREAM_OPEN_EXACT (1 << 0)
> +
> +#define FS_IOC_WRITE_STREAM_GET_MAX _IOR('f', 135, __u32)
> +#define FS_IOC_WRITE_STREAM_OPEN _IOWR('f', 136, struct fs_write_stream_open)
> +#define FS_IOC_WRITE_STREAM_SET _IOW('f', 137, __s32)
> +#define FS_IOC_WRITE_STREAM_GET _IOR('f', 138, __u32)
> +
> /*
> * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
> *
> --
> 2.25.1
>
>
next prev parent reply other threads:[~2026-07-21 3:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20260717125624epcas5p3fefc5b8ff274260bf8fb2f1b225b4f9a@epcas5p3.samsung.com>
2026-07-17 12:55 ` [PATCH v4 0/6] xfs write streams Kanchan Joshi
2026-07-17 12:55 ` [PATCH v4 1/6] fs: add write-stream management ioctls Kanchan Joshi
2026-07-21 3:03 ` Darrick J. Wong [this message]
2026-07-17 12:55 ` [PATCH v4 2/6] iomap: introduce and propagate write_stream Kanchan Joshi
2026-07-17 12:55 ` [PATCH v4 3/6] xfs: implement write-stream management support Kanchan Joshi
2026-07-21 3:08 ` Darrick J. Wong
2026-07-17 12:55 ` [PATCH v4 4/6] xfs: generic AG set based steering Kanchan Joshi
2026-07-21 3:20 ` Darrick J. Wong
2026-07-17 12:55 ` [PATCH v4 5/6] xfs: write stream based AG placement Kanchan Joshi
2026-07-17 12:55 ` [PATCH v4 6/6] xfs: introduce software write streams Kanchan Joshi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260721030338.GU7380@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=anuj20.g@samsung.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=cem@kernel.org \
--cc=dgc@kernel.org \
--cc=gost.dev@samsung.com \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=joshi.k@samsung.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=ritesh.list@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox