mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
NFSD: Optimize nfsd4_encode_fattr()
write_bytes_to_xdr_buf() is a generic way to place a variable-length data item in an already-reserved spot in the encoding buffer. However, it is costly. In nfsd4_encode_fattr(), it is unnecessary because the data item is fixed in size and the buffer destination address is always word-aligned. Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
095a764b7a
commit
ab04de60ae
1 changed files with 4 additions and 7 deletions
|
@ -2828,10 +2828,9 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
|
||||||
struct kstat stat;
|
struct kstat stat;
|
||||||
struct svc_fh *tempfh = NULL;
|
struct svc_fh *tempfh = NULL;
|
||||||
struct kstatfs statfs;
|
struct kstatfs statfs;
|
||||||
__be32 *p;
|
__be32 *p, *attrlen_p;
|
||||||
int starting_len = xdr->buf->len;
|
int starting_len = xdr->buf->len;
|
||||||
int attrlen_offset;
|
int attrlen_offset;
|
||||||
__be32 attrlen;
|
|
||||||
u32 dummy;
|
u32 dummy;
|
||||||
u64 dummy64;
|
u64 dummy64;
|
||||||
u32 rdattr_err = 0;
|
u32 rdattr_err = 0;
|
||||||
|
@ -2919,10 +2918,9 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
attrlen_offset = xdr->buf->len;
|
attrlen_offset = xdr->buf->len;
|
||||||
p = xdr_reserve_space(xdr, 4);
|
attrlen_p = xdr_reserve_space(xdr, XDR_UNIT);
|
||||||
if (!p)
|
if (!attrlen_p)
|
||||||
goto out_resource;
|
goto out_resource;
|
||||||
p++; /* to be backfilled later */
|
|
||||||
|
|
||||||
if (bmval0 & FATTR4_WORD0_SUPPORTED_ATTRS) {
|
if (bmval0 & FATTR4_WORD0_SUPPORTED_ATTRS) {
|
||||||
u32 supp[3];
|
u32 supp[3];
|
||||||
|
@ -3344,8 +3342,7 @@ out_acl:
|
||||||
*p++ = cpu_to_be32(err == 0);
|
*p++ = cpu_to_be32(err == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
attrlen = htonl(xdr->buf->len - attrlen_offset - 4);
|
*attrlen_p = cpu_to_be32(xdr->buf->len - attrlen_offset - XDR_UNIT);
|
||||||
write_bytes_to_xdr_buf(xdr->buf, attrlen_offset, &attrlen, 4);
|
|
||||||
status = nfs_ok;
|
status = nfs_ok;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
Loading…
Add table
Reference in a new issue