xfs write streams - #2650
Open
vfsci-bot[bot] wants to merge 8 commits into
Open
xfs write streams#2650vfsci-bot[bot] wants to merge 8 commits into
vfsci-bot[bot] wants to merge 8 commits into
Conversation
Add three ioctls for write stream management: FS_IOC_WRITE_STREAM_GET_MAX number of streams the filesystem offers FS_IOC_WRITE_STREAM_ALLOC reserve a stream, returns an fd FS_IOC_WRITE_STREAM_SET set or clear a stream on a file Write streams are a resource the kernel manages and applications ask for. ALLOC reserves a stream and returns a stream fd; the stream stays reserved as long as that fd is open. ALLOC fails once all streams are reserved. SET assigns the stream named by the stream_fd in struct fs_write_stream_set to an open file; the same stream fd can be used to set the stream on any number of files. SET with FS_WRITE_STREAM_SET_CLEAR and a stream_fd of -1 clears whatever stream the file carries. Suggested-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
Add a bitmap-based stream pool and anonymous fds for reserved streams. Helpers initialize and destroy a pool, reserve a stream as an fd, and resolve a stream fd back to its id. Suggested-by: Christoph Hellwig <hch@lst.de> Suggested-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
Keep the attached stream id in the VFS inode rather than the filesystem's own, so that fcntl_set_rw_hint() can see it. It is a u16 in the 32-bit hole after i_state, so struct inode does not grow. Suggested-by: Christoph Hellwig <hch@lst.de> Suggested-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
Implement the FS_IOC_WRITE_STREAM_* handlers. Keep a stream pool in the data device buftarg, sized from the AG count. The id is stored in inode->i_write_stream and is not written to disk. Write streams, filestreams and write life time hints are mutually exclusive. GET_MAX reports zero for filestream and realtime inodes, SET rejects those and any inode carrying a hint, and setattr refuses to turn on filestream or realtime placement while a stream is attached. ALLOC is restricted to CAP_SYS_ADMIN. Suggested-by: Christoph Hellwig <hch@lst.de> Suggested-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
Choose the starting AG from the write stream set on the file.
Isolating streams into separate allocation groups reduces block
interleaving between concurrent writers, AGF lock contention and logical
file fragmentation.
AGs are partitioned among the streams. The stream value selects the AG
set and the inode number selects the AG within it, so intra-stream
concurrency comes from the AG set size.
Example: 8 Allocation Groups, 4 write streams
AG set size = 2 AGs per write stream
Stream 1 (ID: 1) Stream 2 (ID: 2) Streams 3 & 4
+---------+---------+ +---------+---------+ +-------------
| AG0 | AG1 | | AG2 | AG3 | | AG4...AG7
+---------+---------+ +---------+---------+ +-------------
^ ^ ^ ^
| | | |
| File B (ino: 101) | File D (ino: 201)
| 101 % 2 = 1 -> AG 1 | 201 % 2 = 1 -> AG 3
| |
File A (ino: 100) File C (ino: 200)
100 % 2 = 0 -> AG 0 200 % 2 = 0 -> AG 2
If the AGs do not divide evenly, the last stream absorbs the remainder.
Set boundaries are a hint, not a partition: file contiguity is preserved
and the full space stays usable with a single stream.
Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
Enable write streams on non-zoned realtime volumes that have realtime groups, partitioning RTGs among the streams as the AG side does. Stream based RTG selection applies to the first allocation of a file; later ones keep using the adjacent-allocation hint so the file stays contiguous. Signed-off-by: Anuj Gupta <anuj20.g@samsung.com> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
Add a new write_stream field to struct iomap. Propagate write_stream from iomap to bio in both direct I/O and buffered writeback paths. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
Use the stream count reported by the data and realtime block devices where they have one, falling back to the geometry-derived count. The count is capped at the group count so that every stream backs onto at least one group; a device with more streams than the filesystem has groups loses the excess, so mkfs should create at least as many groups as the device has streams. Set iomap->write_stream from the inode so that the id reaches the device. Signed-off-by: Kanchan Joshi <joshi.k@samsung.com> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Series: https://patchwork.kernel.org/project/linux-fsdevel/list/?series=1170204
Submitter: Kanchan Joshi
Version: 5
Patches: 8/8
Message-ID:
<20260921093147.59935-1-joshi.k@samsung.com>Base: vfs.base.ci
Lore: https://lore.kernel.org/linux-fsdevel/20260921093147.59935-1-joshi.k@samsung.com
Automated by ml2pr