diff options
author | Bryan Schumaker <bjschuma@netapp.com> | 2012-07-16 16:39:14 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-07-17 13:33:18 -0400 |
commit | 466bfe7f4a5bee4cdd73d3f6bd290173a8c75a40 (patch) | |
tree | 1b05eafffa8d48b9ba89bde693495daa80395d56 /fs/nfs | |
parent | 129d1977ed39cbb4f091a518e4a12498c04f45ba (diff) |
NFS: Initialize v4 sysctls from nfs_init_v4()
And split them out of the generic client into their own file.
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/Makefile | 7 | ||||
-rw-r--r-- | fs/nfs/nfs4_fs.h | 15 | ||||
-rw-r--r-- | fs/nfs/nfs4super.c | 9 | ||||
-rw-r--r-- | fs/nfs/nfs4sysctl.c | 68 | ||||
-rw-r--r-- | fs/nfs/sysctl.c | 26 |
5 files changed, 98 insertions, 27 deletions
diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile index 162a699134ca..4a78e76440f8 100644 --- a/fs/nfs/Makefile +++ b/fs/nfs/Makefile | |||
@@ -17,7 +17,12 @@ nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \ | |||
17 | callback.o callback_xdr.o callback_proc.o \ | 17 | callback.o callback_xdr.o callback_proc.o \ |
18 | nfs4namespace.o | 18 | nfs4namespace.o |
19 | nfs-$(CONFIG_NFS_V4_1) += pnfs.o pnfs_dev.o | 19 | nfs-$(CONFIG_NFS_V4_1) += pnfs.o pnfs_dev.o |
20 | nfs-$(CONFIG_SYSCTL) += sysctl.o | 20 | |
21 | ifeq ($(CONFIG_SYSCTL), y) | ||
22 | nfs-y += sysctl.o | ||
23 | nfs-$(CONFIG_NFS_V4) += nfs4sysctl.o | ||
24 | endif | ||
25 | |||
21 | nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o | 26 | nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o |
22 | 27 | ||
23 | obj-$(CONFIG_PNFS_FILE_LAYOUT) += nfs_layout_nfsv41_files.o | 28 | obj-$(CONFIG_PNFS_FILE_LAYOUT) += nfs_layout_nfsv41_files.o |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 1a6ed3f9a32a..b508fef1a32b 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -368,6 +368,21 @@ extern const nfs4_stateid zero_stateid; | |||
368 | int init_nfs_v4(void); | 368 | int init_nfs_v4(void); |
369 | void exit_nfs_v4(void); | 369 | void exit_nfs_v4(void); |
370 | 370 | ||
371 | /* nfs4sysctl.c */ | ||
372 | #ifdef CONFIG_SYSCTL | ||
373 | int nfs4_register_sysctl(void); | ||
374 | void nfs4_unregister_sysctl(void); | ||
375 | #else | ||
376 | static inline int nfs4_register_sysctl(void) | ||
377 | { | ||
378 | return 0; | ||
379 | } | ||
380 | |||
381 | static inline int nfs4_unregister_sysctl(void) | ||
382 | { | ||
383 | } | ||
384 | #endif | ||
385 | |||
371 | /* nfs4xdr.c */ | 386 | /* nfs4xdr.c */ |
372 | extern struct rpc_procinfo nfs4_procedures[]; | 387 | extern struct rpc_procinfo nfs4_procedures[]; |
373 | 388 | ||
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c index 366e41459695..70c394e75ca1 100644 --- a/fs/nfs/nfs4super.c +++ b/fs/nfs/nfs4super.c | |||
@@ -3,6 +3,8 @@ | |||
3 | */ | 3 | */ |
4 | #include <linux/init.h> | 4 | #include <linux/init.h> |
5 | #include <linux/nfs_idmap.h> | 5 | #include <linux/nfs_idmap.h> |
6 | #include <linux/nfs_fs.h> | ||
7 | #include "nfs4_fs.h" | ||
6 | 8 | ||
7 | int __init init_nfs_v4(void) | 9 | int __init init_nfs_v4(void) |
8 | { | 10 | { |
@@ -12,12 +14,19 @@ int __init init_nfs_v4(void) | |||
12 | if (err) | 14 | if (err) |
13 | goto out; | 15 | goto out; |
14 | 16 | ||
17 | err = nfs4_register_sysctl(); | ||
18 | if (err) | ||
19 | goto out1; | ||
20 | |||
15 | return 0; | 21 | return 0; |
22 | out1: | ||
23 | nfs_idmap_quit(); | ||
16 | out: | 24 | out: |
17 | return err; | 25 | return err; |
18 | } | 26 | } |
19 | 27 | ||
20 | void __exit exit_nfs_v4(void) | 28 | void __exit exit_nfs_v4(void) |
21 | { | 29 | { |
30 | nfs4_unregister_sysctl(); | ||
22 | nfs_idmap_quit(); | 31 | nfs_idmap_quit(); |
23 | } | 32 | } |
diff --git a/fs/nfs/nfs4sysctl.c b/fs/nfs/nfs4sysctl.c new file mode 100644 index 000000000000..5729bc8aa75d --- /dev/null +++ b/fs/nfs/nfs4sysctl.c | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * linux/fs/nfs/nfs4sysctl.c | ||
3 | * | ||
4 | * Sysctl interface to NFS v4 parameters | ||
5 | * | ||
6 | * Copyright (c) 2006 Trond Myklebust <Trond.Myklebust@netapp.com> | ||
7 | */ | ||
8 | #include <linux/sysctl.h> | ||
9 | #include <linux/nfs_idmap.h> | ||
10 | #include <linux/nfs_fs.h> | ||
11 | |||
12 | #include "callback.h" | ||
13 | |||
14 | static const int nfs_set_port_min = 0; | ||
15 | static const int nfs_set_port_max = 65535; | ||
16 | static struct ctl_table_header *nfs4_callback_sysctl_table; | ||
17 | |||
18 | static ctl_table nfs4_cb_sysctls[] = { | ||
19 | { | ||
20 | .procname = "nfs_callback_tcpport", | ||
21 | .data = &nfs_callback_set_tcpport, | ||
22 | .maxlen = sizeof(int), | ||
23 | .mode = 0644, | ||
24 | .proc_handler = proc_dointvec_minmax, | ||
25 | .extra1 = (int *)&nfs_set_port_min, | ||
26 | .extra2 = (int *)&nfs_set_port_max, | ||
27 | }, | ||
28 | { | ||
29 | .procname = "idmap_cache_timeout", | ||
30 | .data = &nfs_idmap_cache_timeout, | ||
31 | .maxlen = sizeof(int), | ||
32 | .mode = 0644, | ||
33 | .proc_handler = proc_dointvec_jiffies, | ||
34 | }, | ||
35 | { } | ||
36 | }; | ||
37 | |||
38 | static ctl_table nfs4_cb_sysctl_dir[] = { | ||
39 | { | ||
40 | .procname = "nfs", | ||
41 | .mode = 0555, | ||
42 | .child = nfs4_cb_sysctls, | ||
43 | }, | ||
44 | { } | ||
45 | }; | ||
46 | |||
47 | static ctl_table nfs4_cb_sysctl_root[] = { | ||
48 | { | ||
49 | .procname = "fs", | ||
50 | .mode = 0555, | ||
51 | .child = nfs4_cb_sysctl_dir, | ||
52 | }, | ||
53 | { } | ||
54 | }; | ||
55 | |||
56 | int nfs4_register_sysctl(void) | ||
57 | { | ||
58 | nfs4_callback_sysctl_table = register_sysctl_table(nfs4_cb_sysctl_root); | ||
59 | if (nfs4_callback_sysctl_table == NULL) | ||
60 | return -ENOMEM; | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | void nfs4_unregister_sysctl(void) | ||
65 | { | ||
66 | unregister_sysctl_table(nfs4_callback_sysctl_table); | ||
67 | nfs4_callback_sysctl_table = NULL; | ||
68 | } | ||
diff --git a/fs/nfs/sysctl.c b/fs/nfs/sysctl.c index ad4d2e787b20..6b3f2535a3ec 100644 --- a/fs/nfs/sysctl.c +++ b/fs/nfs/sysctl.c | |||
@@ -9,37 +9,11 @@ | |||
9 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
10 | #include <linux/sysctl.h> | 10 | #include <linux/sysctl.h> |
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/nfs4.h> | ||
13 | #include <linux/nfs_idmap.h> | ||
14 | #include <linux/nfs_fs.h> | 12 | #include <linux/nfs_fs.h> |
15 | 13 | ||
16 | #include "callback.h" | ||
17 | |||
18 | #ifdef CONFIG_NFS_V4 | ||
19 | static const int nfs_set_port_min = 0; | ||
20 | static const int nfs_set_port_max = 65535; | ||
21 | #endif | ||
22 | static struct ctl_table_header *nfs_callback_sysctl_table; | 14 | static struct ctl_table_header *nfs_callback_sysctl_table; |
23 | 15 | ||
24 | static ctl_table nfs_cb_sysctls[] = { | 16 | static ctl_table nfs_cb_sysctls[] = { |
25 | #ifdef CONFIG_NFS_V4 | ||
26 | { | ||
27 | .procname = "nfs_callback_tcpport", | ||
28 | .data = &nfs_callback_set_tcpport, | ||
29 | .maxlen = sizeof(int), | ||
30 | .mode = 0644, | ||
31 | .proc_handler = proc_dointvec_minmax, | ||
32 | .extra1 = (int *)&nfs_set_port_min, | ||
33 | .extra2 = (int *)&nfs_set_port_max, | ||
34 | }, | ||
35 | { | ||
36 | .procname = "idmap_cache_timeout", | ||
37 | .data = &nfs_idmap_cache_timeout, | ||
38 | .maxlen = sizeof(int), | ||
39 | .mode = 0644, | ||
40 | .proc_handler = proc_dointvec_jiffies, | ||
41 | }, | ||
42 | #endif | ||
43 | { | 17 | { |
44 | .procname = "nfs_mountpoint_timeout", | 18 | .procname = "nfs_mountpoint_timeout", |
45 | .data = &nfs_mountpoint_expiry_timeout, | 19 | .data = &nfs_mountpoint_expiry_timeout, |