| Message ID | 20260512053625.2950900-12-hch@lst.de |
|---|---|
| State | Not Applicable |
| Headers | show |
| Series | [01/12] swap: remove the maxpages variable in sys_swapon | expand |
On 5/12/26 14:35, Christoph Hellwig wrote: > struct swap_extent is only used inside of mm/swapfile.c, so move it > there. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Looks OK to me. Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
On Tue, May 12, 2026 at 07:35:27AM +0200, Christoph Hellwig wrote: > struct swap_extent is only used inside of mm/swapfile.c, so move it > there. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Woo, information hiding! Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> --D > --- > include/linux/swap.h | 15 --------------- > mm/swapfile.c | 15 +++++++++++++++ > 2 files changed, 15 insertions(+), 15 deletions(-) > > diff --git a/include/linux/swap.h b/include/linux/swap.h > index 916889738f08..95237ee065c2 100644 > --- a/include/linux/swap.h > +++ b/include/linux/swap.h > @@ -178,21 +178,6 @@ struct sysinfo; > struct writeback_control; > struct zone; > > -/* > - * A swap extent maps a range of a swapfile's PAGE_SIZE pages onto a range of > - * disk blocks. A rbtree of swap extents maps the entire swapfile (Where the > - * term `swapfile' refers to either a blockdevice or an IS_REG file). Apart > - * from setup, they're handled identically. > - * > - * We always assume that blocks are of size PAGE_SIZE. > - */ > -struct swap_extent { > - struct rb_node rb_node; > - pgoff_t start_page; > - pgoff_t nr_pages; > - sector_t start_block; > -}; > - > /* > * Max bad pages in the new format.. > */ > diff --git a/mm/swapfile.c b/mm/swapfile.c > index 26852c2ad36e..c0479533f9ef 100644 > --- a/mm/swapfile.c > +++ b/mm/swapfile.c > @@ -260,6 +260,21 @@ static int __try_to_reclaim_swap(struct swap_info_struct *si, > return ret; > } > > +/* > + * A swap extent maps a range of a swapfile's PAGE_SIZE pages onto a range of > + * disk blocks. A rbtree of swap extents maps the entire swapfile (Where the > + * term `swapfile' refers to either a blockdevice or an IS_REG file). Apart > + * from setup, they're handled identically. > + * > + * We always assume that blocks are of size PAGE_SIZE. > + */ > +struct swap_extent { > + struct rb_node rb_node; > + pgoff_t start_page; > + pgoff_t nr_pages; > + sector_t start_block; > +}; > + > static inline struct swap_extent *first_se(struct swap_info_struct *sis) > { > struct rb_node *rb = rb_first(&sis->swap_extent_root); > -- > 2.53.0 > >
On Mon, May 11, 2026 at 10:38 PM Christoph Hellwig <hch@lst.de> wrote: > > struct swap_extent is only used inside of mm/swapfile.c, so move it > there. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Chris Li <chrisl@kernel.org> Chris
diff --git a/include/linux/swap.h b/include/linux/swap.h index 916889738f08..95237ee065c2 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -178,21 +178,6 @@ struct sysinfo; struct writeback_control; struct zone; -/* - * A swap extent maps a range of a swapfile's PAGE_SIZE pages onto a range of - * disk blocks. A rbtree of swap extents maps the entire swapfile (Where the - * term `swapfile' refers to either a blockdevice or an IS_REG file). Apart - * from setup, they're handled identically. - * - * We always assume that blocks are of size PAGE_SIZE. - */ -struct swap_extent { - struct rb_node rb_node; - pgoff_t start_page; - pgoff_t nr_pages; - sector_t start_block; -}; - /* * Max bad pages in the new format.. */ diff --git a/mm/swapfile.c b/mm/swapfile.c index 26852c2ad36e..c0479533f9ef 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -260,6 +260,21 @@ static int __try_to_reclaim_swap(struct swap_info_struct *si, return ret; } +/* + * A swap extent maps a range of a swapfile's PAGE_SIZE pages onto a range of + * disk blocks. A rbtree of swap extents maps the entire swapfile (Where the + * term `swapfile' refers to either a blockdevice or an IS_REG file). Apart + * from setup, they're handled identically. + * + * We always assume that blocks are of size PAGE_SIZE. + */ +struct swap_extent { + struct rb_node rb_node; + pgoff_t start_page; + pgoff_t nr_pages; + sector_t start_block; +}; + static inline struct swap_extent *first_se(struct swap_info_struct *sis) { struct rb_node *rb = rb_first(&sis->swap_extent_root);
struct swap_extent is only used inside of mm/swapfile.c, so move it there. Signed-off-by: Christoph Hellwig <hch@lst.de> --- include/linux/swap.h | 15 --------------- mm/swapfile.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-)