Whamcloud - gitweb
land b_v26 (20040316_1603)
[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/random.h>
28 #include <linux/version.h>
29 #include <linux/lustre_lite.h>
30 #include <linux/lustre_ha.h>
31 #include <linux/lustre_dlm.h>
32 #include <linux/init.h>
33 #include <linux/fs.h>
34 #include <linux/lprocfs_status.h>
35 #include "llite_internal.h"
36
37 extern struct address_space_operations ll_aops;
38 extern struct address_space_operations ll_dir_aops;
39
40 static struct super_block *ll_read_super(struct super_block *sb,
41                                          void *data, int silent)
42 {
43         int err;
44         ENTRY;
45         err = ll_fill_super(sb, data, silent);
46         if (err)
47                 RETURN(NULL);
48         RETURN(sb);
49 }
50
51 static struct super_block *lustre_read_super(struct super_block *sb,
52                                          void *data, int silent)
53 {
54         int err;
55         ENTRY;
56         err = lustre_fill_super(sb, data, silent);
57         if (err)
58                 RETURN(NULL);
59         RETURN(sb);
60 }
61
62 /* exported operations */
63 struct super_operations ll_super_operations =
64 {
65         read_inode2: ll_read_inode2,
66         clear_inode: ll_clear_inode,
67         //        delete_inode: ll_delete_inode,
68         put_super: ll_put_super,
69         statfs: ll_statfs,
70         umount_begin: ll_umount_begin,
71         fh_to_dentry: ll_fh_to_dentry,
72         dentry_to_fh: ll_dentry_to_fh
73 };
74
75 static struct file_system_type lustre_lite_fs_type = {
76         name:           "lustre_lite",
77         fs_flags:       FS_NFSEXP_FSID,
78         read_super:     ll_read_super,
79         owner:          THIS_MODULE,
80 };
81
82 /* exported operations */
83 struct super_operations lustre_super_operations =
84 {
85         read_inode2: ll_read_inode2,
86         clear_inode: ll_clear_inode,
87         //        delete_inode: ll_delete_inode,
88         put_super: lustre_put_super,
89         statfs: ll_statfs,
90         umount_begin: ll_umount_begin,
91         fh_to_dentry: ll_fh_to_dentry,
92         dentry_to_fh: ll_dentry_to_fh
93 };
94
95 static struct file_system_type lustre_fs_type = {
96         name:           "lustre",
97         fs_flags:       FS_NFSEXP_FSID,
98         read_super:     lustre_read_super,
99         owner:          THIS_MODULE,
100 };
101
102 static int __init init_lustre_lite(void)
103 {
104         int rc;
105
106         printk(KERN_INFO "Lustre: Lustre Lite Client File System; "
107                "info@clusterfs.com\n");
108         ll_file_data_slab = kmem_cache_create("ll_file_data",
109                                               sizeof(struct ll_file_data), 0,
110                                               SLAB_HWCACHE_ALIGN, NULL, NULL);
111         if (ll_file_data_slab == NULL)
112                 return -ENOMEM;
113
114         proc_lustre_fs_root = proc_lustre_root ? proc_mkdir("llite", proc_lustre_root) : NULL;
115
116         rc = register_filesystem(&lustre_lite_fs_type);
117         if (rc == 0)
118                 rc = register_filesystem(&lustre_fs_type);
119         if (rc)
120                 unregister_filesystem(&lustre_lite_fs_type);
121         return rc;
122 }
123
124 static void __exit exit_lustre_lite(void)
125 {
126         unregister_filesystem(&lustre_lite_fs_type);
127         unregister_filesystem(&lustre_fs_type);
128
129         kmem_cache_destroy(ll_file_data_slab);
130
131         if (proc_lustre_fs_root) {
132                 lprocfs_remove(proc_lustre_fs_root);
133                 proc_lustre_fs_root = NULL;
134         }
135 }
136
137 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
138 MODULE_DESCRIPTION("Lustre Lite Client File System");
139 MODULE_LICENSE("GPL");
140
141 module_init(init_lustre_lite);
142 module_exit(exit_lustre_lite);