]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
NFSD: Optimize nfsd4_encode_operation()
authorChuck Lever <chuck.lever@oracle.com>
Fri, 22 Jul 2022 20:08:38 +0000 (16:08 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:19:11 +0000 (16:19 +0200)
[ Upstream commit 095a764b7afb06c9499b798c04eaa3cbf70ebe2d ]

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, and here, it is unnecessary because the
data item is fixed in size, the buffer destination address is
always word-aligned, and the destination location is already in
@p.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4xdr.c

index 07f891d7fa0aeda08435a9ebb77410b0c55b1878..9eba9afe13794577ace4c175f2ec9b455f61ca70 100644 (file)
@@ -5378,8 +5378,7 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
                                                so->so_replay.rp_buf, len);
        }
 status:
-       /* Note that op->status is already in network byte order: */
-       write_bytes_to_xdr_buf(xdr->buf, post_err_offset - 4, &op->status, 4);
+       *p = op->status;
 }
 
 /*