Commit 0ae4c3e8 authored by Chuck Lever's avatar Chuck Lever
Browse files

SUNRPC: Add xdr_set_scratch_page() and xdr_reset_scratch_buffer()



Clean up: De-duplicate some frequently-used code.

Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 231307df
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -697,7 +697,7 @@ bl_alloc_lseg(struct pnfs_layout_hdr *lo, struct nfs4_layoutget_res *lgr,

	xdr_init_decode_pages(&xdr, &buf,
			lgr->layoutp->pages, lgr->layoutp->len);
	xdr_set_scratch_buffer(&xdr, page_address(scratch), PAGE_SIZE);
	xdr_set_scratch_page(&xdr, scratch);

	status = -EIO;
	p = xdr_inline_decode(&xdr, 4);
+1 −1
Original line number Diff line number Diff line
@@ -510,7 +510,7 @@ bl_alloc_deviceid_node(struct nfs_server *server, struct pnfs_device *pdev,
		goto out;

	xdr_init_decode_pages(&xdr, &buf, pdev->pages, pdev->pglen);
	xdr_set_scratch_buffer(&xdr, page_address(scratch), PAGE_SIZE);
	xdr_set_scratch_page(&xdr, scratch);

	p = xdr_inline_decode(&xdr, sizeof(__be32));
	if (!p)
+1 −1
Original line number Diff line number Diff line
@@ -576,7 +576,7 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en
		goto out_nopages;

	xdr_init_decode_pages(&stream, &buf, xdr_pages, buflen);
	xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE);
	xdr_set_scratch_page(&stream, scratch);

	do {
		if (entry->label)
+1 −1
Original line number Diff line number Diff line
@@ -666,7 +666,7 @@ filelayout_decode_layout(struct pnfs_layout_hdr *flo,
		return -ENOMEM;

	xdr_init_decode_pages(&stream, &buf, lgr->layoutp->pages, lgr->layoutp->len);
	xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE);
	xdr_set_scratch_page(&stream, scratch);

	/* 20 = ufl_util (4), first_stripe_index (4), pattern_offset (8),
	 * num_fh (4) */
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ nfs4_fl_alloc_deviceid_node(struct nfs_server *server, struct pnfs_device *pdev,
		goto out_err;

	xdr_init_decode_pages(&stream, &buf, pdev->pages, pdev->pglen);
	xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE);
	xdr_set_scratch_page(&stream, scratch);

	/* Get the stripe count (number of stripe index) */
	p = xdr_inline_decode(&stream, 4);
Loading