Skip to contentSkip to conversation

Add helper routines for fixing up page alignment on xdr_buf

PATCH New Trond Myklebust 1 participant 1 message Dec 12, 2002

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add helper routines for fixing up page alignment on xdr_buf

In order to speed up NFS reads, we attempt to copy directly from skbuffs into the pagecache pages. As we cannot do XDR decoding in the soft interrupts, we attempt to estimate the size of the RPC header (+ attributes,...) that will precede the actual data that goes in the pagecache. If we get the estimate wrong, the XDR decode routines perform a realignment of the data into the pagecache.

In the existing code, we do a multi-page kmap() from the xdr_buf into an iovec array, in order to do the shift.

The following patch adds tools for doing the realigment without going through the iovec array (and without having to do the deadlock-prone multi-page kmap()).

It also adds the 2 helper routines xdr_read_pages()/xdr_write_pages() which will be needed for NFSv4 reads/writes in order to add pre/post operation GETATTR calls.

Cheers,
Trond

include/linux/sunrpc/xdr.h +4 -0
diff -u --recursive --new-file linux-2.5.51-02-nfsv4_xdr2/include/linux/sunrpc/xdr.h linux-2.5.51-03-xdr_shift/include/linux/sunrpc/xdr.h
@@ -211,6 +211,10 @@
 	return p;
 }
 
+extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages,
+		unsigned int base, unsigned int len);
+extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len);
+
 /*
  * Initialize an xdr_stream for decoding data.
  */
net/sunrpc/sunrpc_syms.c +2 -0
diff -u --recursive --new-file linux-2.5.51-02-nfsv4_xdr2/net/sunrpc/sunrpc_syms.c linux-2.5.51-03-xdr_shift/net/sunrpc/sunrpc_syms.c
@@ -120,6 +120,8 @@
 EXPORT_SYMBOL(xdr_encode_pages);
 EXPORT_SYMBOL(xdr_inline_pages);
 EXPORT_SYMBOL(xdr_shift_buf);
+EXPORT_SYMBOL(xdr_write_pages);
+EXPORT_SYMBOL(xdr_read_pages);
 
 /* Debugging symbols */
 #ifdef RPC_DEBUG
net/sunrpc/xdr.c +301 -7

321 lines not on this page · raw message

-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs