Skip to content
Snippets Groups Projects
inode.c 55.3 KiB
Newer Older
  • Learn to ignore specific revisions
  • Linus Torvalds's avatar
    Linus Torvalds committed
    
    
    static void nfs_destroy_inodecache(void)
    
    Linus Torvalds's avatar
    Linus Torvalds committed
    {
    	if (kmem_cache_destroy(nfs_inode_cachep))
    		printk(KERN_INFO "nfs_inode_cache: not all structures were freed\n");
    }
    
    /*
     * Initialize NFS
     */
    static int __init init_nfs_fs(void)
    {
    	int err;
    
    	err = nfs_init_nfspagecache();
    	if (err)
    		goto out4;
    
    	err = nfs_init_inodecache();
    	if (err)
    		goto out3;
    
    	err = nfs_init_readpagecache();
    	if (err)
    		goto out2;
    
    	err = nfs_init_writepagecache();
    	if (err)
    		goto out1;
    
    #ifdef CONFIG_NFS_DIRECTIO
    	err = nfs_init_directcache();
    	if (err)
    		goto out0;
    #endif
    
    #ifdef CONFIG_PROC_FS
    	rpc_proc_register(&nfs_rpcstat);
    #endif
            err = register_filesystem(&nfs_fs_type);
    	if (err)
    		goto out;
    	if ((err = register_nfs4fs()) != 0)
    		goto out;
    	return 0;
    out:
    #ifdef CONFIG_PROC_FS
    	rpc_proc_unregister("nfs");
    #endif
    	nfs_destroy_writepagecache();
    #ifdef CONFIG_NFS_DIRECTIO
    out0:
    	nfs_destroy_directcache();
    #endif
    out1:
    	nfs_destroy_readpagecache();
    out2:
    	nfs_destroy_inodecache();
    out3:
    	nfs_destroy_nfspagecache();
    out4:
    	return err;
    }
    
    static void __exit exit_nfs_fs(void)
    {
    #ifdef CONFIG_NFS_DIRECTIO
    	nfs_destroy_directcache();
    #endif
    	nfs_destroy_writepagecache();
    	nfs_destroy_readpagecache();
    	nfs_destroy_inodecache();
    	nfs_destroy_nfspagecache();
    #ifdef CONFIG_PROC_FS
    	rpc_proc_unregister("nfs");
    #endif
    	unregister_filesystem(&nfs_fs_type);
    	unregister_nfs4fs();
    }
    
    /* Not quite true; I just maintain it */
    MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");
    MODULE_LICENSE("GPL");
    
    module_init(init_nfs_fs)
    module_exit(exit_nfs_fs)