All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] NFS: Remove as many CONFIG_NFS_V3s as possible
@ 2014-09-03 16:19 Anna Schumaker
  2014-09-03 16:19 ` [PATCH 1/4] NFS: Unconditionally enable commit code Anna Schumaker
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Anna Schumaker @ 2014-09-03 16:19 UTC (permalink / raw)
  To: Trond.Myklebust, linux-nfs

The NFS client has a different module for each NFS version, but changing
compile options in one module usually causes everything else in the client
to recompile.  These patches begin to break inter-module dependencies with
the NFS v3 module.

Currently, toggling CONFIG_NFS_V3={n,m} will cause most of the NFS client and
random files in lockd, exofs and nfsd to recompile.  After applying these
patches, only fs/nfs/super.c will recompile when changing the existence of
NFS v3.

Changing the status of NFS v4 still causes way too much to recompile, but that
is an adventure for another day.

Questions? Comments? Thoughts?

Anna


Anna Schumaker (4):
  NFS: Unconditionally enable commit code
  NFS: Move v3 declarations out of internal.h
  NFS: Remove v3 not compiled check from validate_mount_data()
  NFS: Move NFS v3 acl functions to nfs3_fs.h

 fs/nfs/direct.c        | 14 -------------
 fs/nfs/internal.h      |  7 -------
 fs/nfs/nfs3_fs.h       | 34 +++++++++++++++++++++++++++++++
 fs/nfs/nfs3proc.c      |  1 +
 fs/nfs/nfs3super.c     |  1 +
 fs/nfs/super.c         | 11 ----------
 fs/nfs/write.c         | 54 --------------------------------------------------
 include/linux/nfs_fs.h | 41 --------------------------------------
 8 files changed, 36 insertions(+), 127 deletions(-)
 create mode 100644 fs/nfs/nfs3_fs.h

-- 
2.1.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] NFS: Unconditionally enable commit code
  2014-09-03 16:19 [PATCH 0/4] NFS: Remove as many CONFIG_NFS_V3s as possible Anna Schumaker
@ 2014-09-03 16:19 ` Anna Schumaker
  2014-09-03 16:19 ` [PATCH 2/4] NFS: Move v3 declarations out of internal.h Anna Schumaker
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Anna Schumaker @ 2014-09-03 16:19 UTC (permalink / raw)
  To: Trond.Myklebust, linux-nfs

The goal is to create a generic NFS module with code that does not
depend on what versions of NFS are enabled.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 fs/nfs/direct.c        | 14 -------------
 fs/nfs/write.c         | 54 --------------------------------------------------
 include/linux/nfs_fs.h |  8 --------
 3 files changed, 76 deletions(-)

diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 65ef6e0..dda4b86 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -178,7 +178,6 @@ static int nfs_direct_set_or_cmp_hdr_verf(struct nfs_direct_req *dreq,
 	return memcmp(verfp, &hdr->verf, sizeof(struct nfs_writeverf));
 }
 
-#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
 /*
  * nfs_direct_cmp_commit_data_verf - compare verifier for commit data
  * @dreq - direct request possibly spanning multiple servers
@@ -197,7 +196,6 @@ static int nfs_direct_cmp_commit_data_verf(struct nfs_direct_req *dreq,
 	WARN_ON_ONCE(verfp->committed < 0);
 	return memcmp(verfp, &data->verf, sizeof(struct nfs_writeverf));
 }
-#endif
 
 /**
  * nfs_direct_IO - NFS address space operation for direct I/O
@@ -576,7 +574,6 @@ out:
 	return result;
 }
 
-#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
 static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
 {
 	struct nfs_pageio_descriptor desc;
@@ -700,17 +697,6 @@ static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode
 	schedule_work(&dreq->work); /* Calls nfs_direct_write_schedule_work */
 }
 
-#else
-static void nfs_direct_write_schedule_work(struct work_struct *work)
-{
-}
-
-static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode *inode)
-{
-	nfs_direct_complete(dreq, true);
-}
-#endif
-
 static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
 {
 	struct nfs_direct_req *dreq = hdr->dreq;
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 175d5d0..70a6f03 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -749,7 +749,6 @@ nfs_mark_request_dirty(struct nfs_page *req)
 	__set_page_dirty_nobuffers(req->wb_page);
 }
 
-#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
 /**
  * nfs_request_add_commit_list - add request to a commit list
  * @req: pointer to a struct nfs_page
@@ -867,36 +866,6 @@ int nfs_write_need_commit(struct nfs_pgio_header *hdr)
 	return hdr->verf.committed != NFS_FILE_SYNC;
 }
 
-#else
-static void nfs_init_cinfo_from_inode(struct nfs_commit_info *cinfo,
-				      struct inode *inode)
-{
-}
-
-void nfs_init_cinfo(struct nfs_commit_info *cinfo,
-		    struct inode *inode,
-		    struct nfs_direct_req *dreq)
-{
-}
-
-void
-nfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg,
-			struct nfs_commit_info *cinfo)
-{
-}
-
-static void
-nfs_clear_request_commit(struct nfs_page *req)
-{
-}
-
-int nfs_write_need_commit(struct nfs_pgio_header *hdr)
-{
-	return 0;
-}
-
-#endif
-
 static void nfs_write_completion(struct nfs_pgio_header *hdr)
 {
 	struct nfs_commit_info cinfo;
@@ -932,7 +901,6 @@ out:
 	hdr->release(hdr);
 }
 
-#if  IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
 unsigned long
 nfs_reqs_to_commit(struct nfs_commit_info *cinfo)
 {
@@ -989,19 +957,6 @@ nfs_scan_commit(struct inode *inode, struct list_head *dst,
 	return ret;
 }
 
-#else
-unsigned long nfs_reqs_to_commit(struct nfs_commit_info *cinfo)
-{
-	return 0;
-}
-
-int nfs_scan_commit(struct inode *inode, struct list_head *dst,
-		    struct nfs_commit_info *cinfo)
-{
-	return 0;
-}
-#endif
-
 /*
  * Search for an existing write request, and attempt to update
  * it to reflect a new dirty region on a given page.
@@ -1394,7 +1349,6 @@ static int nfs_writeback_done(struct rpc_task *task,
 		return status;
 	nfs_add_stats(inode, NFSIOS_SERVERWRITTENBYTES, hdr->res.count);
 
-#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
 	if (hdr->res.verf->committed < hdr->args.stable &&
 	    task->tk_status >= 0) {
 		/* We tried a write call, but the server did not
@@ -1416,7 +1370,6 @@ static int nfs_writeback_done(struct rpc_task *task,
 			complain = jiffies + 300 * HZ;
 		}
 	}
-#endif
 
 	/* Deal with the suid/sgid bit corner case */
 	if (nfs_should_remove_suid(inode))
@@ -1469,7 +1422,6 @@ static void nfs_writeback_result(struct rpc_task *task,
 }
 
 
-#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
 static int nfs_commit_set_lock(struct nfs_inode *nfsi, int may_wait)
 {
 	int ret;
@@ -1778,12 +1730,6 @@ out_mark_dirty:
 	__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
 	return ret;
 }
-#else
-static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_control *wbc)
-{
-	return 0;
-}
-#endif
 
 int nfs_write_inode(struct inode *inode, struct writeback_control *wbc)
 {
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 5180a7e..fd334d4 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -529,17 +529,9 @@ extern int  nfs_updatepage(struct file *, struct page *, unsigned int, unsigned
 extern int nfs_wb_all(struct inode *inode);
 extern int nfs_wb_page(struct inode *inode, struct page* page);
 extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
-#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
 extern int  nfs_commit_inode(struct inode *, int);
 extern struct nfs_commit_data *nfs_commitdata_alloc(void);
 extern void nfs_commit_free(struct nfs_commit_data *data);
-#else
-static inline int
-nfs_commit_inode(struct inode *inode, int how)
-{
-	return 0;
-}
-#endif
 
 static inline int
 nfs_have_writebacks(struct inode *inode)
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] NFS: Move v3 declarations out of internal.h
  2014-09-03 16:19 [PATCH 0/4] NFS: Remove as many CONFIG_NFS_V3s as possible Anna Schumaker
  2014-09-03 16:19 ` [PATCH 1/4] NFS: Unconditionally enable commit code Anna Schumaker
@ 2014-09-03 16:19 ` Anna Schumaker
  2014-09-03 16:19 ` [PATCH 3/4] NFS: Remove v3 not compiled check from validate_mount_data() Anna Schumaker
  2014-09-03 16:19 ` [PATCH 4/4] NFS: Move NFS v3 acl functions to nfs3_fs.h Anna Schumaker
  3 siblings, 0 replies; 5+ messages in thread
From: Anna Schumaker @ 2014-09-03 16:19 UTC (permalink / raw)
  To: Trond.Myklebust, linux-nfs

I am generally against the "one big header file" approach, and
everything in the client includes this file.  Let's move all the NFS v3
declarations into a v3-only header file.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 fs/nfs/internal.h |  7 -------
 fs/nfs/nfs3_fs.h  | 15 +++++++++++++++
 fs/nfs/nfs3proc.c |  1 +
 3 files changed, 16 insertions(+), 7 deletions(-)
 create mode 100644 fs/nfs/nfs3_fs.h

diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 9056622..14ae6f2 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -218,13 +218,6 @@ static inline void nfs_fs_proc_exit(void)
 int nfs_sockaddr_match_ipaddr(const struct sockaddr *, const struct sockaddr *);
 #endif
 
-/* nfs3client.c */
-#if IS_ENABLED(CONFIG_NFS_V3)
-struct nfs_server *nfs3_create_server(struct nfs_mount_info *, struct nfs_subversion *);
-struct nfs_server *nfs3_clone_server(struct nfs_server *, struct nfs_fh *,
-				     struct nfs_fattr *, rpc_authflavor_t);
-#endif
-
 /* callback_xdr.c */
 extern struct svc_version nfs4_callback_version1;
 extern struct svc_version nfs4_callback_version4;
diff --git a/fs/nfs/nfs3_fs.h b/fs/nfs/nfs3_fs.h
new file mode 100644
index 0000000..6599e0d
--- /dev/null
+++ b/fs/nfs/nfs3_fs.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2014 Anna Schumaker.
+ *
+ * NFSv3-specific filesystem definitions and declarations
+ */
+#ifndef __LINUX_FS_NFS_NFS3_FS_H
+#define __LINUX_FS_NFS_NFS3_FS_H
+
+/* nfs3client.c */
+struct nfs_server *nfs3_create_server(struct nfs_mount_info *, struct nfs_subversion *);
+struct nfs_server *nfs3_clone_server(struct nfs_server *, struct nfs_fh *,
+				     struct nfs_fattr *, rpc_authflavor_t);
+
+
+#endif /* __LINUX_FS_NFS_NFS3_FS_H */
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 809670e..524f9f8 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -22,6 +22,7 @@
 
 #include "iostat.h"
 #include "internal.h"
+#include "nfs3_fs.h"
 
 #define NFSDBG_FACILITY		NFSDBG_PROC
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] NFS: Remove v3 not compiled check from validate_mount_data()
  2014-09-03 16:19 [PATCH 0/4] NFS: Remove as many CONFIG_NFS_V3s as possible Anna Schumaker
  2014-09-03 16:19 ` [PATCH 1/4] NFS: Unconditionally enable commit code Anna Schumaker
  2014-09-03 16:19 ` [PATCH 2/4] NFS: Move v3 declarations out of internal.h Anna Schumaker
@ 2014-09-03 16:19 ` Anna Schumaker
  2014-09-03 16:19 ` [PATCH 4/4] NFS: Move NFS v3 acl functions to nfs3_fs.h Anna Schumaker
  3 siblings, 0 replies; 5+ messages in thread
From: Anna Schumaker @ 2014-09-03 16:19 UTC (permalink / raw)
  To: Trond.Myklebust, linux-nfs

This check is already performed by the module loading code - if the
module can't be found then -EPROTONOSUPPORT will be returned.  Let's
handle v3 this way, too.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 fs/nfs/super.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index e4499d5..31a11b0 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2065,11 +2065,6 @@ static int nfs23_validate_mount_data(void *options,
 		return NFS_TEXT_DATA;
 	}
 
-#if !IS_ENABLED(CONFIG_NFS_V3)
-	if (args->version == 3)
-		goto out_v3_not_compiled;
-#endif /* !CONFIG_NFS_V3 */
-
 	return 0;
 
 out_no_data:
@@ -2085,12 +2080,6 @@ out_no_sec:
 	dfprintk(MOUNT, "NFS: nfs_mount_data version supports only AUTH_SYS\n");
 	return -EINVAL;
 
-#if !IS_ENABLED(CONFIG_NFS_V3)
-out_v3_not_compiled:
-	dfprintk(MOUNT, "NFS: NFSv3 is not compiled into kernel\n");
-	return -EPROTONOSUPPORT;
-#endif /* !CONFIG_NFS_V3 */
-
 out_nomem:
 	dfprintk(MOUNT, "NFS: not enough memory to handle mount options\n");
 	return -ENOMEM;
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] NFS: Move NFS v3 acl functions to nfs3_fs.h
  2014-09-03 16:19 [PATCH 0/4] NFS: Remove as many CONFIG_NFS_V3s as possible Anna Schumaker
                   ` (2 preceding siblings ...)
  2014-09-03 16:19 ` [PATCH 3/4] NFS: Remove v3 not compiled check from validate_mount_data() Anna Schumaker
@ 2014-09-03 16:19 ` Anna Schumaker
  3 siblings, 0 replies; 5+ messages in thread
From: Anna Schumaker @ 2014-09-03 16:19 UTC (permalink / raw)
  To: Trond.Myklebust, linux-nfs

This code is internal to the v3 module, so other parts of the client
shouldn't have any knowledge of it.

nfs3_getxattr(), nfs3_setxattr(), and nfs3_removexattr() no longer exist
anywhere so I remove the declarations while I'm here.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 fs/nfs/nfs3_fs.h       | 19 +++++++++++++++++++
 fs/nfs/nfs3super.c     |  1 +
 include/linux/nfs_fs.h | 33 ---------------------------------
 3 files changed, 20 insertions(+), 33 deletions(-)

diff --git a/fs/nfs/nfs3_fs.h b/fs/nfs/nfs3_fs.h
index 6599e0d..333ae40 100644
--- a/fs/nfs/nfs3_fs.h
+++ b/fs/nfs/nfs3_fs.h
@@ -6,6 +6,25 @@
 #ifndef __LINUX_FS_NFS_NFS3_FS_H
 #define __LINUX_FS_NFS_NFS3_FS_H
 
+/*
+ * nfs3acl.c
+ */
+#ifdef CONFIG_NFS_V3_ACL
+extern struct posix_acl *nfs3_get_acl(struct inode *inode, int type);
+extern int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type);
+extern int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
+		struct posix_acl *dfacl);
+extern ssize_t nfs3_listxattr(struct dentry *, char *, size_t);
+extern const struct xattr_handler *nfs3_xattr_handlers[];
+#else
+static inline int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
+		struct posix_acl *dfacl)
+{
+	return 0;
+}
+#define nfs3_listxattr NULL
+#endif /* CONFIG_NFS_V3_ACL */
+
 /* nfs3client.c */
 struct nfs_server *nfs3_create_server(struct nfs_mount_info *, struct nfs_subversion *);
 struct nfs_server *nfs3_clone_server(struct nfs_server *, struct nfs_fh *,
diff --git a/fs/nfs/nfs3super.c b/fs/nfs/nfs3super.c
index d6a9894..6af29c2 100644
--- a/fs/nfs/nfs3super.c
+++ b/fs/nfs/nfs3super.c
@@ -4,6 +4,7 @@
 #include <linux/module.h>
 #include <linux/nfs_fs.h>
 #include "internal.h"
+#include "nfs3_fs.h"
 #include "nfs.h"
 
 static struct nfs_subversion nfs_v3 = {
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index fd334d4..28d6490 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -443,22 +443,6 @@ static inline struct rpc_cred *nfs_file_cred(struct file *file)
 }
 
 /*
- * linux/fs/nfs/xattr.c
- */
-#ifdef CONFIG_NFS_V3_ACL
-extern ssize_t nfs3_listxattr(struct dentry *, char *, size_t);
-extern ssize_t nfs3_getxattr(struct dentry *, const char *, void *, size_t);
-extern int nfs3_setxattr(struct dentry *, const char *,
-			const void *, size_t, int);
-extern int nfs3_removexattr (struct dentry *, const char *name);
-#else
-# define nfs3_listxattr NULL
-# define nfs3_getxattr NULL
-# define nfs3_setxattr NULL
-# define nfs3_removexattr NULL
-#endif
-
-/*
  * linux/fs/nfs/direct.c
  */
 extern ssize_t nfs_direct_IO(int, struct kiocb *, struct iov_iter *, loff_t);
@@ -549,23 +533,6 @@ extern int  nfs_readpage_async(struct nfs_open_context *, struct inode *,
 			       struct page *);
 
 /*
- * linux/fs/nfs3proc.c
- */
-#ifdef CONFIG_NFS_V3_ACL
-extern struct posix_acl *nfs3_get_acl(struct inode *inode, int type);
-extern int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type);
-extern int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
-		struct posix_acl *dfacl);
-extern const struct xattr_handler *nfs3_xattr_handlers[];
-#else
-static inline int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
-		struct posix_acl *dfacl)
-{
-	return 0;
-}
-#endif /* CONFIG_NFS_V3_ACL */
-
-/*
  * inline functions
  */
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-09-03 16:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-03 16:19 [PATCH 0/4] NFS: Remove as many CONFIG_NFS_V3s as possible Anna Schumaker
2014-09-03 16:19 ` [PATCH 1/4] NFS: Unconditionally enable commit code Anna Schumaker
2014-09-03 16:19 ` [PATCH 2/4] NFS: Move v3 declarations out of internal.h Anna Schumaker
2014-09-03 16:19 ` [PATCH 3/4] NFS: Remove v3 not compiled check from validate_mount_data() Anna Schumaker
2014-09-03 16:19 ` [PATCH 4/4] NFS: Move NFS v3 acl functions to nfs3_fs.h Anna Schumaker

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.