diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2023-01-20 00:33:38 +0300 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2023-02-14 22:22:32 +0300 |
commit | 6dd85e83f3f182b56770f8bb6dbed1f0dafb9117 (patch) | |
tree | af799a6b2e3571bdc680206fb5a5135a79b75010 /include/linux/nfs_page.h | |
parent | 8e0bdc7021f713fdf3b985cda3ce715e41b06698 (diff) | |
download | linux-6dd85e83f3f182b56770f8bb6dbed1f0dafb9117.tar.xz |
NFS: Add a helper to convert a struct nfs_page into an inode
Replace all the open coded calls to page_file_mapping(req->wb_page)->host.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'include/linux/nfs_page.h')
-rw-r--r-- | include/linux/nfs_page.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index 192071a6e5f6..b0b03ec4a209 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h @@ -190,6 +190,19 @@ static inline struct page *nfs_page_to_page(const struct nfs_page *req, } /** + * nfs_page_to_inode - Retrieve an inode for the request + * @req: pointer to a struct nfs_page + */ +static inline struct inode *nfs_page_to_inode(const struct nfs_page *req) +{ + struct folio *folio = nfs_page_to_folio(req); + + if (folio == NULL) + return page_file_mapping(req->wb_page)->host; + return folio_file_mapping(folio)->host; +} + +/** * nfs_page_max_length - Retrieve the maximum possible length for a request * @req: pointer to a struct nfs_page * |