diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-09-02 22:46:22 +0300 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2022-10-04 00:02:49 +0300 |
commit | eff1f906c2dcd83ce7cbd38d2b853d2c49027f39 (patch) | |
tree | 286413a3293aefa04cfb836510bf9917c7c73591 /mm/shmem.c | |
parent | a7f5862cc0624ca6b21da5a634ff232dc65776b5 (diff) | |
download | linux-eff1f906c2dcd83ce7cbd38d2b853d2c49027f39.tar.xz |
shmem: convert shmem_write_begin() to use shmem_get_folio()
Use a folio throughout this function, saving a couple of calls to
compound_head().
Link: https://lkml.kernel.org/r/20220902194653.1739778-27-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/shmem.c')
-rw-r--r-- | mm/shmem.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 772a30593fcc..c69b53602a1d 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2498,6 +2498,7 @@ shmem_write_begin(struct file *file, struct address_space *mapping, struct inode *inode = mapping->host; struct shmem_inode_info *info = SHMEM_I(inode); pgoff_t index = pos >> PAGE_SHIFT; + struct folio *folio; int ret = 0; /* i_rwsem is held by caller */ @@ -2509,14 +2510,15 @@ shmem_write_begin(struct file *file, struct address_space *mapping, return -EPERM; } - ret = shmem_getpage(inode, index, pagep, SGP_WRITE); + ret = shmem_get_folio(inode, index, &folio, SGP_WRITE); if (ret) return ret; + *pagep = folio_file_page(folio, index); if (PageHWPoison(*pagep)) { - unlock_page(*pagep); - put_page(*pagep); + folio_unlock(folio); + folio_put(folio); *pagep = NULL; return -EIO; } |