Skip to content

Commit 04a5554

Browse files
androsadamsonBoaz Harrosh
authored andcommitted
pnfs: encode_layoutreturn
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>
1 parent 8a1636c commit 04a5554

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎fs/nfs/nfs4xdr.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,8 +1920,13 @@ encode_layoutreturn(struct xdr_stream *xdr,
19201920
spin_lock(&args->inode->i_lock);
19211921
xdr_encode_opaque_fixed(p, &args->stateid.data, NFS4_STATEID_SIZE);
19221922
spin_unlock(&args->inode->i_lock);
1923-
p = reserve_space(xdr, 4);
1924-
*p = cpu_to_be32(0);
1923+
if (NFS_SERVER(args->inode)->pnfs_curr_ld->encode_layoutreturn) {
1924+
NFS_SERVER(args->inode)->pnfs_curr_ld->encode_layoutreturn(
1925+
NFS_I(args->inode)->layout, xdr, args);
1926+
} else {
1927+
p = reserve_space(xdr, 4);
1928+
*p = cpu_to_be32(0);
1929+
}
19251930
hdr->nops++;
19261931
hdr->replen += decode_layoutreturn_maxsz;
19271932
}

‎fs/nfs/pnfs.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ struct pnfs_layoutdriver_type {
104104
enum pnfs_try_status (*write_pagelist) (struct nfs_write_data *nfs_data, int how);
105105

106106
void (*free_deviceid_node) (struct nfs4_deviceid_node *);
107+
108+
void (*encode_layoutreturn) (struct pnfs_layout_hdr *layoutid,
109+
struct xdr_stream *xdr,
110+
const struct nfs4_layoutreturn_args *args);
107111
};
108112

109113
struct pnfs_layout_hdr {

0 commit comments

Comments
 (0)