From patchwork Mon May 23 16:38:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benny Halevy X-Patchwork-Id: 809502 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4NGcga0023457 for ; Mon, 23 May 2011 16:39:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756505Ab1EWQjF (ORCPT ); Mon, 23 May 2011 12:39:05 -0400 Received: from daytona.panasas.com ([67.152.220.89]:9176 "EHLO daytona.panasas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756474Ab1EWQjE (ORCPT ); Mon, 23 May 2011 12:39:04 -0400 Received: from lt.bhalevy.com.com ([172.17.33.44]) by daytona.panasas.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 23 May 2011 12:39:03 -0400 From: Benny Halevy To: Trond Myklebust Cc: linux-nfs@vger.kernel.org, Boaz Harrosh Subject: [PATCH v6 23/26] pnfs: encode_layoutreturn Date: Mon, 23 May 2011 19:38:58 +0300 Message-Id: <1306168738-11795-1-git-send-email-bhalevy@panasas.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <4DDA8C3D.5080706@panasas.com> References: <4DDA8C3D.5080706@panasas.com> X-OriginalArrivalTime: 23 May 2011 16:39:03.0892 (UTC) FILETIME=[ED354940:01CC1967] Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 23 May 2011 16:39:06 +0000 (UTC) From: Andy Adamson 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 [fixup layout header pointer for encode_layoutreturn] Signed-off-by: Benny Halevy --- fs/nfs/nfs4xdr.c | 9 +++++++-- fs/nfs/pnfs.h | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 882c8f9..ae580fa 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -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; } diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 2858553..ed07f41 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h @@ -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 {