mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
shmem: add shmem_get_folio()
With no remaining callers of shmem_getpage_gfp(), add shmem_get_folio() and reimplement shmem_getpage() as a call to shmem_get_folio(). Link: https://lkml.kernel.org/r/20220902194653.1739778-25-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
a3a9c39704
commit
4e1fc793ad
2 changed files with 12 additions and 13 deletions
|
@ -113,6 +113,8 @@ enum sgp_type {
|
||||||
|
|
||||||
extern int shmem_getpage(struct inode *inode, pgoff_t index,
|
extern int shmem_getpage(struct inode *inode, pgoff_t index,
|
||||||
struct page **pagep, enum sgp_type sgp);
|
struct page **pagep, enum sgp_type sgp);
|
||||||
|
int shmem_get_folio(struct inode *inode, pgoff_t index, struct folio **foliop,
|
||||||
|
enum sgp_type sgp);
|
||||||
|
|
||||||
static inline struct page *shmem_read_mapping_page(
|
static inline struct page *shmem_read_mapping_page(
|
||||||
struct address_space *mapping, pgoff_t index)
|
struct address_space *mapping, pgoff_t index)
|
||||||
|
|
23
mm/shmem.c
23
mm/shmem.c
|
@ -2025,14 +2025,18 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index,
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
|
int shmem_get_folio(struct inode *inode, pgoff_t index, struct folio **foliop,
|
||||||
struct page **pagep, enum sgp_type sgp,
|
enum sgp_type sgp)
|
||||||
gfp_t gfp, struct vm_area_struct *vma,
|
{
|
||||||
struct vm_fault *vmf, vm_fault_t *fault_type)
|
return shmem_get_folio_gfp(inode, index, foliop, sgp,
|
||||||
|
mapping_gfp_mask(inode->i_mapping), NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
int shmem_getpage(struct inode *inode, pgoff_t index,
|
||||||
|
struct page **pagep, enum sgp_type sgp)
|
||||||
{
|
{
|
||||||
struct folio *folio = NULL;
|
struct folio *folio = NULL;
|
||||||
int ret = shmem_get_folio_gfp(inode, index, &folio, sgp, gfp, vma,
|
int ret = shmem_get_folio(inode, index, &folio, sgp);
|
||||||
vmf, fault_type);
|
|
||||||
|
|
||||||
if (folio)
|
if (folio)
|
||||||
*pagep = folio_file_page(folio, index);
|
*pagep = folio_file_page(folio, index);
|
||||||
|
@ -2041,13 +2045,6 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int shmem_getpage(struct inode *inode, pgoff_t index,
|
|
||||||
struct page **pagep, enum sgp_type sgp)
|
|
||||||
{
|
|
||||||
return shmem_getpage_gfp(inode, index, pagep, sgp,
|
|
||||||
mapping_gfp_mask(inode->i_mapping), NULL, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is like autoremove_wake_function, but it removes the wait queue
|
* This is like autoremove_wake_function, but it removes the wait queue
|
||||||
* entry unconditionally - even if something else had already woken the
|
* entry unconditionally - even if something else had already woken the
|
||||||
|
|
Loading…
Reference in a new issue