]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sunrpc: simplify xdr_init_encode_pages
authorChristoph Hellwig <hch@lst.de>
Thu, 15 May 2025 11:48:45 +0000 (13:48 +0200)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 14 Jul 2025 16:46:37 +0000 (12:46 -0400)
The rqst argument to xdr_init_encode_pages is set to NULL by all callers,
and pages is always set to buf->pages.  Remove the two arguments and
hardcode the assignments.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs3proc.c
fs/nfsd/nfsproc.c
include/linux/sunrpc/xdr.h
net/sunrpc/xdr.c

index a817d8485d2116417deb2cfe7117fe6249b24b4c..b6d03e1ef5f7a5e8dd111b0d56c061f1e91abff7 100644 (file)
@@ -561,7 +561,7 @@ static void nfsd3_init_dirlist_pages(struct svc_rqst *rqstp,
        buf->pages = rqstp->rq_next_page;
        rqstp->rq_next_page += (buf->buflen + PAGE_SIZE - 1) >> PAGE_SHIFT;
 
-       xdr_init_encode_pages(xdr, buf, buf->pages,  NULL);
+       xdr_init_encode_pages(xdr, buf);
 }
 
 /*
index c10fa8128a8adf4a1cefbc3c90181c296d5fcdfa..8f71f5748c75b69f15bae5e63799842e0e8b3139 100644 (file)
@@ -575,7 +575,7 @@ static void nfsd_init_dirlist_pages(struct svc_rqst *rqstp,
        buf->pages = rqstp->rq_next_page;
        rqstp->rq_next_page++;
 
-       xdr_init_encode_pages(xdr, buf, buf->pages,  NULL);
+       xdr_init_encode_pages(xdr, buf);
 }
 
 /*
index a2ab813a9800b83e75172f2b9afeadea9a955523..29d3a7659727dacc0f7cc2f4f18c589a524323c4 100644 (file)
@@ -242,8 +242,7 @@ typedef int (*kxdrdproc_t)(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
 
 extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf,
                            __be32 *p, struct rpc_rqst *rqst);
-extern void xdr_init_encode_pages(struct xdr_stream *xdr, struct xdr_buf *buf,
-                          struct page **pages, struct rpc_rqst *rqst);
+void xdr_init_encode_pages(struct xdr_stream *xdr, struct xdr_buf *buf);
 extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes);
 extern int xdr_reserve_space_vec(struct xdr_stream *xdr, size_t nbytes);
 extern void __xdr_commit_encode(struct xdr_stream *xdr);
index 2ea00e354ba64b82c0d47eed32f9a5828bcab96d..1346fdf338353d5e55ddb0b23065faa852c50fd8 100644 (file)
@@ -993,21 +993,18 @@ EXPORT_SYMBOL_GPL(xdr_init_encode);
  * xdr_init_encode_pages - Initialize an xdr_stream for encoding into pages
  * @xdr: pointer to xdr_stream struct
  * @buf: pointer to XDR buffer into which to encode data
- * @pages: list of pages to decode into
- * @rqst: pointer to controlling rpc_rqst, for debugging
  *
  */
-void xdr_init_encode_pages(struct xdr_stream *xdr, struct xdr_buf *buf,
-                          struct page **pages, struct rpc_rqst *rqst)
+void xdr_init_encode_pages(struct xdr_stream *xdr, struct xdr_buf *buf)
 {
        xdr_reset_scratch_buffer(xdr);
 
        xdr->buf = buf;
-       xdr->page_ptr = pages;
+       xdr->page_ptr = buf->pages;
        xdr->iov = NULL;
-       xdr->p = page_address(*pages);
+       xdr->p = page_address(*xdr->page_ptr);
        xdr->end = (void *)xdr->p + min_t(u32, buf->buflen, PAGE_SIZE);
-       xdr->rqst = rqst;
+       xdr->rqst = NULL;
 }
 EXPORT_SYMBOL_GPL(xdr_init_encode_pages);