Skip to contentSkip to conversation

NFS: Modularize NFS v3

RFC Superseded [email protected] 4 participants 9 messages Nov 22, 2011 – Nov 28, 2011

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover NFS: Modularize NFS v3

From: Bryan Schumaker <[email protected]>

This set of patches removes NFS v3 from the main NFS kernel module and creates a new module containing the proc, xdr, and acl code. This will give us a single directory to put NFS v3 specific code so it doesn't need to be mixed in with the generic client stuff.

I'm sure this could still use a lot of work, but I figured I would wait to see what everybody thinks first. I imagine that once we get an "nfs submodule" system working it'll be easier to convert v2 and v4 (and possibly v4.1?) to modules.

I split the second patch into two to make it easier to see what my changes were to get everything to compile. Hopefully this will save some pain in having to look through 7000+ line patch that resulted from my mv nfs3*.c nfs3/ command. I can combine everything in a future version of the patch.

Thoughts?

- Bryan

#1 lore raw

RFC 1/4 NFS: Export symbols needed by an NFS v3 module

From: Bryan Schumaker <[email protected]>

These are functions and structures used by the NFS v3 code that needs to be available once it has been moved to its own module.

---
 fs/nfs/client.c  |    1 +
 fs/nfs/dir.c     |   50 ++++++++++++++++++++++++++++++++------------------
 fs/nfs/inode.c   |   12 ++++++++++++
 fs/nfs/nfs2xdr.c |    2 ++
 4 files changed, 47 insertions(+), 18 deletions(-)
fs/nfs/client.c +1 -0
index 873bf00..c32a21f 100644
@@ -813,6 +813,7 @@ error:
 	dprintk("<-- nfs_init_client() = xerror %d\n", error);
 	return error;
 }
+EXPORT_SYMBOL_GPL(nfs_init_client);
 
 /*
  * Create a version 2 or 3 client
fs/nfs/dir.c +32 -18

180 lines not on this page · raw message

fs/nfs/inode.c +12 -0
index 50a15fa..2a4f55d 100644
@@ -184,6 +184,7 @@ void nfs_zap_acl_cache(struct inode *inode)
 	NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_ACL;
 	spin_unlock(&inode->i_lock);
 }
+EXPORT_SYMBOL_GPL(nfs_zap_acl_cache);
 
 void nfs_invalidate_atime(struct inode *inode)
 {
@@ -191,6 +192,7 @@ void nfs_invalidate_atime(struct inode *inode)
 	NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATIME;
 	spin_unlock(&inode->i_lock);
 }
+EXPORT_SYMBOL_GPL(nfs_invalidate_atime);
 
 /*
  * Invalidate, but do not unhash, the inode.
@@ -444,6 +446,7 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
 out:
 	return error;
 }
+EXPORT_SYMBOL_GPL(nfs_setattr);
 
 /**
  * nfs_vmtruncate - unmap mappings "freed" by truncate() syscall
@@ -502,6 +505,7 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr)
 		nfs_vmtruncate(inode, attr->ia_size);
 	}
 }
+EXPORT_SYMBOL_GPL(nfs_setattr_update_inode);
 
 int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
 {
@@ -540,6 +544,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
 out:
 	return err;
 }
+EXPORT_SYMBOL_GPL(nfs_getattr);
 
 static void nfs_init_lock_context(struct nfs_lock_context *l_ctx)
 {
@@ -628,6 +633,7 @@ void nfs_close_context(struct nfs_open_context *ctx, int is_sync)
 		return;
 	nfs_revalidate_inode(server, inode);
 }
+EXPORT_SYMBOL_GPL(nfs_close_context);
 
 struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred, fmode_t f_mode)
 {
@@ -845,6 +851,7 @@ int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
 		return NFS_STALE(inode) ? -ESTALE : 0;
 	return __nfs_revalidate_inode(server, inode);
 }
+EXPORT_SYMBOL_GPL(nfs_revalidate_inode);
 
 static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping)
 {
@@ -1020,6 +1027,7 @@ void nfs_fattr_init(struct nfs_fattr *fattr)
 	fattr->time_start = jiffies;
 	fattr->gencount = nfs_inc_attr_generation_counter();
 }
+EXPORT_SYMBOL_GPL(nfs_fattr_init);
 
 struct nfs_fattr *nfs_alloc_fattr(void)
 {
@@ -1030,6 +1038,7 @@ struct nfs_fattr *nfs_alloc_fattr(void)
 		nfs_fattr_init(fattr);
 	return fattr;
 }
+EXPORT_SYMBOL_GPL(nfs_alloc_fattr);
 
 struct nfs_fh *nfs_alloc_fhandle(void)
 {
@@ -1099,6 +1108,7 @@ int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
 
 	return status;
 }
+EXPORT_SYMBOL_GPL(nfs_refresh_inode);
 
 static int nfs_post_op_update_inode_locked(struct inode *inode, struct nfs_fattr *fattr)
 {
@@ -1135,6 +1145,7 @@ int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 	spin_unlock(&inode->i_lock);
 	return status;
 }
+EXPORT_SYMBOL_GPL(nfs_post_op_update_inode);
 
 /**
  * nfs_post_op_update_inode_force_wcc - try to update the inode attribute cache
@@ -1186,6 +1197,7 @@ out_noforce:
 	spin_unlock(&inode->i_lock);
 	return status;
 }
+EXPORT_SYMBOL_GPL(nfs_post_op_update_inode_force_wcc);
 
 /*
  * Many nfs protocol calls return the new file attributes after
fs/nfs/nfs2xdr.c +2 -0
index 792cb13..ce8d6c4 100644
@@ -13,6 +13,7 @@
 #include <linux/time.h>
 #include <linux/mm.h>
 #include <linux/errno.h>
+#include <linux/export.h>
 #include <linux/string.h>
 #include <linux/in.h>
 #include <linux/pagemap.h>
@@ -1120,6 +1121,7 @@ int nfs_stat_to_errno(enum nfs_stat status)
 	dprintk("NFS: Unrecognized nfs status value: %u\n", status);
 	return nfs_errtbl[i].errno;
 }
+EXPORT_SYMBOL_GPL(nfs_stat_to_errno);
 
 #define PROC(proc, argtype, restype, timer)				\
 [NFSPROC_##proc] = {							\
Signature · 1 line
1.7.7.4
#2 lore raw

RFC 1/1 NFS: Move the NFS v3 code into its own subdirectory

In reply to [email protected]

From: Bryan Schumaker <[email protected]>

This finishes off the changes started in the last patch. Note that after applying this patch NFS v3 is still directly compiled into the main NFS kernel module. The changes to turn it into a module will come in a later patch.

---
 fs/nfs/Makefile        |    4 ++--
 fs/nfs/nfs3/nfs3acl.c  |    2 +-
 fs/nfs/nfs3/nfs3proc.c |    4 ++--
 fs/nfs/nfs3/nfs3xdr.c  |    2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
fs/nfs/Makefile +2 -2
index b58613d..ac0e5df 100644
@@ -9,8 +9,8 @@ nfs-y 			:= client.o dir.o file.o getroot.o inode.o super.o nfs2xdr.o \
 			   write.o namespace.o mount_clnt.o \
 			   dns_resolve.o cache_lib.o
 nfs-$(CONFIG_ROOT_NFS)	+= nfsroot.o
-nfs-$(CONFIG_NFS_V3)	+= nfs3proc.o nfs3xdr.o
-nfs-$(CONFIG_NFS_V3_ACL)	+= nfs3acl.o
+nfs-$(CONFIG_NFS_V3)	+= nfs3/nfs3proc.o nfs3/nfs3xdr.o
+nfs-$(CONFIG_NFS_V3_ACL)	+= nfs3/nfs3acl.o
 nfs-$(CONFIG_NFS_V4)	+= nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \
 			   delegation.o idmap.o \
 			   callback.o callback_xdr.o callback_proc.o \
fs/nfs/nfs3/nfs3acl.c +1 -1
index 7ef2397..ac589ff 100644
@@ -6,7 +6,7 @@
 #include <linux/posix_acl_xattr.h>
 #include <linux/nfsacl.h>
 
-#include "internal.h"
+#include "../internal.h"
 
 #define NFSDBG_FACILITY	NFSDBG_PROC
 
fs/nfs/nfs3/nfs3proc.c +2 -2
index d4bc9ed9..f37ddb9 100644
@@ -18,8 +18,8 @@
 #include <linux/lockd/bind.h>
 #include <linux/nfs_mount.h>
 
-#include "iostat.h"
-#include "internal.h"
+#include "../iostat.h"
+#include "../internal.h"
 
 #define NFSDBG_FACILITY		NFSDBG_PROC
 
fs/nfs/nfs3/nfs3xdr.c +1 -1
index 183c6b1..be27fb8 100644
@@ -20,7 +20,7 @@
 #include <linux/nfs3.h>
 #include <linux/nfs_fs.h>
 #include <linux/nfsacl.h>
-#include "internal.h"
+#include "../internal.h"
 
 #define NFSDBG_FACILITY		NFSDBG_XDR
 
Signature · 1 line
1.7.7.4
#3 lore raw

RFC 3/4 NFS: Add functions for adding new NFS versions

In reply to [email protected]

From: Bryan Schumaker <[email protected]>

These functions and structures allow us to add modular NFS versions at runtime, rather than requiring them to be compiled directly into the NFS kernel module.

---
 fs/nfs/client.c         |   65 +++++++++++++++++++++++++++++++++++++++++++---
 fs/nfs/file.c           |    2 +
 fs/nfs/internal.h       |   15 +++++++++++
 fs/nfs/mount_clnt.c     |    1 +
 fs/nfs/nfs3/nfs3proc.c  |    2 +-
 fs/nfs/nfs4proc.c       |    2 +-
 fs/nfs/proc.c           |    2 +-
 fs/nfs/super.c          |    1 +
 include/linux/nfs_xdr.h |    6 ++--
 9 files changed, 85 insertions(+), 11 deletions(-)
fs/nfs/client.c +60 -5
index c32a21f..9e77056 100644
@@ -87,6 +87,21 @@ retry:
 static int nfs4_disable_idmapping = 0;
 
 /*
+ * NFS versions
+ */
+static struct nfs_version_ops *nfs_version_ops[5] = {
+	[2] = NULL,
+	[3] = NULL,
+	[4] = NULL,
+};
+
+static struct nfs_rpc_ops *nfs_ops[5] = {
+	[2]	= &nfs_v2_clientops,
+	[3]	= &nfs_v3_clientops,
+	[4]	= &nfs_v4_clientops,
+};
+
+/*
  * RPC cruft for NFS
  */
 static struct rpc_version *nfs_version[5] = {
@@ -137,6 +152,45 @@ struct nfs_client_initdata {
 	u32 minorversion;
 };
 
+void nfs_register_version(unsigned int version, struct nfs_version_ops *ops)
+{
+	nfs_version_ops[version] = ops;
+	nfs_version[version] = ops->nfs_rpc;
+	nfs_ops[version] = ops->nfs_ops;
+#ifdef CONFIG_NFS_V3_ACL
+	nfsacl_version[version] = ops->nfs_acl;
+#endif
+}
+EXPORT_SYMBOL_GPL(nfs_register_version);
+
+void nfs_unregister_version(unsigned int version)
+{
+	struct nfs_version_ops *ops = nfs_version_ops[version];
+	if (ops != NULL) {
+		nfs_version_ops[version] = NULL;
+		nfs_version[version] = NULL;
+		nfs_ops[version] = NULL;
+#ifdef CONFIG_NFS_V3_ACL
+		nfsacl_version[version] = NULL;
+#endif
+	}
+}
+EXPORT_SYMBOL_GPL(nfs_unregister_version);
+
+void nfs_version_ref(unsigned int version)
+{
+	struct nfs_version_ops *nfs = nfs_version_ops[version];
+	if (nfs != NULL)
+		nfs->version_ref();
+}
+
+void nfs_version_unref(unsigned int version)
+{
+	struct nfs_version_ops *nfs = nfs_version_ops[version];
+	if (nfs != NULL)
+		nfs->version_unref();
+}
+
 /*
  * Allocate a shared client record
  *
@@ -825,7 +879,7 @@ static int nfs_init_server(struct nfs_server *server,
 		.hostname = data->nfs_server.hostname,
 		.addr = (const struct sockaddr *)&data->nfs_server.address,
 		.addrlen = data->nfs_server.addrlen,
-		.rpc_ops = &nfs_v2_clientops,
+		.rpc_ops = nfs_ops[data->version],
 		.proto = data->nfs_server.protocol,
 	};
 	struct rpc_timeout timeparms;
@@ -834,10 +888,10 @@ static int nfs_init_server(struct nfs_server *server,
 
 	dprintk("--> nfs_init_server()\n");
 
-#ifdef CONFIG_NFS_V3
-	if (data->version == 3)
-		cl_init.rpc_ops = &nfs_v3_clientops;
-#endif
+	if (cl_init.rpc_ops == NULL) {
+		error = -EPROTONOSUPPORT;
+		goto out;
+	}
 
 	nfs_init_timeout_values(&timeparms, data->nfs_server.protocol,
 			data->timeo, data->retrans);
@@ -899,6 +953,7 @@ static int nfs_init_server(struct nfs_server *server,
 error:
 	server->nfs_client = NULL;
 	nfs_put_client(clp);
+out:
 	dprintk("<-- nfs_init_server() = xerror %d\n", error);
 	return error;
 }
fs/nfs/file.c +2 -0
index eca56d4..90389ca 100644
@@ -19,6 +19,7 @@
 #include <linux/time.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
+#include <linux/export.h>
 #include <linux/fcntl.h>
 #include <linux/stat.h>
 #include <linux/nfs_fs.h>
@@ -865,6 +866,7 @@ const struct file_operations nfs_file_operations = {
 	.check_flags	= nfs_check_flags,
 	.setlease	= nfs_setlease,
 };
+EXPORT_SYMBOL_GPL(nfs_file_operations);
 
 #ifdef CONFIG_NFS_V4
 static int
fs/nfs/internal.h +15 -0
index 3f4d957..93a0ba2 100644
@@ -68,6 +68,21 @@ struct nfs_clone_mount {
 	rpc_authflavor_t authflavor;
 };
 
+struct nfs_version_ops {
+	struct rpc_version *nfs_rpc;
+	struct nfs_rpc_ops *nfs_ops;
+#ifdef CONFIG_NFS_V3_ACL
+	struct rpc_version *nfs_acl;
+#endif
+	void (*version_ref)(void);
+	void (*version_unref)(void);
+};
+
+void nfs_register_version(unsigned int, struct nfs_version_ops *);
+void nfs_unregister_version(unsigned int);
+void nfs_version_ref(unsigned int);
+void nfs_version_unref(unsigned int);
+
 /*
  * Note: RFC 1813 doesn't limit the number of auth flavors that
  * a server can return, so make something up.
fs/nfs/mount_clnt.c +1 -0
index d4c2d6b..323a105 100644
@@ -190,6 +190,7 @@ int nfs_mount(struct nfs_mount_request *info)
 		goto out_mnt_err;
 
 	dprintk("NFS: MNT request succeeded\n");
+	nfs_version_ref(info->version);
 	status = 0;
 
 out:
fs/nfs/nfs3/nfs3proc.c +1 -1
index f37ddb9..593a44c 100644
@@ -848,7 +848,7 @@ nfs3_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
 	return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl);
 }
 
-const struct nfs_rpc_ops nfs_v3_clientops = {
+struct nfs_rpc_ops nfs_v3_clientops = {
 	.version	= 3,			/* protocol version */
 	.dentry_ops	= &nfs_dentry_operations,
 	.dir_inode_ops	= &nfs3_dir_inode_operations,
fs/nfs/nfs4proc.c +1 -1
index be2bbac..58bb8d2 100644
@@ -6247,7 +6247,7 @@ static const struct inode_operations nfs4_file_inode_operations = {
 	.removexattr	= generic_removexattr,
 };
 
-const struct nfs_rpc_ops nfs_v4_clientops = {
+struct nfs_rpc_ops nfs_v4_clientops = {
 	.version	= 4,			/* protocol version */
 	.dentry_ops	= &nfs4_dentry_operations,
 	.dir_inode_ops	= &nfs4_dir_inode_operations,
fs/nfs/proc.c +1 -1
index f48125d..d3eb291 100644
@@ -705,7 +705,7 @@ out_einval:
 	return -EINVAL;
 }
 
-const struct nfs_rpc_ops nfs_v2_clientops = {
+struct nfs_rpc_ops nfs_v2_clientops = {
 	.version	= 2,		       /* protocol version */
 	.dentry_ops	= &nfs_dentry_operations,
 	.dir_inode_ops	= &nfs_dir_inode_operations,
fs/nfs/super.c +1 -0
index 1347774..96967ff 100644
@@ -2334,6 +2334,7 @@ static void nfs_kill_super(struct super_block *s)
 
 	kill_anon_super(s);
 	nfs_fscache_release_super_cookie(s);
+	nfs_version_unref(server->nfs_client->rpc_ops->version);
 	nfs_free_server(server);
 }
 
include/linux/nfs_xdr.h +3 -3
index 2a7c533..6004f5c 100644
@@ -1260,9 +1260,9 @@ struct nfs_rpc_ops {
 /*
  * Function vectors etc. for the NFS client
  */
-extern const struct nfs_rpc_ops	nfs_v2_clientops;
-extern const struct nfs_rpc_ops	nfs_v3_clientops;
-extern const struct nfs_rpc_ops	nfs_v4_clientops;
+extern struct nfs_rpc_ops	nfs_v2_clientops;
+extern struct nfs_rpc_ops	nfs_v3_clientops;
+extern struct nfs_rpc_ops	nfs_v4_clientops;
 extern struct rpc_version	nfs_version2;
 extern struct rpc_version	nfs_version3;
 extern struct rpc_version	nfs_version4;
Signature · 1 line
1.7.7.4
#4 lore raw

RFC 4/4 NFS: Turn NFS v3 into a module

In reply to [email protected]

From: Bryan Schumaker <[email protected]>

This will allow users to unmap NFS v3 from the kernel memory if they don't want to use it. This will also give us a place to put NFS v3 specific code so it doesn't clutter the generic NFS client.

---
 fs/nfs/Kconfig         |    8 ++++-
 fs/nfs/Makefile        |    3 +-
 fs/nfs/client.c        |    8 ++---
 fs/nfs/dir.c           |   31 --------------------
 fs/nfs/file.c          |   12 -------
 fs/nfs/internal.h      |   10 ++++++
 fs/nfs/nfs3/Makefile   |    7 ++++
 fs/nfs/nfs3/module.c   |   75 ++++++++++++++++++++++++++++++++++++++++++++++++
 fs/nfs/nfs3/nfs3.h     |    7 ++++
 fs/nfs/nfs3/nfs3proc.c |    1 +
 fs/nfs/nfs3/nfs3xdr.c  |    1 +
 11 files changed, 111 insertions(+), 52 deletions(-)
 create mode 100644 fs/nfs/nfs3/Makefile
 create mode 100644 fs/nfs/nfs3/module.c
 create mode 100644 fs/nfs/nfs3/nfs3.h
fs/nfs/Kconfig +6 -2
index dbcd821..47195e0 100644
@@ -29,15 +29,19 @@ config NFS_FS
 
 	  If unsure, say N.
 
-config NFS_V3
-	bool "NFS client support for NFS version 3"
+config NFS_VERSION_3
+	tristate "NFS client support for NFS version 3"
 	depends on NFS_FS
+	select NFS_V3
 	help
 	  This option enables support for version 3 of the NFS protocol
 	  (RFC 1813) in the kernel's NFS client.
 
 	  If unsure, say Y.
 
+config NFS_V3
+	bool
+
 config NFS_V3_ACL
 	bool "NFS client support for the NFSv3 ACL protocol extension"
 	depends on NFS_V3
fs/nfs/Makefile +1 -2
index ac0e5df..930913d 100644
@@ -9,8 +9,6 @@ nfs-y 			:= client.o dir.o file.o getroot.o inode.o super.o nfs2xdr.o \
 			   write.o namespace.o mount_clnt.o \
 			   dns_resolve.o cache_lib.o
 nfs-$(CONFIG_ROOT_NFS)	+= nfsroot.o
-nfs-$(CONFIG_NFS_V3)	+= nfs3/nfs3proc.o nfs3/nfs3xdr.o
-nfs-$(CONFIG_NFS_V3_ACL)	+= nfs3/nfs3acl.o
 nfs-$(CONFIG_NFS_V4)	+= nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \
 			   delegation.o idmap.o \
 			   callback.o callback_xdr.o callback_proc.o \
@@ -22,5 +20,6 @@ nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o
 obj-$(CONFIG_PNFS_FILE_LAYOUT) += nfs_layout_nfsv41_files.o
 nfs_layout_nfsv41_files-y := nfs4filelayout.o nfs4filelayoutdev.o
 
+obj-$(CONFIG_NFS_VERSION_3) += nfs3/
 obj-$(CONFIG_PNFS_OBJLAYOUT) += objlayout/
 obj-$(CONFIG_PNFS_BLOCK) += blocklayout/
fs/nfs/client.c +3 -5
index 9e77056..e4cb43b 100644
@@ -97,7 +97,7 @@ static struct nfs_version_ops *nfs_version_ops[5] = {
 
 static struct nfs_rpc_ops *nfs_ops[5] = {
 	[2]	= &nfs_v2_clientops,
-	[3]	= &nfs_v3_clientops,
+	[3]	= NULL,
 	[4]	= &nfs_v4_clientops,
 };
 
@@ -106,9 +106,7 @@ static struct nfs_rpc_ops *nfs_ops[5] = {
  */
 static struct rpc_version *nfs_version[5] = {
 	[2]			= &nfs_version2,
-#ifdef CONFIG_NFS_V3
-	[3]			= &nfs_version3,
-#endif
+	[3]			= NULL,
 #ifdef CONFIG_NFS_V4
 	[4]			= &nfs_version4,
 #endif
@@ -131,7 +129,7 @@ struct rpc_stat nfs_rpcstat = {
 #ifdef CONFIG_NFS_V3_ACL
 static struct rpc_stat		nfsacl_rpcstat = { &nfsacl_program };
 static struct rpc_version *	nfsacl_version[] = {
-	[3]			= &nfsacl_version3,
+	[3]			= NULL,
 };
 
 struct rpc_program		nfsacl_program = {
fs/nfs/dir.c +0 -31
index f7cb6b6..25dbc54 100644
@@ -47,16 +47,6 @@
 static int nfs_opendir(struct inode *, struct file *);
 static int nfs_closedir(struct inode *, struct file *);
 static int nfs_readdir(struct file *, void *, filldir_t);
-struct dentry *nfs_lookup(struct inode *, struct dentry *, struct nameidata *);
-int nfs_create(struct inode *, struct dentry *, int, struct nameidata *);
-int nfs_mkdir(struct inode *, struct dentry *, int);
-int nfs_rmdir(struct inode *, struct dentry *);
-int nfs_unlink(struct inode *, struct dentry *);
-int nfs_symlink(struct inode *, struct dentry *, const char *);
-int nfs_link(struct dentry *, struct inode *, struct dentry *);
-int nfs_mknod(struct inode *, struct dentry *, int, dev_t);
-int nfs_rename(struct inode *, struct dentry *,
-		      struct inode *, struct dentry *);
 static int nfs_fsync_dir(struct file *, loff_t, loff_t, int);
 static loff_t nfs_llseek_dir(struct file *, loff_t, int);
 static void nfs_readdir_clear_array(struct page*);
@@ -89,27 +79,6 @@ const struct address_space_operations nfs_dir_aops = {
 	.freepage = nfs_readdir_clear_array,
 };
 
-#ifdef CONFIG_NFS_V3
-const struct inode_operations nfs3_dir_inode_operations = {
-	.create		= nfs_create,
-	.lookup		= nfs_lookup,
-	.link		= nfs_link,
-	.unlink		= nfs_unlink,
-	.symlink	= nfs_symlink,
-	.mkdir		= nfs_mkdir,
-	.rmdir		= nfs_rmdir,
-	.mknod		= nfs_mknod,
-	.rename		= nfs_rename,
-	.permission	= nfs_permission,
-	.getattr	= nfs_getattr,
-	.setattr	= nfs_setattr,
-	.listxattr	= nfs3_listxattr,
-	.getxattr	= nfs3_getxattr,
-	.setxattr	= nfs3_setxattr,
-	.removexattr	= nfs3_removexattr,
-};
-#endif  /* CONFIG_NFS_V3 */
-
 #ifdef CONFIG_NFS_V4
 
 static struct dentry *nfs_atomic_lookup(struct inode *, struct dentry *, struct nameidata *);
fs/nfs/file.c +0 -12
index 90389ca..397e5e0 100644
@@ -49,18 +49,6 @@ const struct inode_operations nfs_file_inode_operations = {
 	.setattr	= nfs_setattr,
 };
 
-#ifdef CONFIG_NFS_V3
-const struct inode_operations nfs3_file_inode_operations = {
-	.permission	= nfs_permission,
-	.getattr	= nfs_getattr,
-	.setattr	= nfs_setattr,
-	.listxattr	= nfs3_listxattr,
-	.getxattr	= nfs3_getxattr,
-	.setxattr	= nfs3_setxattr,
-	.removexattr	= nfs3_removexattr,
-};
-#endif  /* CONFIG_NFS_v3 */
-
 /* Hack for future NFS swap support */
 #ifndef IS_SWAPFILE
 # define IS_SWAPFILE(inode)	(0)
fs/nfs/internal.h +10 -0
index 93a0ba2..e6256f9 100644
@@ -83,6 +83,16 @@ void nfs_unregister_version(unsigned int);
 void nfs_version_ref(unsigned int);
 void nfs_version_unref(unsigned int);
 
+struct dentry *nfs_lookup(struct inode *, struct dentry *, struct nameidata *);
+int nfs_create(struct inode *, struct dentry *, int, struct nameidata *);
+int nfs_mkdir(struct inode *, struct dentry *, int);
+int nfs_rmdir(struct inode *, struct dentry *);
+int nfs_unlink(struct inode *, struct dentry *);
+int nfs_symlink(struct inode *, struct dentry *, const char *);
+int nfs_link(struct dentry *, struct inode *, struct dentry *);
+int nfs_mknod(struct inode *, struct dentry *, int, dev_t);
+int nfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
+
 /*
  * Note: RFC 1813 doesn't limit the number of auth flavors that
  * a server can return, so make something up.
fs/nfs/nfs3/Makefile new file +7 -0
new file mode 100644
index 0000000..308123b
@@ -0,0 +1,7 @@
+#
+# Makefile for NFS v3
+#
+obj-$(CONFIG_NFS_VERSION_3) += nfs3.o
+
+nfs3-y := module.o nfs3proc.o nfs3xdr.o
+nfs3-$(CONFIG_NFS_V3_ACL) += nfs3acl.o
fs/nfs/nfs3/module.c new file +75 -0

75 lines not on this page · raw message

fs/nfs/nfs3/nfs3.h new file +7 -0
new file mode 100644
index 0000000..c1e7875
@@ -0,0 +1,7 @@
+#ifndef _FS_NFS_NFS3_H
+#define _FS_NFS_NFS3_H
+
+const extern struct inode_operations nfs3_file_inode_operations;
+const extern struct inode_operations nfs3_dir_inode_operations;
+
+#endif /* _FS_NFS_NFS3_H */
fs/nfs/nfs3/nfs3proc.c +1 -0
index 593a44c..e574e82 100644
@@ -20,6 +20,7 @@
 
 #include "../iostat.h"
 #include "../internal.h"
+#include "nfs3.h"
 
 #define NFSDBG_FACILITY		NFSDBG_PROC
 
fs/nfs/nfs3/nfs3xdr.c +1 -0
index be27fb8..d59d644 100644
@@ -20,6 +20,7 @@
 #include <linux/nfs3.h>
 #include <linux/nfs_fs.h>
 #include <linux/nfsacl.h>
+#include <linux/nfs_xdr.h>
 #include "../internal.h"
 
 #define NFSDBG_FACILITY		NFSDBG_XDR
Signature · 1 line
1.7.7.4
#5 lore raw
In reply to [email protected]
Quoted 12 lines · On 11/22/2011 02:57 PM, [email protected] wrote:

From: Bryan Schumaker <[email protected]>

This set of patches removes NFS v3 from the main NFS kernel module and creates a new module containing the proc, xdr, and acl code. This will give us a single directory to put NFS v3 specific code so it doesn't need to be mixed in with the generic client stuff.

I'm sure this could still use a lot of work, but I figured I would wait to see what everybody thinks first. I imagine that once we get an "nfs submodule" system working it'll be easier to convert v2 and v4 (and possibly v4.1?) to modules.

Quoted 5 lines

I split the second patch into two to make it easier to see what my changes were to get everything to compile. Hopefully this will save some pain in having to look through 7000+ line patch that resulted from my mv nfs3*.c nfs3/ command. I can combine everything in a future version of the patch.

If you give git format-patch the -M switch it will generate a 4 line "file move" annotation and will not include the full remove-and-add patch. It will not work with old versions of patch but we all use "git am" so you are safe.

Because we never got the 2/4 patch. It was probably too big.

I set my git tree to do the -M by default it's a git config something something check it out.

Boaz

Quoted 8 lines

Thoughts?

- Bryan

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw

Boaz Harrosh wrote:

I set my git tree to do the -M by default it's a git config something something check it out.

Me too. Not sure, but I think it's this one:
git config --global diff.renames copy

#8 lore raw
In reply to [email protected]
Quoted 12 lines · On Tue, Nov 22, 2011 at 05:57:59PM -0500, [email protected] wrote:

From: Bryan Schumaker <[email protected]>

This set of patches removes NFS v3 from the main NFS kernel module and creates a new module containing the proc, xdr, and acl code. This will give us a single directory to put NFS v3 specific code so it doesn't need to be mixed in with the generic client stuff.

I'm sure this could still use a lot of work, but I figured I would wait to see what everybody thinks first. I imagine that once we get an "nfs submodule" system working it'll be easier to convert v2 and v4 (and possibly v4.1?) to modules.

Quoted 6 lines

I split the second patch into two to make it easier to see what my changes were to get everything to compile. Hopefully this will save some pain in having to look through 7000+ line patch that resulted from my mv nfs3*.c nfs3/ command. I can combine everything in a future version of the patch.

Thoughts?

Is this purely cleanup, or is there some practical reason why people need to be able to unload v3 at runtime?

--b.

#7 lore raw
In reply to Jim Rees
Quoted 7 lines · Jim Rees

Boaz Harrosh wrote:

I set my git tree to do the -M by default it's a git config something something check it out.

Me too. Not sure, but I think it's this one:
git config --global diff.renames copy

I'll set up those options now. Thanks for the tips!

- Bryan