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>
This commit is contained in:
Fred Isaman
2016-09-19 17:47:09 -04:00
committed by Trond Myklebust
parent 587f03deb6
commit dacb452db8
3 changed files with 17 additions and 14 deletions

View File

@@ -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);