pnfs: encode_layoutreturn
authorAndy Adamson <andros@netapp.com>
Sun, 22 May 2011 16:53:10 +0000 (19:53 +0300)
committerBoaz Harrosh <bharrosh@panasas.com>
Sun, 29 May 2011 17:54:37 +0000 (20:54 +0300)
Add a layout driver method to encode the layout type specific
opaque part of layout return in-line in the xdr stream.

Currently the pnfs-objects layout driver uses it to encode i/o error
information on LAYOUTRETURN.

Signed-off-by: Andy Adamson <andros@netapp.com>
[fixup layout header pointer for encode_layoutreturn]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
fs/nfs/nfs4xdr.c
fs/nfs/pnfs.h

index f2421206435697b0459caf328d4554204f5edfe1..d464badc00673057898db1bba7cb345ea20555bd 100644 (file)
@@ -1920,8 +1920,13 @@ encode_layoutreturn(struct xdr_stream *xdr,
        spin_lock(&args->inode->i_lock);
        xdr_encode_opaque_fixed(p, &args->stateid.data, NFS4_STATEID_SIZE);
        spin_unlock(&args->inode->i_lock);
-       p = reserve_space(xdr, 4);
-       *p = cpu_to_be32(0);
+       if (NFS_SERVER(args->inode)->pnfs_curr_ld->encode_layoutreturn) {
+               NFS_SERVER(args->inode)->pnfs_curr_ld->encode_layoutreturn(
+                       NFS_I(args->inode)->layout, xdr, args);
+       } else {
+               p = reserve_space(xdr, 4);
+               *p = cpu_to_be32(0);
+       }
        hdr->nops++;
        hdr->replen += decode_layoutreturn_maxsz;
 }
index af3967a893a1fc1b6fc95b63c53307692ee98b01..1b6b207a8806e0bcdfadb7fbdd91fe61e8c09f1b 100644 (file)
@@ -104,6 +104,10 @@ struct pnfs_layoutdriver_type {
        enum pnfs_try_status (*write_pagelist) (struct nfs_write_data *nfs_data, int how);
 
        void (*free_deviceid_node) (struct nfs4_deviceid_node *);
+
+       void (*encode_layoutreturn) (struct pnfs_layout_hdr *layoutid,
+                                    struct xdr_stream *xdr,
+                                    const struct nfs4_layoutreturn_args *args);
 };
 
 struct pnfs_layout_hdr {