mm-swap-use-swap_ops-to-register-swap-devices-methods.patch removed from -mm tree
The quilt patch titled
Subject: mm/swap: use swap_ops to register swap device's methods
has been removed from the -mm tree. Its filename was
mm-swap-use-swap_ops-to-register-swap-devices-methods.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Christoph Hellwig <[email protected]>
Subject: mm/swap: use swap_ops to register swap device's methods
Date: Mon, 13 Jul 2026 11:33:42 +0200
This simplifies codes and makes logic clearer. And also makes later any new swap device type being added easier to handle.
Currently there are two types of swap devices: fs and bdev.
---
include/linux/swap.h | 1 mm/page_io.c | 68 +++++++++++++++++++++++++---------------- mm/swap.h | 10 ++++++ mm/swapfile.c | 4 ++ 4 files changed, 58 insertions(+), 25 deletions(-)
include/linux/swap.h renamed from include/linux/swap.h~mm-swap-use-swap_ops-to-register-swap-devices-methods +1 -0
@@ -276,6 +276,7 @@ struct swap_info_struct {struct work_struct reclaim_work;/* reclaim worker */ struct list_head discard_clusters;/* discard clusters list */ struct plist_node avail_list;/* entry in swap_avail_head */ +const struct swap_ops *ops; };static inline swp_entry_t page_swap_entry (struct page *page)
mm/page_io.c renamed from mm/page_io.c~mm-swap-use-swap_ops-to-register-swap-devices-methods +43 -25
96 lines not on this page · raw message
mm/swapfile.c renamed from mm/swapfile.c~mm-swap-use-swap_ops-to-register-swap-devices-methods +4 -0
@@ -2963,6 +2963,8 @@ static int setup_swap_extents(struct swaif (ret)return ret; + sis->ops = &swap_bdev_ops; +if (S_ISBLK (inode->i_mode)) { ret =add_swap_extent (sis,0 , sis->max,0 ); *span = sis->pages;
@@ -2973,6 +2975,8 @@ static int setup_swap_extents(struct swa ret = mapping->a_ops->swap_activate (sis, swap_file, span);if (ret <0 )return ret; +if (sis->flags &SWP_FS_OPS ) + sis->ops = &swap_fs_ops; sis->flags |=SWP_ACTIVATED ;return ret; }
mm/swap.h renamed from mm/swap.h~mm-swap-use-swap_ops-to-register-swap-devices-methods +10 -0
@@ -96,6 +96,13 @@ struct swap_io_ctx {struct swap_info_struct *sis; }; +struct swap_ops { +bool (*can_merge)(struct folio *folio,struct folio *prev_folio, +size_t prev_folio_size,int rw); +void (*submit_write)(struct swap_io_ctx *ctx); +void (*submit_read)(struct swap_io_ctx *ctx); +}; +#ifdef CONFIG_SWAP #include <linux/swapops.h> /* for swp_offset */ #include <linux/blk_types.h> /* for bio_end_io_t */
@@ -483,6 +490,9 @@ static inline unsigned int folio_swap_fl#endif /* CONFIG_SWAP */ +extern const struct swap_ops swap_bdev_ops; +extern const struct swap_ops swap_fs_ops; +int shmem_writeout (struct swap_io_ctx *ctx,struct folio *folio,struct list_head *folio_list);
_
Patches currently in -mm which might be from [email protected] are