Whamcloud - gitweb
e248be754866bb8c7d0169ae1e87a9bb310e871a
[fs/lustre-release.git] / lustre / llite / super.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Lustre Light Super operations
5  *
6  *  Copyright (c) 2002, 2003 Cluster File Systems, Inc.
7  *
8  *   This file is part of Lustre, http://www.lustre.org.
9  *
10  *   Lustre is free software; you can redistribute it and/or
11  *   modify it under the terms of version 2 of the GNU General Public
12  *   License as published by the Free Software Foundation.
13  *
14  *   Lustre is distributed in the hope that it will be useful,
15  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *   GNU General Public License for more details.
18  *
19  *   You should have received a copy of the GNU General Public License
20  *   along with Lustre; if not, write to the Free Software
21  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  */
23
24 #define DEBUG_SUBSYSTEM S_LLITE
25
26 #include <linux/module.h>
27 #include <linux/types.h>
28 #include <linux/random.h>
29 #include <linux/version.h>
30 #include <linux/lustre_lite.h>
31 #include <linux/lustre_ha.h>
32 #include <linux/lustre_dlm.h>
33 #include <linux/init.h>
34 #include <linux/fs.h>
35 #include <linux/lprocfs_status.h>
36 #include "llite_internal.h"
37
38 extern struct address_space_operations ll_aops;
39 extern struct address_space_operations ll_dir_aops;
40
41 static struct super_block *ll_read_super(struct super_block *sb,
42                                          void *data, int silent)
43 {
44         int err;
45         ENTRY;
46         err = ll_fill_super(sb, data, silent);
47         if (err)
48                 RETURN(NULL);
49         RETURN(sb);
50 }
51
52 static struct super_block *lustre_read_super(struct super_block *sb,
53                                          void *data, int silent)
54 {
55         int err;
56         ENTRY;
57         err = lustre_fill_super(sb, data, silent);
58         if (err)
59                 RETURN(NULL);
60         RETURN(sb);
61 }
62
63 /* exported operations */
64 struct super_operations ll_super_operations =
65 {
66         read_inode2: ll_read_inode2,
67         clear_inode: ll_clear_inode,
68         //        delete_inode: ll_delete_inode,
69         put_super: ll_put_super,
70         statfs: ll_statfs,
71         umount_begin: ll_umount_begin,
72         fh_to_dentry: ll_fh_to_dentry,
73         dentry_to_fh: ll_dentry_to_fh
74 };
75
76 static struct file_system_type lustre_lite_fs_type = {
77         name:           "lustre_lite",
78         fs_flags:       FS_NFSEXP_FSID,
79         read_super:     ll_read_super,
80         owner:          THIS_MODULE,
81 };
82
83 /* exported operations */
84 struct super_operations lustre_super_operations =
85 {
86         read_inode2: ll_read_inode2,
87         clear_inode: ll_clear_inode,
88         //        delete_inode: ll_delete_inode,
89         put_super: lustre_put_super,
90         statfs: ll_statfs,
91         umount_begin: ll_umount_begin,
92         fh_to_dentry: ll_fh_to_dentry,
93         dentry_to_fh: ll_dentry_to_fh
94 };
95
96 static struct file_system_type lustre_fs_type = {
97         name:           "lustre",
98         fs_flags:       FS_NFSEXP_FSID,
99         read_super:     lustre_read_super,
100         owner:          THIS_MODULE,
101 };
102
103 static int __init init_lustre_lite(void)
104 {
105         int rc;
106
107         printk(KERN_INFO "Lustre: Lustre Lite Client File System; "
108                "info@clusterfs.com\n");
109         ll_file_data_slab = kmem_cache_create("ll_file_data",
110                                               sizeof(struct ll_file_data), 0,
111                                               SLAB_HWCACHE_ALIGN, NULL, NULL);
112         if (ll_file_data_slab == NULL)
113                 return -ENOMEM;
114
115         proc_lustre_fs_root = proc_lustre_root ? proc_mkdir("llite", proc_lustre_root) : NULL;
116
117         rc = register_filesystem(&lustre_lite_fs_type);
118         if (rc == 0)
119                 rc = register_filesystem(&lustre_fs_type);
120         if (rc)
121                 unregister_filesystem(&lustre_lite_fs_type);
122         return rc;
123 }
124
125 static void __exit exit_lustre_lite(void)
126 {
127         unregister_filesystem(&lustre_lite_fs_type);
128         unregister_filesystem(&lustre_fs_type);
129
130         kmem_cache_destroy(ll_file_data_slab);
131
132         if (proc_lustre_fs_root) {
133                 lprocfs_remove(proc_lustre_fs_root);
134                 proc_lustre_fs_root = NULL;
135         }
136 }
137
138 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
139 MODULE_DESCRIPTION("Lustre Lite Client File System");
140 MODULE_LICENSE("GPL");
141
142 module_init(init_lustre_lite);
143 module_exit(exit_lustre_lite);