summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2012-07-30 16:05:24 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-07-30 19:06:46 -0400
commit1c606fb74c758beafd98cbad9a9133eadeec2371 (patch)
treee8c057f32df3ee0a8e0341ae4ef2b23809a83da3 /fs
parentddda8e0aa8b955e20cb80908189bfa154ab54837 (diff)
NFS: Convert v3 into a module
This patch exports symbols and moves over the final structures needed by the v3 module. In addition, I also switch over to using IS_ENABLED() to check if CONFIG_NFS_V3 or CONFIG_NFS_V3_MODULE are set. The module (nfs3.ko) will be created in the same directory as nfs.ko and will be automatically loaded the first time you try to mount over NFS v3. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/Kconfig2
-rw-r--r--fs/nfs/Makefile6
-rw-r--r--fs/nfs/client.c5
-rw-r--r--fs/nfs/dir.c1
-rw-r--r--fs/nfs/direct.c2
-rw-r--r--fs/nfs/inode.c3
-rw-r--r--fs/nfs/internal.h2
-rw-r--r--fs/nfs/nfs.h14
-rw-r--r--fs/nfs/nfs3super.c9
-rw-r--r--fs/nfs/super.c6
-rw-r--r--fs/nfs/write.c8
11 files changed, 25 insertions, 33 deletions
diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
index 6764dbf66d05..f81a729c00e9 100644
--- a/fs/nfs/Kconfig
+++ b/fs/nfs/Kconfig
@@ -40,7 +40,7 @@ config NFS_V2
40 If unsure, say Y. 40 If unsure, say Y.
41 41
42config NFS_V3 42config NFS_V3
43 bool "NFS client support for NFS version 3" 43 tristate "NFS client support for NFS version 3"
44 depends on NFS_FS 44 depends on NFS_FS
45 default y 45 default y
46 help 46 help
diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile
index df61db41bfa8..01846edc5c94 100644
--- a/fs/nfs/Makefile
+++ b/fs/nfs/Makefile
@@ -9,8 +9,6 @@ nfs-y := client.o dir.o file.o getroot.o inode.o super.o \
9 write.o namespace.o mount_clnt.o \ 9 write.o namespace.o mount_clnt.o \
10 dns_resolve.o cache_lib.o 10 dns_resolve.o cache_lib.o
11nfs-$(CONFIG_ROOT_NFS) += nfsroot.o 11nfs-$(CONFIG_ROOT_NFS) += nfsroot.o
12nfs-$(CONFIG_NFS_V3) += nfs3super.o nfs3client.o nfs3proc.o nfs3xdr.o
13nfs-$(CONFIG_NFS_V3_ACL) += nfs3acl.o
14nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \ 12nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \
15 nfs4super.o nfs4file.o delegation.o idmap.o \ 13 nfs4super.o nfs4file.o delegation.o idmap.o \
16 callback.o callback_xdr.o callback_proc.o \ 14 callback.o callback_xdr.o callback_proc.o \
@@ -27,6 +25,10 @@ nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o
27obj-$(CONFIG_NFS_V2) += nfs2.o 25obj-$(CONFIG_NFS_V2) += nfs2.o
28nfs2-y := nfs2super.o proc.o nfs2xdr.o 26nfs2-y := nfs2super.o proc.o nfs2xdr.o
29 27
28obj-$(CONFIG_NFS_V3) += nfs3.o
29nfs3-y := nfs3super.o nfs3client.o nfs3proc.o nfs3xdr.o
30nfs3-$(CONFIG_NFS_V3_ACL) += nfs3acl.o
31
30obj-$(CONFIG_PNFS_FILE_LAYOUT) += nfs_layout_nfsv41_files.o 32obj-$(CONFIG_PNFS_FILE_LAYOUT) += nfs_layout_nfsv41_files.o
31nfs_layout_nfsv41_files-y := nfs4filelayout.o nfs4filelayoutdev.o 33nfs_layout_nfsv41_files-y := nfs4filelayout.o nfs4filelayoutdev.o
32 34
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index fa8acf510333..8687b6b6edc1 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -149,10 +149,6 @@ EXPORT_SYMBOL_GPL(unregister_nfs_version);
149 */ 149 */
150int __init nfs_register_versions(void) 150int __init nfs_register_versions(void)
151{ 151{
152 int err = init_nfs_v3();
153 if (err)
154 return err;
155
156 return init_nfs_v4(); 152 return init_nfs_v4();
157} 153}
158 154
@@ -161,7 +157,6 @@ int __init nfs_register_versions(void)
161 */ 157 */
162void nfs_unregister_versions(void) 158void nfs_unregister_versions(void)
163{ 159{
164 exit_nfs_v3();
165 exit_nfs_v4(); 160 exit_nfs_v4();
166} 161}
167 162
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index c382a6d5e177..55438c970cbf 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1981,6 +1981,7 @@ void nfs_access_zap_cache(struct inode *inode)
1981 spin_unlock(&nfs_access_lru_lock); 1981 spin_unlock(&nfs_access_lru_lock);
1982 nfs_access_free_list(&head); 1982 nfs_access_free_list(&head);
1983} 1983}
1984EXPORT_SYMBOL_GPL(nfs_access_zap_cache);
1984 1985
1985static struct nfs_access_entry *nfs_access_search_rbtree(struct inode *inode, struct rpc_cred *cred) 1986static struct nfs_access_entry *nfs_access_search_rbtree(struct inode *inode, struct rpc_cred *cred)
1986{ 1987{
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 42dce909ec70..899238156b11 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -460,7 +460,7 @@ static void nfs_inode_dio_write_done(struct inode *inode)
460 inode_dio_done(inode); 460 inode_dio_done(inode);
461} 461}
462 462
463#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 463#if IS_ENABLED(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
464static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) 464static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
465{ 465{
466 struct nfs_pageio_descriptor desc; 466 struct nfs_pageio_descriptor desc;
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index f358b976e9e6..78dfc3e895ec 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -186,6 +186,7 @@ void nfs_zap_acl_cache(struct inode *inode)
186 NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_ACL; 186 NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_ACL;
187 spin_unlock(&inode->i_lock); 187 spin_unlock(&inode->i_lock);
188} 188}
189EXPORT_SYMBOL_GPL(nfs_zap_acl_cache);
189 190
190void nfs_invalidate_atime(struct inode *inode) 191void nfs_invalidate_atime(struct inode *inode)
191{ 192{
@@ -847,6 +848,7 @@ int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
847 return NFS_STALE(inode) ? -ESTALE : 0; 848 return NFS_STALE(inode) ? -ESTALE : 0;
848 return __nfs_revalidate_inode(server, inode); 849 return __nfs_revalidate_inode(server, inode);
849} 850}
851EXPORT_SYMBOL_GPL(nfs_revalidate_inode);
850 852
851static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping) 853static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping)
852{ 854{
@@ -1213,6 +1215,7 @@ int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1213 spin_unlock(&inode->i_lock); 1215 spin_unlock(&inode->i_lock);
1214 return status; 1216 return status;
1215} 1217}
1218EXPORT_SYMBOL_GPL(nfs_post_op_update_inode);
1216 1219
1217/** 1220/**
1218 * nfs_post_op_update_inode_force_wcc - try to update the inode attribute cache 1221 * nfs_post_op_update_inode_force_wcc - try to update the inode attribute cache
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 4174faf73ec1..64f0dc41a9b7 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -224,7 +224,7 @@ int nfs_sockaddr_match_ipaddr(const struct sockaddr *, const struct sockaddr *);
224#endif 224#endif
225 225
226/* nfs3client.c */ 226/* nfs3client.c */
227#ifdef CONFIG_NFS_V3 227#if IS_ENABLED(CONFIG_NFS_V3)
228struct nfs_server *nfs3_create_server(struct nfs_mount_info *, struct nfs_subversion *); 228struct nfs_server *nfs3_create_server(struct nfs_mount_info *, struct nfs_subversion *);
229struct nfs_server *nfs3_clone_server(struct nfs_server *, struct nfs_fh *, 229struct nfs_server *nfs3_clone_server(struct nfs_server *, struct nfs_fh *,
230 struct nfs_fattr *, rpc_authflavor_t); 230 struct nfs_fattr *, rpc_authflavor_t);
diff --git a/fs/nfs/nfs.h b/fs/nfs/nfs.h
index f5d1cf5f5dc7..3e1b84baa57f 100644
--- a/fs/nfs/nfs.h
+++ b/fs/nfs/nfs.h
@@ -24,20 +24,6 @@ struct nfs_subversion {
24int nfs_register_versions(void); 24int nfs_register_versions(void);
25void nfs_unregister_versions(void); 25void nfs_unregister_versions(void);
26 26
27#ifdef CONFIG_NFS_V3
28int init_nfs_v3(void);
29void exit_nfs_v3(void);
30#else /* CONFIG_NFS_V3 */
31static inline int __init init_nfs_v3(void)
32{
33 return 0;
34}
35
36static inline void exit_nfs_v3(void)
37{
38}
39#endif /* CONFIG_NFS_V3 */
40
41#ifdef CONFIG_NFS_V4 27#ifdef CONFIG_NFS_V4
42int init_nfs_v4(void); 28int init_nfs_v4(void);
43void exit_nfs_v4(void); 29void exit_nfs_v4(void);
diff --git a/fs/nfs/nfs3super.c b/fs/nfs/nfs3super.c
index 8378090b8104..cc471c725230 100644
--- a/fs/nfs/nfs3super.c
+++ b/fs/nfs/nfs3super.c
@@ -14,13 +14,18 @@ static struct nfs_subversion nfs_v3 = {
14 .sops = &nfs_sops, 14 .sops = &nfs_sops,
15}; 15};
16 16
17int __init init_nfs_v3(void) 17static int __init init_nfs_v3(void)
18{ 18{
19 register_nfs_version(&nfs_v3); 19 register_nfs_version(&nfs_v3);
20 return 0; 20 return 0;
21} 21}
22 22
23void exit_nfs_v3(void) 23static void __exit exit_nfs_v3(void)
24{ 24{
25 unregister_nfs_version(&nfs_v3); 25 unregister_nfs_version(&nfs_v3);
26} 26}
27
28MODULE_LICENSE("GPL");
29
30module_init(init_nfs_v3);
31module_exit(exit_nfs_v3);
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 999ce7505142..558a85c9594a 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -69,7 +69,7 @@
69#define NFSDBG_FACILITY NFSDBG_VFS 69#define NFSDBG_FACILITY NFSDBG_VFS
70#define NFS_TEXT_DATA 1 70#define NFS_TEXT_DATA 1
71 71
72#ifdef CONFIG_NFS_V3 72#if IS_ENABLED(CONFIG_NFS_V3)
73#define NFS_DEFAULT_VERSION 3 73#define NFS_DEFAULT_VERSION 3
74#else 74#else
75#define NFS_DEFAULT_VERSION 2 75#define NFS_DEFAULT_VERSION 2
@@ -1876,7 +1876,7 @@ static int nfs23_validate_mount_data(void *options,
1876 return NFS_TEXT_DATA; 1876 return NFS_TEXT_DATA;
1877 } 1877 }
1878 1878
1879#ifndef CONFIG_NFS_V3 1879#if !IS_ENABLED(CONFIG_NFS_V3)
1880 if (args->version == 3) 1880 if (args->version == 3)
1881 goto out_v3_not_compiled; 1881 goto out_v3_not_compiled;
1882#endif /* !CONFIG_NFS_V3 */ 1882#endif /* !CONFIG_NFS_V3 */
@@ -1896,7 +1896,7 @@ out_no_sec:
1896 dfprintk(MOUNT, "NFS: nfs_mount_data version supports only AUTH_SYS\n"); 1896 dfprintk(MOUNT, "NFS: nfs_mount_data version supports only AUTH_SYS\n");
1897 return -EINVAL; 1897 return -EINVAL;
1898 1898
1899#ifndef CONFIG_NFS_V3 1899#if !IS_ENABLED(CONFIG_NFS_V3)
1900out_v3_not_compiled: 1900out_v3_not_compiled:
1901 dfprintk(MOUNT, "NFS: NFSv3 is not compiled into kernel\n"); 1901 dfprintk(MOUNT, "NFS: NFSv3 is not compiled into kernel\n");
1902 return -EPROTONOSUPPORT; 1902 return -EPROTONOSUPPORT;
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 1e8d4b043769..f268fe4f2785 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -446,7 +446,7 @@ nfs_mark_request_dirty(struct nfs_page *req)
446 __set_page_dirty_nobuffers(req->wb_page); 446 __set_page_dirty_nobuffers(req->wb_page);
447} 447}
448 448
449#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 449#if IS_ENABLED(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
450/** 450/**
451 * nfs_request_add_commit_list - add request to a commit list 451 * nfs_request_add_commit_list - add request to a commit list
452 * @req: pointer to a struct nfs_page 452 * @req: pointer to a struct nfs_page
@@ -636,7 +636,7 @@ out:
636 hdr->release(hdr); 636 hdr->release(hdr);
637} 637}
638 638
639#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 639#if IS_ENABLED(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
640static unsigned long 640static unsigned long
641nfs_reqs_to_commit(struct nfs_commit_info *cinfo) 641nfs_reqs_to_commit(struct nfs_commit_info *cinfo)
642{ 642{
@@ -1298,7 +1298,7 @@ void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
1298 return; 1298 return;
1299 nfs_add_stats(inode, NFSIOS_SERVERWRITTENBYTES, resp->count); 1299 nfs_add_stats(inode, NFSIOS_SERVERWRITTENBYTES, resp->count);
1300 1300
1301#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 1301#if IS_ENABLED(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
1302 if (resp->verf->committed < argp->stable && task->tk_status >= 0) { 1302 if (resp->verf->committed < argp->stable && task->tk_status >= 0) {
1303 /* We tried a write call, but the server did not 1303 /* We tried a write call, but the server did not
1304 * commit data to stable storage even though we 1304 * commit data to stable storage even though we
@@ -1358,7 +1358,7 @@ void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
1358} 1358}
1359 1359
1360 1360
1361#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 1361#if IS_ENABLED(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
1362static int nfs_commit_set_lock(struct nfs_inode *nfsi, int may_wait) 1362static int nfs_commit_set_lock(struct nfs_inode *nfsi, int may_wait)
1363{ 1363{
1364 int ret; 1364 int ret;