|
@@ -991,6 +991,7 @@ pnfs_alloc_init_layoutget_args(struct inode *ino,
|
|
|
gfp_t gfp_flags)
|
|
|
{
|
|
|
struct nfs_server *server = pnfs_find_server(ino, ctx);
|
|
|
+ size_t max_reply_sz = server->pnfs_curr_ld->max_layoutget_response;
|
|
|
size_t max_pages = max_response_pages(server);
|
|
|
struct nfs4_layoutget *lgp;
|
|
|
|
|
@@ -1000,6 +1001,12 @@ pnfs_alloc_init_layoutget_args(struct inode *ino,
|
|
|
if (lgp == NULL)
|
|
|
return NULL;
|
|
|
|
|
|
+ if (max_reply_sz) {
|
|
|
+ size_t npages = (max_reply_sz + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
|
|
+ if (npages < max_pages)
|
|
|
+ max_pages = npages;
|
|
|
+ }
|
|
|
+
|
|
|
lgp->args.layout.pages = nfs4_alloc_pages(max_pages, gfp_flags);
|
|
|
if (!lgp->args.layout.pages) {
|
|
|
kfree(lgp);
|