From: Jesper Juhl Date: Fri, 8 Dec 2006 10:39:39 +0000 (-0800) Subject: [PATCH] NFS2: Calculate 'w' a bit later in nfsaclsvc_encode_getaclres() X-Git-Tag: v2.6.20-rc1~34^2~139 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=cb65a5ba3dcef3184ef1ba026b1e268bd1a9323f;p=linux-2.6-omap-h63xx.git [PATCH] NFS2: Calculate 'w' a bit later in nfsaclsvc_encode_getaclres() NFS2: Calculate 'w' a bit later in nfsaclsvc_encode_getaclres() This is a small performance optimization since we can return before needing 'w'. It also saves a few bytes of .text : Before: text data bss dec hex filename 2406 212 0 2618 a3a fs/nfsd/nfs2acl.o After: text data bss dec hex filename 2400 212 0 2612 a34 fs/nfsd/nfs2acl.o Signed-off-by: Jesper Juhl Cc: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c index e3eca081698..edde5dc5f79 100644 --- a/fs/nfsd/nfs2acl.c +++ b/fs/nfsd/nfs2acl.c @@ -222,12 +222,10 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, { struct dentry *dentry = resp->fh.fh_dentry; struct inode *inode = dentry->d_inode; - int w = nfsacl_size( - (resp->mask & NFS_ACL) ? resp->acl_access : NULL, - (resp->mask & NFS_DFACL) ? resp->acl_default : NULL); struct kvec *head = rqstp->rq_res.head; unsigned int base; int n; + int w; if (dentry == NULL || dentry->d_inode == NULL) return 0; @@ -239,7 +237,9 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, return 0; base = (char *)p - (char *)head->iov_base; - rqstp->rq_res.page_len = w; + rqstp->rq_res.page_len = w = nfsacl_size( + (resp->mask & NFS_ACL) ? resp->acl_access : NULL, + (resp->mask & NFS_DFACL) ? resp->acl_default : NULL); while (w > 0) { if (!rqstp->rq_respages[rqstp->rq_resused++]) return 0;