Issue READIRPLUS calls with a sensible dircount maxcount ratio
authorStefan Blanke <stefan.blanke@framestore.com>
Thu, 30 Oct 2014 16:32:43 +0000 (16:32 +0000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 4 Nov 2014 01:23:17 +0000 (17:23 -0800)
The NFS spec states:

"The ratio of the directory entry size to the size of the attributes plus the
size of the file handle is usually at least 8 to 1."

Though implementation dependent the spec implies that the previous 1 to 1 ratio
could have a detrimental impact on the performance of the server due to most of
the data per VOP_READDIR call being wasted.

The Linux kernel uses the 8 to 1 ratio.

Signed-off-by: Stefan Blanke <stefan.blanke@framestore.com>
Signed-off-by: Mark Hills <mark.hills@framestore.com>
nfs/nfs.c

index 286ced0af314f6fcad52b95bc8961ed0fa5b7192..335c67bf395f709f7f197b016cd55aa86c91a048 100644 (file)
--- a/nfs/nfs.c
+++ b/nfs/nfs.c
@@ -697,7 +697,7 @@ int rpc_nfs_readdirplus_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3
        args.cookie = cookie;
        memcpy(&args.cookieverf, cookieverf, sizeof(cookieverf3)); 
        args.dircount = count;
        args.cookie = cookie;
        memcpy(&args.cookieverf, cookieverf, sizeof(cookieverf3)); 
        args.dircount = count;
-       args.maxcount = count;
+       args.maxcount = count * 8;
 
        return rpc_nfs3_readdirplus_async(rpc, cb, &args, private_data);
 }
 
        return rpc_nfs3_readdirplus_async(rpc, cb, &args, private_data);
 }