diff options
author | Fred Isaman <fred.isaman@gmail.com> | 2016-09-19 17:47:09 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2018-05-31 15:03:11 -0400 |
commit | dacb452db8733474c0317d499244c3c1ac769ef5 (patch) | |
tree | affde185d492268cfbfeaed2034502f2f275a324 /fs/nfs/pnfs.c | |
parent | 587f03deb69bdbf2c8f5f06c5cdcebb42196faff (diff) |
pnfs: move allocations out of nfs4_proc_layoutget
They work better in the new alloc_init function.
Signed-off-by: Fred Isaman <fred.isaman@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r-- | fs/nfs/pnfs.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 2c955c389ecf..363420d0f3a0 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -924,6 +924,7 @@ pnfs_alloc_init_layoutget_args(struct pnfs_layout_hdr *lo, { struct inode *ino = lo->plh_inode; struct nfs_server *server = NFS_SERVER(ino); + size_t max_pages = max_response_pages(server); struct nfs4_layoutget *lgp; loff_t i_size; @@ -933,6 +934,15 @@ pnfs_alloc_init_layoutget_args(struct pnfs_layout_hdr *lo, if (lgp == NULL) return NULL; + lgp->args.layout.pages = nfs4_alloc_pages(max_pages, gfp_flags); + if (!lgp->args.layout.pages) { + kfree(lgp); + return NULL; + } + lgp->args.layout.pglen = max_pages * PAGE_SIZE; + lgp->res.layoutp = &lgp->args.layout; + + i_size = i_size_read(ino); lgp->args.minlength = PAGE_SIZE; @@ -1835,7 +1845,7 @@ lookup_again: goto out_put_layout_hdr; } - lseg = nfs4_proc_layoutget(lgp, &timeout, gfp_flags); + lseg = nfs4_proc_layoutget(lgp, &timeout); trace_pnfs_update_layout(ino, pos, count, iomode, lo, lseg, PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET); atomic_dec(&lo->plh_outstanding); |