linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
To: linux-nfs@vger.kernel.org
Cc: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
Subject: [PATCH 2/2] pnfs-submit: Dynamically load the nfslayoutdriver
Date: Mon, 24 May 2010 10:37:03 -0700	[thread overview]
Message-ID: <1274722623-11078-2-git-send-email-Ricardo.Labiaga@netapp.com> (raw)
In-Reply-To: <1274722623-11078-1-git-send-email-Ricardo.Labiaga@netapp.com>

Load the files layout driver if the server indicates that it supports
LAYOUT4_NFSV4_1_FILES.  Other layouts can be loaded in a similar fashion.
The module can be blacklisted to disable pNFS support for the corresponding
layout type.

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
---
 fs/nfs/pnfs.c |   17 +++++++++++++++--
 fs/nfs/pnfs.h |    2 ++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 57d3ff0..6a89279 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -205,12 +205,24 @@ unmount_pnfs_layoutdriver(struct nfs_server *nfss)
 void
 set_pnfs_layoutdriver(struct nfs_server *server, u32 id)
 {
-	struct pnfs_module *mod;
+	struct pnfs_module *mod = NULL;
 
 	if (server->pnfs_curr_ld)
 		return;
 
-	if (id > 0 && find_pnfs(id, &mod)) {
+	if (!find_pnfs(id, &mod)) {
+		switch (id) {
+		case LAYOUT_NFSV4_1_FILES:
+			request_module(LAYOUT_NFSV4_1_FILES_MODULE);
+			break;
+		default:
+			goto out_not_found;
+		};
+
+		find_pnfs(id, &mod);
+	}
+
+	if (mod) {
 		if (mod->pnfs_ld_type->ld_io_ops->initialize_mountpoint(
 			server->nfs_client)) {
 			printk(KERN_ERR "%s: Error initializing mount point "
@@ -227,6 +239,7 @@ set_pnfs_layoutdriver(struct nfs_server *server, u32 id)
 		return;
 	}
 
+out_not_found:
 	dprintk("%s: No pNFS module found for %u. ", __func__, id);
 out_err:
 	dprintk("Using NFSv4 I/O\n");
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index b80157b..dac955e 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -80,6 +80,8 @@ void _pnfs_direct_init_io(struct inode *inode, struct nfs_open_context *ctx,
 				     (srv)->pnfs_curr_ld->ld_policy_ops && \
 				     (srv)->pnfs_curr_ld->ld_policy_ops->opname)
 
+#define LAYOUT_NFSV4_1_FILES_MODULE "nfslayoutdriver"
+
 static inline int lo_fail_bit(u32 iomode)
 {
 	return iomode == IOMODE_RW ?
-- 
1.5.4.3


  reply	other threads:[~2010-05-24 17:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-24 17:37 [PATCH 1/2] SQUASHME: pnfs-submit: Use LAYOUT_NFSV4_1_FILES instead of LAYOUT_NFSV4_FILES Ricardo Labiaga
2010-05-24 17:37 ` Ricardo Labiaga [this message]
2010-05-25  6:55   ` [PATCH 2/2] pnfs-submit: Dynamically load the nfslayoutdriver Benny Halevy
2010-05-25  5:56 ` [PATCH 1/3] SQUASHME: pnfsd: dlm: fixup LAYOUT_NFSV4_1_FILES Benny Halevy
2010-05-25  5:56 ` [PATCH 2/3] SQUASHME: pnfsd-lexp: " Benny Halevy
2010-05-25  5:56 ` [PATCH 3/3] SQUASHME: spnfs: " Benny Halevy
2010-05-25 11:20   ` Boaz Harrosh
2010-05-25 14:44     ` Benny Halevy
2010-05-25  6:55 ` [PATCH 1/2] SQUASHME: pnfs-submit: Use LAYOUT_NFSV4_1_FILES instead of LAYOUT_NFSV4_FILES Benny Halevy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1274722623-11078-2-git-send-email-Ricardo.Labiaga@netapp.com \
    --to=ricardo.labiaga@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).