Commit 4e2f6bfe authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] PATCH 14/16: NFSD: TCP: Declare max response sizes for NFS and NLM

Declare response sizes for nfs/lockd requests

This allows sndbuf reservation to be more accurate.

For lockd we just say "0" for now, meaning assume the max.
This could be improved, but it isn't critical.
parent a87d7392
......@@ -524,7 +524,7 @@ nlm4svc_callback_exit(struct rpc_task *task)
struct nlm_void { int dummy; };
#define PROC(name, xargt, xrest, argt, rest) \
#define PROC(name, xargt, xrest, argt, rest, respsize) \
{ (svc_procfunc) nlm4svc_proc_##name, \
(kxdrproc_t) nlm4svc_decode_##xargt, \
(kxdrproc_t) nlm4svc_encode_##xrest, \
......@@ -532,33 +532,34 @@ struct nlm_void { int dummy; };
sizeof(struct nlm_##argt), \
sizeof(struct nlm_##rest), \
0, \
0 \
0, \
respsize, \
}
struct svc_procedure nlmsvc_procedures4[] = {
PROC(null, void, void, void, void),
PROC(test, testargs, testres, args, res),
PROC(lock, lockargs, res, args, res),
PROC(cancel, cancargs, res, args, res),
PROC(unlock, unlockargs, res, args, res),
PROC(granted, testargs, res, args, res),
PROC(test_msg, testargs, norep, args, void),
PROC(lock_msg, lockargs, norep, args, void),
PROC(cancel_msg, cancargs, norep, args, void),
PROC(unlock_msg, unlockargs, norep, args, void),
PROC(granted_msg, testargs, norep, args, void),
PROC(test_res, testres, norep, res, void),
PROC(lock_res, lockres, norep, res, void),
PROC(cancel_res, cancelres, norep, res, void),
PROC(unlock_res, unlockres, norep, res, void),
PROC(granted_res, grantedres, norep, res, void),
PROC(null, void, void, void, void, 0),
PROC(test, testargs, testres, args, res, 0),
PROC(lock, lockargs, res, args, res, 0),
PROC(cancel, cancargs, res, args, res, 0),
PROC(unlock, unlockargs, res, args, res, 0),
PROC(granted, testargs, res, args, res, 0),
PROC(test_msg, testargs, norep, args, void, 0),
PROC(lock_msg, lockargs, norep, args, void, 0),
PROC(cancel_msg, cancargs, norep, args, void, 0),
PROC(unlock_msg, unlockargs, norep, args, void, 0),
PROC(granted_msg, testargs, norep, args, void, 0),
PROC(test_res, testres, norep, res, void, 0),
PROC(lock_res, lockres, norep, res, void, 0),
PROC(cancel_res, cancelres, norep, res, void, 0),
PROC(unlock_res, unlockres, norep, res, void, 0),
PROC(granted_res, grantedres, norep, res, void, 0),
/* statd callback */
PROC(sm_notify, reboot, void, reboot, void),
PROC(none, void, void, void, void),
PROC(none, void, void, void, void),
PROC(none, void, void, void, void),
PROC(share, shareargs, shareres, args, res),
PROC(unshare, shareargs, shareres, args, res),
PROC(nm_lock, lockargs, res, args, res),
PROC(free_all, notify, void, args, void),
PROC(sm_notify, reboot, void, reboot, void, 0),
PROC(none, void, void, void, void, 0),
PROC(none, void, void, void, void, 0),
PROC(none, void, void, void, void, 0),
PROC(share, shareargs, shareres, args, res, 0),
PROC(unshare, shareargs, shareres, args, res, 0),
PROC(nm_lock, lockargs, res, args, res, 0),
PROC(free_all, notify, void, args, void, 0),
};
......@@ -552,7 +552,7 @@ nlmsvc_callback_exit(struct rpc_task *task)
struct nlm_void { int dummy; };
#define PROC(name, xargt, xrest, argt, rest) \
#define PROC(name, xargt, xrest, argt, rest, respsize) \
{ (svc_procfunc) nlmsvc_proc_##name, \
(kxdrproc_t) nlmsvc_decode_##xargt, \
(kxdrproc_t) nlmsvc_encode_##xrest, \
......@@ -560,33 +560,34 @@ struct nlm_void { int dummy; };
sizeof(struct nlm_##argt), \
sizeof(struct nlm_##rest), \
0, \
0 \
0, \
respsize, \
}
struct svc_procedure nlmsvc_procedures[] = {
PROC(null, void, void, void, void),
PROC(test, testargs, testres, args, res),
PROC(lock, lockargs, res, args, res),
PROC(cancel, cancargs, res, args, res),
PROC(unlock, unlockargs, res, args, res),
PROC(granted, testargs, res, args, res),
PROC(test_msg, testargs, norep, args, void),
PROC(lock_msg, lockargs, norep, args, void),
PROC(cancel_msg, cancargs, norep, args, void),
PROC(unlock_msg, unlockargs, norep, args, void),
PROC(granted_msg, testargs, norep, args, void),
PROC(test_res, testres, norep, res, void),
PROC(lock_res, lockres, norep, res, void),
PROC(cancel_res, cancelres, norep, res, void),
PROC(unlock_res, unlockres, norep, res, void),
PROC(granted_res, grantedres, norep, res, void),
PROC(null, void, void, void, void, 0),
PROC(test, testargs, testres, args, res, 0),
PROC(lock, lockargs, res, args, res, 0),
PROC(cancel, cancargs, res, args, res, 0),
PROC(unlock, unlockargs, res, args, res, 0),
PROC(granted, testargs, res, args, res, 0),
PROC(test_msg, testargs, norep, args, void, 0),
PROC(lock_msg, lockargs, norep, args, void, 0),
PROC(cancel_msg, cancargs, norep, args, void, 0),
PROC(unlock_msg, unlockargs, norep, args, void, 0),
PROC(granted_msg, testargs, norep, args, void, 0),
PROC(test_res, testres, norep, res, void, 0),
PROC(lock_res, lockres, norep, res, void, 0),
PROC(cancel_res, cancelres, norep, res, void, 0),
PROC(unlock_res, unlockres, norep, res, void, 0),
PROC(granted_res, grantedres, norep, res, void, 0),
/* statd callback */
PROC(sm_notify, reboot, void, reboot, void),
PROC(none, void, void, void, void),
PROC(none, void, void, void, void),
PROC(none, void, void, void, void),
PROC(share, shareargs, shareres, args, res),
PROC(unshare, shareargs, shareres, args, res),
PROC(nm_lock, lockargs, res, args, res),
PROC(free_all, notify, void, args, void),
PROC(sm_notify, reboot, void, reboot, void, 0),
PROC(none, void, void, void, void, 0),
PROC(none, void, void, void, void, 0),
PROC(none, void, void, void, void, 0),
PROC(share, shareargs, shareres, args, res, 0),
PROC(unshare, shareargs, shareres, args, res, 0),
PROC(nm_lock, lockargs, res, args, res, 0),
PROC(free_all, notify, void, args, void, 0),
};
......@@ -183,11 +183,12 @@ nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
*/
svcbuf_reserve(&rqstp->rq_resbuf, &buffer, &avail,
1 + NFS3_POST_OP_ATTR_WORDS + 3);
resp->count = argp->count;
if ((avail << 2) < resp->count)
resp->count = avail << 2;
svc_reserve(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + argp->count +4);
fh_copy(&resp->fh, &argp->fh);
nfserr = nfsd_read(rqstp, &resp->fh,
argp->offset,
......@@ -646,7 +647,7 @@ nfsd3_proc_commit(struct svc_rqst * rqstp, struct nfsd3_commitargs *argp,
#define nfsd3_voidres nfsd3_voidargs
struct nfsd3_voidargs { int dummy; };
#define PROC(name, argt, rest, relt, cache) \
#define PROC(name, argt, rest, relt, cache, respsize) \
{ (svc_procfunc) nfsd3_proc_##name, \
(kxdrproc_t) nfs3svc_decode_##argt##args, \
(kxdrproc_t) nfs3svc_encode_##rest##res, \
......@@ -654,29 +655,30 @@ struct nfsd3_voidargs { int dummy; };
sizeof(struct nfsd3_##argt##args), \
sizeof(struct nfsd3_##rest##res), \
0, \
cache \
cache, \
respsize, \
}
struct svc_procedure nfsd_procedures3[22] = {
PROC(null, void, void, void, RC_NOCACHE),
PROC(getattr, fhandle, attrstat, fhandle, RC_NOCACHE),
PROC(setattr, sattr, wccstat, fhandle, RC_REPLBUFF),
PROC(lookup, dirop, dirop, fhandle2, RC_NOCACHE),
PROC(access, access, access, fhandle, RC_NOCACHE),
PROC(readlink, fhandle, readlink, fhandle, RC_NOCACHE),
PROC(read, read, read, fhandle, RC_NOCACHE),
PROC(write, write, write, fhandle, RC_REPLBUFF),
PROC(create, create, create, fhandle2, RC_REPLBUFF),
PROC(mkdir, mkdir, create, fhandle2, RC_REPLBUFF),
PROC(symlink, symlink, create, fhandle2, RC_REPLBUFF),
PROC(mknod, mknod, create, fhandle2, RC_REPLBUFF),
PROC(remove, dirop, wccstat, fhandle, RC_REPLBUFF),
PROC(rmdir, dirop, wccstat, fhandle, RC_REPLBUFF),
PROC(rename, rename, rename, fhandle2, RC_REPLBUFF),
PROC(link, link, link, fhandle2, RC_REPLBUFF),
PROC(readdir, readdir, readdir, fhandle, RC_NOCACHE),
PROC(readdirplus,readdirplus, readdir, fhandle, RC_NOCACHE),
PROC(fsstat, fhandle, fsstat, void, RC_NOCACHE),
PROC(fsinfo, fhandle, fsinfo, void, RC_NOCACHE),
PROC(pathconf, fhandle, pathconf, void, RC_NOCACHE),
PROC(commit, commit, commit, fhandle, RC_NOCACHE)
PROC(null, void, void, void, RC_NOCACHE, 1),
PROC(getattr, fhandle, attrstat, fhandle, RC_NOCACHE, 1+21),
PROC(setattr, sattr, wccstat, fhandle, RC_REPLBUFF, 1+7+22),
PROC(lookup, dirop, dirop, fhandle2, RC_NOCACHE, 1+9+22+22),
PROC(access, access, access, fhandle, RC_NOCACHE, 1+22+1),
PROC(readlink, fhandle, readlink, fhandle, RC_NOCACHE, 1+22+1+256),
PROC(read, read, read, fhandle, RC_NOCACHE, 1+22+4+NFSSVC_MAXBLKSIZE),
PROC(write, write, write, fhandle, RC_REPLBUFF, 1+7+22+4),
PROC(create, create, create, fhandle2, RC_REPLBUFF, 1+(1+9+22)+7+22),
PROC(mkdir, mkdir, create, fhandle2, RC_REPLBUFF, 1+(1+9+22)+7+22),
PROC(symlink, symlink, create, fhandle2, RC_REPLBUFF, 1+(1+9+22)+7+22),
PROC(mknod, mknod, create, fhandle2, RC_REPLBUFF, 1+(1+9+22)+7+22),
PROC(remove, dirop, wccstat, fhandle, RC_REPLBUFF, 1+7+22),
PROC(rmdir, dirop, wccstat, fhandle, RC_REPLBUFF, 1+7+22),
PROC(rename, rename, rename, fhandle2, RC_REPLBUFF, 1+7+22+7+22),
PROC(link, link, link, fhandle2, RC_REPLBUFF, 1+22+7+22),
PROC(readdir, readdir, readdir, fhandle, RC_NOCACHE, 0),
PROC(readdirplus,readdirplus, readdir, fhandle, RC_NOCACHE, 0),
PROC(fsstat, fhandle, fsstat, void, RC_NOCACHE, 1+14),
PROC(fsinfo, fhandle, fsinfo, void, RC_NOCACHE, 1+13),
PROC(pathconf, fhandle, pathconf, void, RC_NOCACHE, 1+6),
PROC(commit, commit, commit, fhandle, RC_NOCACHE, 1+7+22+2),
};
......@@ -148,6 +148,7 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp,
argp->count);
argp->count = avail << 2;
}
svc_reserve(rqstp, (19<<2) + argp->count + 4);
resp->count = argp->count;
nfserr = nfsd_read(rqstp, fh_copy(&resp->fh, &argp->fh),
......@@ -522,7 +523,7 @@ nfsd_proc_statfs(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
#define nfssvc_release_none NULL
struct nfsd_void { int dummy; };
#define PROC(name, argt, rest, relt, cache) \
#define PROC(name, argt, rest, relt, cache, respsize) \
{ (svc_procfunc) nfsd_proc_##name, \
(kxdrproc_t) nfssvc_decode_##argt, \
(kxdrproc_t) nfssvc_encode_##rest, \
......@@ -530,27 +531,28 @@ struct nfsd_void { int dummy; };
sizeof(struct nfsd_##argt), \
sizeof(struct nfsd_##rest), \
0, \
cache \
cache, \
respsize, \
}
struct svc_procedure nfsd_procedures2[18] = {
PROC(null, void, void, none, RC_NOCACHE),
PROC(getattr, fhandle, attrstat, fhandle, RC_NOCACHE),
PROC(setattr, sattrargs, attrstat, fhandle, RC_REPLBUFF),
PROC(none, void, void, none, RC_NOCACHE),
PROC(lookup, diropargs, diropres, fhandle, RC_NOCACHE),
PROC(readlink, fhandle, readlinkres, none, RC_NOCACHE),
PROC(read, readargs, readres, fhandle, RC_NOCACHE),
PROC(none, void, void, none, RC_NOCACHE),
PROC(write, writeargs, attrstat, fhandle, RC_REPLBUFF),
PROC(create, createargs, diropres, fhandle, RC_REPLBUFF),
PROC(remove, diropargs, void, none, RC_REPLSTAT),
PROC(rename, renameargs, void, none, RC_REPLSTAT),
PROC(link, linkargs, void, none, RC_REPLSTAT),
PROC(symlink, symlinkargs, void, none, RC_REPLSTAT),
PROC(mkdir, createargs, diropres, fhandle, RC_REPLBUFF),
PROC(rmdir, diropargs, void, none, RC_REPLSTAT),
PROC(readdir, readdirargs, readdirres, none, RC_REPLBUFF),
PROC(statfs, fhandle, statfsres, none, RC_NOCACHE),
PROC(null, void, void, none, RC_NOCACHE, 1),
PROC(getattr, fhandle, attrstat, fhandle, RC_NOCACHE, 1+18),
PROC(setattr, sattrargs, attrstat, fhandle, RC_REPLBUFF, 1+18),
PROC(none, void, void, none, RC_NOCACHE, 1),
PROC(lookup, diropargs, diropres, fhandle, RC_NOCACHE, 1+8+18),
PROC(readlink, fhandle, readlinkres, none, RC_NOCACHE, 1+1+256),
PROC(read, readargs, readres, fhandle, RC_NOCACHE, 1+18+1+NFSSVC_MAXBLKSIZE),
PROC(none, void, void, none, RC_NOCACHE, 1),
PROC(write, writeargs, attrstat, fhandle, RC_REPLBUFF, 1+18),
PROC(create, createargs, diropres, fhandle, RC_REPLBUFF, 1+8+18),
PROC(remove, diropargs, void, none, RC_REPLSTAT, 1),
PROC(rename, renameargs, void, none, RC_REPLSTAT, 1),
PROC(link, linkargs, void, none, RC_REPLSTAT, 1),
PROC(symlink, symlinkargs, void, none, RC_REPLSTAT, 1),
PROC(mkdir, createargs, diropres, fhandle, RC_REPLBUFF, 1+8+18),
PROC(rmdir, diropargs, void, none, RC_REPLSTAT, 1),
PROC(readdir, readdirargs, readdirres, none, RC_REPLBUFF, 0),
PROC(statfs, fhandle, statfsres, none, RC_NOCACHE, 1+5),
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment