swap: remove the maxpages variable in sys_swapon#820
Open
blktests-ci[bot] wants to merge 12 commits into
Open
Conversation
Author
|
Upstream branch: aa54b1d |
Author
|
Upstream branch: aa54b1d |
081d8c9 to
9ad763d
Compare
Author
|
Upstream branch: aa54b1d |
9ad763d to
521fd60
Compare
Author
|
Upstream branch: aa54b1d |
521fd60 to
5334fba
Compare
Author
|
Upstream branch: aa54b1d |
5334fba to
fc87575
Compare
added 12 commits
May 12, 2026 17:17
Always use si->max which is updated setup_swap_extents instead of copying into and out of maxpages. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Make the core swap code calculate sis->pages, nr_extents and the span, re-set sis->max based on it and don't require passing the current offset into the swap file to swap_add_extent as all that can trivially be calculated internally. Also truncate the spans based on the available information. All this removes a lot of boilerplate code in the callers. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
The swap operations have nothing to do with the address_space, which is used for pagecache operations. Move them to struct file_operations instead. This will allow moving the block device special cases into block/fops.c subsequently. Pass struct file first to ->swap_activate as file operations typically get the file or iocb as first argument and use swap_activate instead of swapfile_activate in all names to be consistent. Note that while the trivial iomap wrappers are moved to a new file when applicable to keep them local to the file operation instances, complex implementation are kept in their existing place. It might be worth to move them in follow-on patches if the maintainers desire so. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Various swap code assumes it runs either on a block device or on a regular file. Make this restriction explicit using checks right after opening the file. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Reflow setup_swap_extents so that the flag checking is not conditional on a swap_activate method. This is currently a no-op because the swapoff code still checks the presence of a swap_deactivate method, but it simplifies adding a new check, and also makes the SWP_ACTIVATED flag more consistent. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Make use of the abstractions we have. This is a preparation for moving more special casing down into block/. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Don't blindly pass the value from the swap header to swap_add_extent, but instead the device size rounded down to page granularity. This activated the sanity checking in the core code that catches a too large value in the swap header. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
add_swap_extent already coalesces multiple extents, no need to duplicate that in the caller. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Only the file operation method knows what block device we'll swap to. So move down setting sis->bdev and the special blockdev flag into ->swap_activate. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Add a helper abstracting away the low-level details of enabling fs_ops-based swapping. This prepares for taking swap_info_struct private. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
struct swap_extent is only used inside of mm/swapfile.c, so move it there. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
swap_info_struct is now internal to the MM subsystem, so remove it from the public header. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Author
|
Upstream branch: aa54b1d |
fc87575 to
409780a
Compare
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.
Pull request for series with
subject: swap: remove the maxpages variable in sys_swapon
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1093264