shmem: remove vma arg from shmem_get_folio_gfp()
authorHugh Dickins <hughd@google.com>
Sat, 30 Sep 2023 03:26:53 +0000 (20:26 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 18 Oct 2023 21:34:13 +0000 (14:34 -0700)
The vma is already there in vmf->vma, so no need for a separate arg.

Link: https://lkml.kernel.org/r/d9ce6f65-a2ed-48f4-4299-fdb0544875c5@google.com
Signed-off-by: Hugh Dickins <hughd@google.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Carlos Maiolino <cem@kernel.org>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Chuck Lever <chuck.lever@oracle.com>
Cc: Darrick J. Wong <djwong@kernel.org>
Cc: Dave Chinner <dchinner@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Tim Chen <tim.c.chen@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/shmem.c

index 8539d39ec9a3c158f8f78d1d90c760b796be370c..dfa7e544a99d00a0d6cd93cfad3aa7a6c690e3f4 100644 (file)
@@ -1921,14 +1921,13 @@ unlock:
  * vm. If we swap it in we mark it dirty since we also free the swap
  * entry since a page cannot live in both the swap and page cache.
  *
- * vma, vmf, and fault_type are only supplied by shmem_fault:
- * otherwise they are NULL.
+ * vmf and fault_type are only supplied by shmem_fault: otherwise they are NULL.
  */
 static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index,
                struct folio **foliop, enum sgp_type sgp, gfp_t gfp,
-               struct vm_area_struct *vma, struct vm_fault *vmf,
-               vm_fault_t *fault_type)
+               struct vm_fault *vmf, vm_fault_t *fault_type)
 {
+       struct vm_area_struct *vma = vmf ? vmf->vma : NULL;
        struct address_space *mapping = inode->i_mapping;
        struct shmem_inode_info *info = SHMEM_I(inode);
        struct shmem_sb_info *sbinfo;
@@ -2141,7 +2140,7 @@ int shmem_get_folio(struct inode *inode, pgoff_t index, struct folio **foliop,
                enum sgp_type sgp)
 {
        return shmem_get_folio_gfp(inode, index, foliop, sgp,
-                       mapping_gfp_mask(inode->i_mapping), NULL, NULL, NULL);
+                       mapping_gfp_mask(inode->i_mapping), NULL, NULL);
 }
 
 /*
@@ -2225,7 +2224,7 @@ static vm_fault_t shmem_fault(struct vm_fault *vmf)
        }
 
        err = shmem_get_folio_gfp(inode, vmf->pgoff, &folio, SGP_CACHE,
-                                 gfp, vma, vmf, &ret);
+                                 gfp, vmf, &ret);
        if (err)
                return vmf_error(err);
        if (folio)
@@ -4893,7 +4892,7 @@ struct folio *shmem_read_folio_gfp(struct address_space *mapping,
 
        BUG_ON(!shmem_mapping(mapping));
        error = shmem_get_folio_gfp(inode, index, &folio, SGP_CACHE,
-                                 gfp, NULL, NULL, NULL);
+                                   gfp, NULL, NULL);
        if (error)
                return ERR_PTR(error);