aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2012-07-16 16:39:13 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-07-17 13:33:13 -0400
commit129d1977ed39cbb4f091a518e4a12498c04f45ba (patch)
treea795a5885ba0abc2f7e22b18cf3a74c566f59684
parent73a79706d7f197a428a43fbf335bbe75cdbc221f (diff)
NFS: Create an init_nfs_v4() function
I want to initialize all of NFS v4 in a single function that will eventually be used as the v4 module init function. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/Makefile2
-rw-r--r--fs/nfs/inode.c67
-rw-r--r--fs/nfs/nfs4_fs.h4
-rw-r--r--fs/nfs/nfs4super.c23
4 files changed, 65 insertions, 31 deletions
diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile
index 7ddd45d9f170..162a699134ca 100644
--- a/fs/nfs/Makefile
+++ b/fs/nfs/Makefile
@@ -13,7 +13,7 @@ nfs-$(CONFIG_NFS_V2) += proc.o nfs2xdr.o
13nfs-$(CONFIG_NFS_V3) += nfs3proc.o nfs3xdr.o 13nfs-$(CONFIG_NFS_V3) += nfs3proc.o nfs3xdr.o
14nfs-$(CONFIG_NFS_V3_ACL) += nfs3acl.o 14nfs-$(CONFIG_NFS_V3_ACL) += nfs3acl.o
15nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \ 15nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \
16 delegation.o idmap.o \ 16 nfs4super.o delegation.o idmap.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
19nfs-$(CONFIG_NFS_V4_1) += pnfs.o pnfs_dev.o 19nfs-$(CONFIG_NFS_V4_1) += pnfs.o pnfs_dev.o
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 28c9ebbe78a6..35f7e4bc680e 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -32,7 +32,6 @@
32#include <linux/lockd/bind.h> 32#include <linux/lockd/bind.h>
33#include <linux/seq_file.h> 33#include <linux/seq_file.h>
34#include <linux/mount.h> 34#include <linux/mount.h>
35#include <linux/nfs_idmap.h>
36#include <linux/vfs.h> 35#include <linux/vfs.h>
37#include <linux/inet.h> 36#include <linux/inet.h>
38#include <linux/nfs_xdr.h> 37#include <linux/nfs_xdr.h>
@@ -1628,87 +1627,96 @@ static int __init init_nfs_fs(void)
1628{ 1627{
1629 int err; 1628 int err;
1630 1629
1631 err = nfs_idmap_init();
1632 if (err < 0)
1633 goto out10;
1634
1635 err = nfs_dns_resolver_init(); 1630 err = nfs_dns_resolver_init();
1636 if (err < 0) 1631 if (err < 0)
1637 goto out9; 1632 goto out11;
1638 1633
1639 err = register_pernet_subsys(&nfs_net_ops); 1634 err = register_pernet_subsys(&nfs_net_ops);
1640 if (err < 0) 1635 if (err < 0)
1641 goto out8; 1636 goto out10;
1642 1637
1643 err = nfs_fscache_register(); 1638 err = nfs_fscache_register();
1644 if (err < 0) 1639 if (err < 0)
1645 goto out7; 1640 goto out9;
1646 1641
1647 err = nfsiod_start(); 1642 err = nfsiod_start();
1648 if (err) 1643 if (err)
1649 goto out6; 1644 goto out8;
1650 1645
1651 err = nfs_fs_proc_init(); 1646 err = nfs_fs_proc_init();
1652 if (err) 1647 if (err)
1653 goto out5; 1648 goto out7;
1654 1649
1655 err = nfs_init_nfspagecache(); 1650 err = nfs_init_nfspagecache();
1656 if (err) 1651 if (err)
1657 goto out4; 1652 goto out6;
1658 1653
1659 err = nfs_init_inodecache(); 1654 err = nfs_init_inodecache();
1660 if (err) 1655 if (err)
1661 goto out3; 1656 goto out5;
1662 1657
1663 err = nfs_init_readpagecache(); 1658 err = nfs_init_readpagecache();
1664 if (err) 1659 if (err)
1665 goto out2; 1660 goto out4;
1666 1661
1667 err = nfs_init_writepagecache(); 1662 err = nfs_init_writepagecache();
1668 if (err) 1663 if (err)
1669 goto out1; 1664 goto out3;
1670 1665
1671 err = nfs_init_directcache(); 1666 err = nfs_init_directcache();
1672 if (err) 1667 if (err)
1673 goto out0; 1668 goto out2;
1674 1669
1675#ifdef CONFIG_PROC_FS 1670#ifdef CONFIG_PROC_FS
1676 rpc_proc_register(&init_net, &nfs_rpcstat); 1671 rpc_proc_register(&init_net, &nfs_rpcstat);
1677#endif 1672#endif
1673
1674#ifdef CONFIG_NFS_V4
1675 err = init_nfs_v4();
1676 if (err)
1677 goto out1;
1678#endif
1679
1678 if ((err = register_nfs_fs()) != 0) 1680 if ((err = register_nfs_fs()) != 0)
1679 goto out; 1681 goto out0;
1682
1680 return 0; 1683 return 0;
1681out: 1684out0:
1685#ifdef CONFIG_NFS_V4
1686 exit_nfs_v4();
1687out1:
1688#endif
1682#ifdef CONFIG_PROC_FS 1689#ifdef CONFIG_PROC_FS
1683 rpc_proc_unregister(&init_net, "nfs"); 1690 rpc_proc_unregister(&init_net, "nfs");
1684#endif 1691#endif
1685 nfs_destroy_directcache(); 1692 nfs_destroy_directcache();
1686out0:
1687 nfs_destroy_writepagecache();
1688out1:
1689 nfs_destroy_readpagecache();
1690out2: 1693out2:
1691 nfs_destroy_inodecache(); 1694 nfs_destroy_writepagecache();
1692out3: 1695out3:
1693 nfs_destroy_nfspagecache(); 1696 nfs_destroy_readpagecache();
1694out4: 1697out4:
1695 nfs_fs_proc_exit(); 1698 nfs_destroy_inodecache();
1696out5: 1699out5:
1697 nfsiod_stop(); 1700 nfs_destroy_nfspagecache();
1698out6: 1701out6:
1699 nfs_fscache_unregister(); 1702 nfs_fs_proc_exit();
1700out7: 1703out7:
1701 unregister_pernet_subsys(&nfs_net_ops); 1704 nfsiod_stop();
1702out8: 1705out8:
1703 nfs_dns_resolver_destroy(); 1706 nfs_fscache_unregister();
1704out9: 1707out9:
1705 nfs_idmap_quit(); 1708 unregister_pernet_subsys(&nfs_net_ops);
1706out10: 1709out10:
1710 nfs_dns_resolver_destroy();
1711out11:
1707 return err; 1712 return err;
1708} 1713}
1709 1714
1710static void __exit exit_nfs_fs(void) 1715static void __exit exit_nfs_fs(void)
1711{ 1716{
1717#ifdef CONFIG_NFS_V4
1718 exit_nfs_v4();
1719#endif
1712 nfs_destroy_directcache(); 1720 nfs_destroy_directcache();
1713 nfs_destroy_writepagecache(); 1721 nfs_destroy_writepagecache();
1714 nfs_destroy_readpagecache(); 1722 nfs_destroy_readpagecache();
@@ -1717,7 +1725,6 @@ static void __exit exit_nfs_fs(void)
1717 nfs_fscache_unregister(); 1725 nfs_fscache_unregister();
1718 unregister_pernet_subsys(&nfs_net_ops); 1726 unregister_pernet_subsys(&nfs_net_ops);
1719 nfs_dns_resolver_destroy(); 1727 nfs_dns_resolver_destroy();
1720 nfs_idmap_quit();
1721#ifdef CONFIG_PROC_FS 1728#ifdef CONFIG_PROC_FS
1722 rpc_proc_unregister(&init_net, "nfs"); 1729 rpc_proc_unregister(&init_net, "nfs");
1723#endif 1730#endif
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index e2c4c72d3866..1a6ed3f9a32a 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -364,6 +364,10 @@ extern void nfs4_free_lock_state(struct nfs_server *server, struct nfs4_lock_sta
364 364
365extern const nfs4_stateid zero_stateid; 365extern const nfs4_stateid zero_stateid;
366 366
367/* nfs4super.c */
368int init_nfs_v4(void);
369void exit_nfs_v4(void);
370
367/* nfs4xdr.c */ 371/* nfs4xdr.c */
368extern struct rpc_procinfo nfs4_procedures[]; 372extern struct rpc_procinfo nfs4_procedures[];
369 373
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c
new file mode 100644
index 000000000000..366e41459695
--- /dev/null
+++ b/fs/nfs/nfs4super.c
@@ -0,0 +1,23 @@
1/*
2 * Copyright (c) 2012 Bryan Schumaker <bjschuma@netapp.com>
3 */
4#include <linux/init.h>
5#include <linux/nfs_idmap.h>
6
7int __init init_nfs_v4(void)
8{
9 int err;
10
11 err = nfs_idmap_init();
12 if (err)
13 goto out;
14
15 return 0;
16out:
17 return err;
18}
19
20void __exit exit_nfs_v4(void)
21{
22 nfs_idmap_quit();
23}