SQUASHME: pnfs-submit: Use generic layout name to load layout modules
Subsystems (2)
PATCH 1/1 SQUASHME: pnfs-submit: Use generic layout name to load layout modules
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.
--- fs/nfs/Makefile | 4 ++-- fs/nfs/pnfs.c | 10 +--------- fs/nfs/pnfs.h | 2 +- 3 files changed, 4 insertions(+), 12 deletions(-)
fs/nfs/Makefile +2 -2
@@ -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
fs/nfs/pnfs.c +1 -9
@@ -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" );
fs/nfs/pnfs.h +1 -1
@@ -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) {
Signature · 1 line
1.5.4.3
Merged for pnfs-all-2.6.35-2010-08-05. Thanks!
Benny
Quoted 77 lines · Ricardo Labiaga
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-1nfs_layout_nfsv41_files
alias nfs-layouttype4-2nfs_layout_osd2_objectsIt can be turned off by commenting out the alias, or specifying it off. For example:
alias nfs-layouttype4-3 offThe module can still be loaded by hand using modprobe.
Signed-off-by Ricardo Labiaga <[email protected]>--- fs/nfs/Makefile | 4 ++-- fs/nfs/pnfs.c | 10 +--------- fs/nfs/pnfs.h | 2 +- 3 files changed, 4 insertions(+), 12 deletions(-)fs/nfs/Makefile +2
-2@@ -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.ofs/nfs/pnfs.c +1
-9@@ -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" );fs/nfs/pnfs.h +1
-1@@ -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) {
PATCH 1/1 SQUASHME: pnfs-submit: reduce nesting level in set_pnfs_layoutdriver
In reply to Ricardo LabiagaSimplify the code a bit.
--- fs/nfs/pnfs.c | 26 ++++++++++++++------------ 1 files changed, 14 insertions(+), 12 deletions(-)
fs/nfs/pnfs.c +14 -12
@@ -214,23 +214,25 @@ set_pnfs_layoutdriver(struct nfs_server *server, u32 id)find_pnfs (id, &mod); } -if (mod) { - server->pnfs_curr_ld = mod->pnfs_ld_type; -if (mod->pnfs_ld_type->ld_io_ops->initialize_mountpoint ( - server->nfs_client)) { -printk (KERN_ERR "%s: Error initializing mount point " -"for layout driver %u. " , __func__, id); - goto out_err; - } -dprintk ("%s: pNFS module for %u set\n" , __func__, id); -return ; +if (!mod) { +dprintk ("%s: No pNFS module found for %u. " , __func__, id); + goto out_err; + } + + server->pnfs_curr_ld = mod->pnfs_ld_type; +if (mod->pnfs_ld_type->ld_io_ops->initialize_mountpoint ( + server->nfs_client)) { +printk (KERN_ERR "%s: Error initializing mount point " +"for layout driver %u. " , __func__, id); + goto out_err; } -dprintk ("%s: No pNFS module found for %u. " , __func__, id); +dprintk ("%s: pNFS module for %u set\n" , __func__, id); +return ; + out_err:dprintk ("Using NFSv4 I/O\n" ); server->pnfs_curr_ld =NULL ; -return ; }/* Allow I/O module to set its functions structure */
Signature · 1 line
1.7.2