]> www.infradead.org Git - users/hch/misc.git/commitdiff
sunrpc: simplify xdr_init_encode_pages
authorChristoph Hellwig <hch@lst.de>
Sun, 16 Feb 2025 08:49:21 +0000 (09:49 +0100)
committerChristoph Hellwig <hch@lst.de>
Tue, 13 May 2025 08:20:20 +0000 (10:20 +0200)
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>
fs/nfsd/nfs3proc.c
fs/nfsd/nfsproc.c
include/linux/sunrpc/xdr.h
net/sunrpc/xdr.c

index 8902fae8c62d29ab80c5bf8bd79285531c639658..6c94042b03fa533b491ffee5234e8a5a4ce94c62 100644 (file)
@@ -562,7 +562,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 7c573d792252a608bdbe7fa8352d395d86e64dd6..f1c2c096804b3a85a6cc539aff879df3d366cd71 100644 (file)
@@ -577,7 +577,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 4e003cb516fe4c025474eedbd4374bfbe897cf6f..1ab973d3e324a48a6a98193db4163ddd5cb3f86e 100644 (file)
@@ -992,21 +992,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);