All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
To: bhalevy@panasas.com
Cc: linux-nfs@vger.kernel.org, Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
Subject: [PATCH] SQUASHME: pnfs-submit: Use generic layout name to load layout modules
Date: Mon, 26 Jul 2010 18:10:18 -0700	[thread overview]
Message-ID: <1280193018-1628-1-git-send-email-Ricardo.Labiaga@netapp.com> (raw)
In-Reply-To: <>

Future NFSv4.x work will add several new layout types.  Use
nfs-layouttype4-<number> in request_module() to allow current and future
layout types to be loaded without requiring changes to the module loading
code.

The kernel issues request_module(nfs4-layouttype4-<number>) which is
then mapped to the actual module name in the modprobe aliases file.
Something like:
   alias nfs-layouttype4-1 nfs_layout_nfsv41_files
   alias nfs-layouttype4-2 nfs_layout_osd2_objects

It can be turned off by commenting out the alias, or specifying it off.
For example:
   alias nfs-layouttype4-3 off

The module can still be loaded by hand using modprobe.

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

diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile
index 6c218e7..4776ff9 100644
--- a/fs/nfs/Makefile
+++ b/fs/nfs/Makefile
@@ -19,5 +19,5 @@ nfs-$(CONFIG_NFS_V4_1)	+= pnfs.o
 nfs-$(CONFIG_SYSCTL) += sysctl.o
 nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o
 
-obj-$(CONFIG_PNFS_FILE_LAYOUT) += nfslayoutdriver.o
-nfslayoutdriver-y := nfs4filelayout.o nfs4filelayoutdev.o
+obj-$(CONFIG_PNFS_FILE_LAYOUT) += nfs_layout_nfsv41_files.o
+nfs_layout_nfsv41_files-y := nfs4filelayout.o nfs4filelayoutdev.o
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 3494d5e..b2fb693 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -210,14 +210,7 @@ set_pnfs_layoutdriver(struct nfs_server *server, u32 id)
 		return;
 
 	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;
-		};
-
+		request_module("%s-%u", LAYOUT_NFSV4_1_MODULE_PREFIX, id);
 		find_pnfs(id, &mod);
 	}
 
@@ -233,7 +226,6 @@ 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 6bc27af..f48ef24 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -73,7 +73,7 @@ void put_layout(struct inode *inode);
 				     (srv)->pnfs_curr_ld->ld_policy_ops && \
 				     (srv)->pnfs_curr_ld->ld_policy_ops->opname)
 
-#define LAYOUT_NFSV4_1_FILES_MODULE "nfslayoutdriver"
+#define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4"
 
 static inline int lo_fail_bit(u32 iomode)
 {
-- 
1.5.4.3


             reply	other threads:[~2010-07-27  1:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-27  1:10 Ricardo Labiaga [this message]
2010-08-05 15:19 ` [PATCH] SQUASHME: pnfs-submit: Use generic layout name to load layout modules Benny Halevy
2010-08-05 15:53 ` [PATCH] SQUASHME: pnfs-submit: reduce nesting level in set_pnfs_layoutdriver 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=1280193018-1628-1-git-send-email-Ricardo.Labiaga@netapp.com \
    --to=ricardo.labiaga@netapp.com \
    --cc=bhalevy@panasas.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.