Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Kanchan Joshi <joshi.k@samsung.com>
To: "Darrick J. Wong" <djwong@kernel.org>
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 <anuj1072538@gmail.com>,
	Anuj Gupta <anuj20.g@samsung.com>
Subject: Re: [PATCH v4 3/6] xfs: implement write-stream management support
Date: Fri, 31 Jul 2026 13:33:04 +0530	[thread overview]
Message-ID: <00f6099f-91ae-4685-951d-2ea0ee9a7b11@samsung.com> (raw)
In-Reply-To: <20260721030810.GV7380@frogsfrogsfrogs>

On 7/21/2026 8:38 AM, Darrick J. Wong wrote:
>> Write streams, filestreams, and write-life-time hints are mutually exclusive;
>> combining any two of them returns -EINVAL:
>>    - GET_MAX reports 0 whenever xfs_inode_is_filestream() is true,
>>      covering both mount-wide filestreams and the per-inode chattr
>>      flag. Also when the file is on the realtime device.
>>    - SET refuses to bind a stream to a file that already has a
>>      write-life-time hint (fcntl F_SET_RW_HINT), is filestream, or is
>>      on the realtime device.
>>    - chattr refuses to set the filestream or realtime flag on a file
>>      that already has a write stream set.
> These special "files" that represent stream ids could be generic code
> instaed of in xfs.  AFAICT the only thing you need from xfs is a pointer
> from struct xfs_inode to struct (xfs_)write_stream, right?

Right. Is it fine if we come to it when everything else is settled.
I was hoping to lift common things up when write-stream is applied on 
another FS.
> 
>> 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>
>> ---
>>   fs/xfs/xfs_icache.c |   1 +
>>   fs/xfs/xfs_inode.c  | 155 ++++++++++++++++++++++++++++++++++++++++++++
>>   fs/xfs/xfs_inode.h  |   8 +++
>>   fs/xfs/xfs_ioctl.c  |  69 ++++++++++++++++++++
>>   fs/xfs/xfs_iomap.c  |   1 +
>>   fs/xfs/xfs_mount.h  |   3 +
>>   fs/xfs/xfs_super.c  |  12 ++++
>>   7 files changed, 249 insertions(+)
>>
>> diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
>> index 9d8dd30bd927..7b9dda74122f 100644
>> --- a/fs/xfs/xfs_icache.c
>> +++ b/fs/xfs/xfs_icache.c
>> @@ -129,6 +129,7 @@ xfs_inode_alloc(
>>   	spin_lock_init(&ip->i_ioend_lock);
>>   	ip->i_next_unlinked = NULLAGINO;
>>   	ip->i_prev_unlinked = 0;
>> +	ip->i_write_stream = 0;
>>   
>>   	return ip;
>>   }
>> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
>> index 15279d22a894..aafc3ffa6e0a 100644
>> --- a/fs/xfs/xfs_inode.c
>> +++ b/fs/xfs/xfs_inode.c
>> @@ -4,6 +4,7 @@
>>    * All Rights Reserved.
>>    */
>>   #include <linux/iversion.h>
>> +#include <linux/anon_inodes.h>
>>   
>>   #include "xfs_platform.h"
>>   #include "xfs_fs.h"
>> @@ -47,6 +48,160 @@
>>   
>>   struct kmem_cache *xfs_inode_cache;
>>   
>> +int
>> +xfs_inode_max_write_streams(
>> +	struct xfs_inode	*ip)
>> +{
>> +	struct block_device	*bdev;
>> +	bool			is_filestream, is_realtime;
>> +
>> +	xfs_ilock(ip, XFS_ILOCK_SHARED);
>> +	is_filestream = xfs_inode_is_filestream(ip);
>> +	is_realtime = XFS_IS_REALTIME_INODE(ip);
>> +	bdev = xfs_inode_buftarg(ip)->bt_bdev;
>> +	xfs_iunlock(ip, XFS_ILOCK_SHARED);
>> +
>> +	if (!bdev || is_filestream || is_realtime)
> Would be nice if realtime worked, or someone at least adds a comment
> about why it isn't (e.g. "we have something more exciting for rt/zoned
> filesystems") etc.

Will add, and that possibility is there.

Since each allocator (default,filestream, rt, zoned) has a different 
logical placement, a single write-hint based scheme does not fit all.

For non-zoned RT device: write-stream based physical placement can just 
work, it's mostly about lifting the checks that we have now. And adding 
logical placement (use write-stream to choose RTG similar to how we pick 
AG) is straight. But would you prefer that over default round-robin rotor?

For zoned RT device: two options
- Do nothing as write-hint based zone selection is already in place.
- Or publish N write-streams (corresponds to N isolation buckets over >N 
open zones), and use file's write-stream value for zone selction.

Current write-hint based scheme, based on xfs_zoned_hint_score[][] 
matrix, supports 4 isolation buckets. An application may need more, say 
6. And two such applications will require 12. Zoned-RT can care more 
isolation buckets, but write-hints don't allow to publish that.

Also, two unrelated applications that both pick WRITE_LIFE_SHORT bucket 
may land in the same zone. This goes back to FD based interface for 
write-steam.

Not having enough buckets, and having multi-tenant mixing - both can 
improved with the write-stream.
But I might be missing many zoned-xfs details; Maybe Christoph could 
weigh in?

  reply	other threads:[~2026-07-31  8:03 UTC|newest]

Thread overview: 34+ 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
2026-07-30 14:52       ` Kanchan Joshi
2026-07-30 17:22         ` Darrick J. Wong
2026-07-31  8:15           ` Kanchan Joshi
2026-08-19  7:04           ` Christoph Hellwig
2026-08-19 22:05             ` Darrick J. Wong
2026-08-20  5:15             ` Miklos Szeredi
2026-08-19  7:08         ` Christoph Hellwig
2026-08-24  6:30           ` Kanchan Joshi
2026-08-25  6:55             ` Christoph Hellwig
2026-08-26 10:42               ` Kanchan Joshi
2026-08-19  7:11     ` Christoph Hellwig
2026-07-17 12:55   ` [PATCH v4 2/6] iomap: introduce and propagate write_stream Kanchan Joshi
2026-08-19  7:09     ` Christoph Hellwig
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-31  8:03       ` Kanchan Joshi [this message]
2026-08-19  7:12         ` Christoph Hellwig
2026-08-19  7:18     ` Christoph Hellwig
2026-08-19  7:24     ` Christoph Hellwig
2026-08-21 11:39       ` Kanchan Joshi
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-24 14:57       ` Kanchan Joshi
2026-08-19  7:21     ` Christoph Hellwig
2026-08-21 12:08       ` Kanchan Joshi
2026-07-17 12:55   ` [PATCH v4 5/6] xfs: write stream based AG placement Kanchan Joshi
2026-08-19  7:29     ` Christoph Hellwig
2026-08-21 12:33       ` Kanchan Joshi
2026-08-25  6:57         ` Christoph Hellwig
2026-07-17 12:55   ` [PATCH v4 6/6] xfs: introduce software write streams Kanchan Joshi
2026-08-19  7:31     ` Christoph Hellwig

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=00f6099f-91ae-4685-951d-2ea0ee9a7b11@samsung.com \
    --to=joshi.k@samsung.com \
    --cc=anuj1072538@gmail.com \
    --cc=anuj20.g@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=cem@kernel.org \
    --cc=dgc@kernel.org \
    --cc=djwong@kernel.org \
    --cc=gost.dev@samsung.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --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