[pnfs] Status meeting pNFS
Marc Eshel
eshel at almaden.ibm.com
Thu Aug 31 14:00:33 EDT 2006
So we agreed that the interface will for the xdr routines will include a
pointer and length going in and length or return code going out. We also
agreed that we will make the changes after the bakeathon if it is OK with
Benny.
Marc.
pnfs-bounces at linux-nfs.org wrote on 08/31/2006 08:38:27 AM:
>
> marc at almaden.ibm.com said:
> > Another alternative is to use *resp in the prototype and extract 'p'
in
> > the routine that we call. This would be cleaner allowing the routine
to
> > also update 'p' so the caller can tell where we are in the buffer
without
> > any extra parameter that return the length, and we can use the
returned
> > int for error code instead.
> >
> > Marc.
> bhalevy at panasas.com said:
> > I also like this approach better, especially since it allows using
> > semi-standard XDR macros RESERVE_SPACE, WRITE* or ADJUST_ARGS. If we
want to
> > provide a solution which is independent from xdr I think we should
also
> > provide a size_t parameter with the maximum allowed buffer size. the
> > declaration would look like layout_get(unsigned int **p, size_t
maxlength,
> > void *layout);
>
> i don't see any reason to pass in this whole structure. only 'p'
and'end' are
> used.
>
> struct nfsd4_compoundres {
> /* scratch variables for XDR encode */
> u32 * p;
> u32 * end;
> struct xdr_buf * xbuf;
> struct svc_rqst * rqstp;
>
> u32 taglen;
> char * tag;
> u32 opcnt;
> u32 * tagp; /* where to encode tag and
> opcount */
> };
>
> the WRITE* macro's work on 'p' so resp is not needed to use them.
>
>
> bhalevy at panasas.com said:
> > Currently the layout needs to be encoded in XDR by the file system
code
> > which means preceding the opaque layout with a 4 byte, XDR encoded
length.
> > If you want to keep the file system ignorant about XDR then the
> routing also
> > needs to return the length of whatever it encoded opaquely and the
nfsd
> > should "frame" the layout bits with XDR length and realign resp->p if
> > needed.
>
> it's not so much keeping the file system ignorant of the XDR as it is
keeping
> the nfs layer ignorant of the file system opaque layout. either way,
benny's
> suggestion will work.
>
> int layout_get(unsigned int **p, size_t maxbytes, void *layout);
>
> layout_get returns a positive length upon succes, or a negative error
code
> upon failure.
>
> and maxbytes = (resp->end - resp->p) << 2; always on a 4 byte boundary
>
> for layouts that want to do XDR, the macro RESERVE_SPACE(nbytes) becomes
> something like
>
> RESERVE_SPACE(nbutes, maxbytes)
> BUG_ON(XDR_QUADLEN(nbytes) > (maxbytes >> 2); \
>
> nfsd4_encode_layoutget then 'frames' the layout bytes with the
> returned length
> and realign resp->p.
>
>
> -->Andy
>
>
>
>
> _______________________________________________
> pNFS mailing list
> pNFS at linux-nfs.org
> http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs
More information about the pNFS
mailing list