diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2023-01-19 22:33:47 +0100 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2023-02-14 20:22:33 +0100 |
commit | 70e9db69f927bb378db9aaa807cc83ae550779a9 (patch) | |
tree | c24460dd4bc8463428905e679adbd19866ee2a5b /fs/nfs/pagelist.c | |
parent | NFS: Fix up nfs_vm_page_mkwrite() for folios (diff) | |
download | linux-70e9db69f927bb378db9aaa807cc83ae550779a9.tar.xz linux-70e9db69f927bb378db9aaa807cc83ae550779a9.zip |
NFS: Clean up O_DIRECT request allocation
Rather than adjusting the index+offset after the call to
nfs_create_request(), add a function nfs_page_create_from_page() that
takes an offset.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/pagelist.c')
-rw-r--r-- | fs/nfs/pagelist.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 7a622263a9fc..0b4c07c93a52 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -514,26 +514,29 @@ static void nfs_page_assign_page(struct nfs_page *req, struct page *page) } /** - * nfs_create_request - Create an NFS read/write request. + * nfs_page_create_from_page - Create an NFS read/write request. * @ctx: open context to use * @page: page to write - * @offset: starting offset within the page for the write + * @pgbase: starting offset within the page for the write + * @offset: file offset for the write * @count: number of bytes to read/write * * The page must be locked by the caller. This makes sure we never * create two different requests for the same page. * User should ensure it is safe to sleep in this function. */ -struct nfs_page * -nfs_create_request(struct nfs_open_context *ctx, struct page *page, - unsigned int offset, unsigned int count) +struct nfs_page *nfs_page_create_from_page(struct nfs_open_context *ctx, + struct page *page, + unsigned int pgbase, loff_t offset, + unsigned int count) { struct nfs_lock_context *l_ctx = nfs_get_lock_context(ctx); struct nfs_page *ret; if (IS_ERR(l_ctx)) return ERR_CAST(l_ctx); - ret = nfs_page_create(l_ctx, offset, page_index(page), offset, count); + ret = nfs_page_create(l_ctx, pgbase, offset >> PAGE_SHIFT, + offset_in_page(offset), count); if (!IS_ERR(ret)) { nfs_page_assign_page(ret, page); nfs_page_group_init(ret, NULL); |