From patchwork Sun May 22 16:53:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 806862 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4MGm6VB016609 for ; Sun, 22 May 2011 16:53:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752814Ab1EVQxc (ORCPT ); Sun, 22 May 2011 12:53:32 -0400 Received: from daytona.panasas.com ([67.152.220.89]:38934 "EHLO daytona.panasas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752279Ab1EVQxc (ORCPT ); Sun, 22 May 2011 12:53:32 -0400 Received: from fs2.bhalevy.com ([172.17.33.58]) by daytona.panasas.com with Microsoft SMTPSVC(6.0.3790.4675); Sun, 22 May 2011 12:53:31 -0400 From: Boaz Harrosh To: Benny Halevy , Trond Myklebust , NFS list , open-osd Cc: Andy Adamson Subject: [PATCH 20/23] pnfs: encode_layoutreturn Date: Sun, 22 May 2011 19:53:10 +0300 Message-Id: <1306083190-11170-1-git-send-email-bharrosh@panasas.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <4DD93D3E.9010909@panasas.com> References: <4DD93D3E.9010909@panasas.com> X-OriginalArrivalTime: 22 May 2011 16:53:31.0257 (UTC) FILETIME=[C7C8EE90:01CC18A0] 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 (demeter2.kernel.org [140.211.167.43]); Sun, 22 May 2011 16:53:33 +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 e53d7d8..29d33b3 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, &NFS_I(args->inode)->layout->plh_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 a54e715..798861c 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h @@ -106,6 +106,10 @@ struct pnfs_layoutdriver_type { /* device notification methods */ void (*delete_deviceid)(struct nfs4_deviceid *); + + void (*encode_layoutreturn) (struct pnfs_layout_hdr *layoutid, + struct xdr_stream *xdr, + const struct nfs4_layoutreturn_args *args); }; struct pnfs_layout_hdr {