From patchwork Sun May 22 16:51:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 806792 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 p4MGm6V3016609 for ; Sun, 22 May 2011 16:51:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752713Ab1EVQv0 (ORCPT ); Sun, 22 May 2011 12:51:26 -0400 Received: from daytona.panasas.com ([67.152.220.89]:38871 "EHLO daytona.panasas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752279Ab1EVQv0 (ORCPT ); Sun, 22 May 2011 12:51:26 -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:51:25 -0400 From: Boaz Harrosh To: Benny Halevy , Trond Myklebust , NFS list , open-osd Cc: Benny Halevy Subject: [PATCH 13/23] pnfs: set/unset layoutdriver Date: Sun, 22 May 2011 19:51:07 +0300 Message-Id: <1306083067-10979-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:51:25.0584 (UTC) FILETIME=[7CE0C100: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:51:27 +0000 (UTC) From: Benny Halevy For managing per nfs_server layout driver data [was: pass mntfh down the init_pnfs path] Signed-off-by: Benny Halevy --- fs/nfs/pnfs.c | 13 ++++++++++++- fs/nfs/pnfs.h | 4 ++++ 2 files changed, 16 insertions(+), 1 deletions(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index dcf04ea..3ac7b82 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -75,8 +75,11 @@ find_pnfs_driver(u32 id) void unset_pnfs_layoutdriver(struct nfs_server *nfss) { - if (nfss->pnfs_curr_ld) + if (nfss->pnfs_curr_ld) { + if (nfss->pnfs_curr_ld->unset_layoutdriver) + nfss->pnfs_curr_ld->unset_layoutdriver(nfss); module_put(nfss->pnfs_curr_ld->owner); + } nfss->pnfs_curr_ld = NULL; } @@ -115,6 +118,14 @@ set_pnfs_layoutdriver(struct nfs_server *server, u32 id) } server->pnfs_curr_ld = ld_type; + if (ld_type->set_layoutdriver && + ld_type->set_layoutdriver(server)) { + dprintk("%s: Error initializing mount point for layout driver %u.\n", + __func__, id); + module_put(ld_type->owner); + goto out_no_driver; + } + dprintk("%s: pNFS module for %u set\n", __func__, id); return; diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 006314e..9d620de 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h @@ -71,6 +71,10 @@ struct pnfs_layoutdriver_type { const u32 id; const char *name; struct module *owner; + + int (*set_layoutdriver) (struct nfs_server *); + int (*unset_layoutdriver) (struct nfs_server *); + struct pnfs_layout_segment * (*alloc_lseg) (struct pnfs_layout_hdr *layoutid, struct nfs4_layoutget_res *lgr); void (*free_lseg) (struct pnfs_layout_segment *lseg);