[pnfs] [0/13] Use iterator in device export ops
seattleplus at gmail.com
seattleplus at gmail.com
Thu Jan 10 16:38:51 EST 2008
At bakeathon 2007 in AA we talked reducing the number of
export ops and data copies it requires to retrieve device information.
The current ops retrieve the device, encode it, and them free it,
which is quite cumbersome and requires extra data copies. We noticed
that readdir only has a single vfs op, so why can't we do something
similar. In addition, nfs readdir only calls this vfs op at xdr time,
not in nfs4proc.
To that end, Benny suggested moving to an iterator concept. The main
goals of this plan is to:
a) Reduce the number of export ops
b) Copy device information only once (onto the xdr buffer).
The current 4 export ops are replaced with 2 export ops. These two
ops satisfy both getdeviceinfo and getdevicelist.
1. get_device_iter - An iterator function which NFSD keeps calling until it has retrieved
all device ids. (using cookies, etc as an index)
2. get_device_info - An function to encode a specific device id.
Note: New argument structs as well.
On the server, GETDEVICEINFO will perform a subset of GETDEVICELIST:
For GETDEVICEINFO:
1. Call get_device_info with the args from the client. This
will encode the device info for the supplied device id onto the output stream.
For GETDEVICELIST:
1. Call get_device_iter with the cookie and verifier from either the client
or from the previous invocation of get_device_iter.
2. Call get_device_info with the device id returned by get_device_iter
3. Repeat steps 1 and 2 until EOF is reached.
Note on encoding the device
============================
get_device_info takes a function pointer pnfs_encodedev_t as an argument.
This argument allows NFSD to supply a function to encode the device, instead
of having the file system do the encoding. The file system takes the
pnfs_encodedev_t argument and uses it to encode its devices.
This is only useful for layout types which exist in the kernel,
i.e., only file layout for now, object andblock will set this
function pointer to NULL. In the future, when object or block
is in the kernel, they can use this function to move
device encoding into the common nfsd code.
Additional Notes
================
1-I put checking the maxcount parameter in separate patches since
they kind of muddle the logic a bit.
2-The first patch is a simple fix
3-The second patch is for debugging
4-The 0013 patch modifies the pnfs client code
This all applies against the andros-pnfs-read branch (but all patches except the last
are against the server anyways)
Dean
More information about the pNFS
mailing list