shmem: convert shmem_get_partial_folio() to use shmem_get_folio()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 2 Sep 2022 19:46:21 +0000 (20:46 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 3 Oct 2022 21:02:49 +0000 (14:02 -0700)
Get rid of an unnecessary folio->page->folio conversion.

Link: https://lkml.kernel.org/r/20220902194653.1739778-26-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/shmem.c

index 32afc8039e6601234649b893b8cae066336b276d..772a30593fcca866ae84870f54b246840767adab 100644 (file)
@@ -874,10 +874,9 @@ void shmem_unlock_mapping(struct address_space *mapping)
 static struct folio *shmem_get_partial_folio(struct inode *inode, pgoff_t index)
 {
        struct folio *folio;
-       struct page *page;
 
        /*
-        * At first avoid shmem_getpage(,,,SGP_READ): that fails
+        * At first avoid shmem_get_folio(,,,SGP_READ): that fails
         * beyond i_size, and reports fallocated pages as holes.
         */
        folio = __filemap_get_folio(inode->i_mapping, index,
@@ -888,9 +887,9 @@ static struct folio *shmem_get_partial_folio(struct inode *inode, pgoff_t index)
         * But read a page back from swap if any of it is within i_size
         * (although in some cases this is just a waste of time).
         */
-       page = NULL;
-       shmem_getpage(inode, index, &page, SGP_READ);
-       return page ? page_folio(page) : NULL;
+       folio = NULL;
+       shmem_get_folio(inode, index, &folio, SGP_READ);
+       return folio;
 }
 
 /*