On Mon, May 11, 2026 at 10:36 PM Christoph Hellwig <[email protected]> wrote: > > Always use si->max which is updated setup_swap_extents instead of copying > into and out of maxpages. > > Signed-off-by: Christoph Hellwig <[email protected]>
Acked-by: Chris Li <[email protected]> > --- > mm/swapfile.c | 27 +++++++++++---------------- > 1 file changed, 11 insertions(+), 16 deletions(-) > > diff --git a/mm/swapfile.c b/mm/swapfile.c > index 9174f1eeffb0..f7ebd97e28a3 100644 > --- a/mm/swapfile.c > +++ b/mm/swapfile.c > @@ -3350,10 +3350,9 @@ static unsigned long read_swap_header(struct > swap_info_struct *si, > } > > static int setup_swap_clusters_info(struct swap_info_struct *si, > - union swap_header *swap_header, > - unsigned long maxpages) > + union swap_header *swap_header) > { > - unsigned long nr_clusters = DIV_ROUND_UP(maxpages, SWAPFILE_CLUSTER); > + unsigned long nr_clusters = DIV_ROUND_UP(si->max, SWAPFILE_CLUSTER); > struct swap_cluster_info *cluster_info; > int err = -ENOMEM; > unsigned long i; > @@ -3395,7 +3394,7 @@ static int setup_swap_clusters_info(struct > swap_info_struct *si, > if (err) > goto err; > } > - for (i = maxpages; i < round_up(maxpages, SWAPFILE_CLUSTER); i++) { > + for (i = si->max; i < round_up(si->max, SWAPFILE_CLUSTER); i++) { > err = swap_cluster_setup_bad_slot(si, cluster_info, i, true); Nitpick: I couldn't hlep but notice the si->max does not change between setup bad slots, so in theory you can cache the si->max value to a local variable for the loop. In real life, it will make no difference, so feel free to keep it as is. Chris _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
