[PATCH] NFS3: Calculate 'w' a bit later in nfs3svc_encode_getaclres()
authorJesper Juhl <jesper.juhl@gmail.com>
Fri, 8 Dec 2006 10:39:40 +0000 (02:39 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Fri, 8 Dec 2006 16:29:02 +0000 (08:29 -0800)
NFS3: Calculate 'w' a bit later in nfs3svc_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
           1632     140       0    1772     6ec fs/nfsd/nfs3acl.o
      After:
           text    data     bss     dec     hex filename
           1624     140       0    1764     6e4 fs/nfsd/nfs3acl.o

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/nfsd/nfs3acl.c

index fcad289..3e3f2de 100644 (file)
@@ -171,19 +171,19 @@ static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
        p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh);
        if (resp->status == 0 && dentry && dentry->d_inode) {
                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;
 
                *p++ = htonl(resp->mask);
                if (!xdr_ressize_check(rqstp, 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;