1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Lustre Light Super operations
6 * Copyright (c) 2002, 2003 Cluster File Systems, Inc.
8 * This file is part of Lustre, http://www.lustre.org.
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.
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.
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.
24 #define DEBUG_SUBSYSTEM S_LLITE
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>
35 #include <linux/lprocfs_status.h>
36 #include "llite_internal.h"
37 #include <lustre/lustre_user.h>
39 extern struct address_space_operations ll_aops;
40 extern struct address_space_operations ll_dir_aops;
41 extern struct timer_list ll_capa_timer;
43 static struct super_block *ll_read_super(struct super_block *sb,
44 void *data, int silent)
48 err = ll_fill_super(sb, data, silent);
54 static struct super_block *lustre_read_super(struct super_block *sb,
55 void *data, int silent)
59 err = lustre_fill_super(sb, data, silent);
65 static void ll_umount_lustre(struct super_block *sb)
67 struct ll_sb_info *sbi = ll_s2sbi(sb);
68 ll_gns_check_mounts(sbi, LL_GNS_UMOUNT);
71 static struct file_system_type lustre_lite_fs_type = {
73 .name = "lustre_lite",
74 .fs_flags = FS_NFSEXP_FSID,
75 .read_super = ll_read_super,
78 /* exported operations */
79 struct super_operations lustre_super_operations =
81 .read_inode2 = ll_read_inode2,
82 .clear_inode = ll_clear_inode,
83 .delete_inode = ll_delete_inode,
84 .put_super = lustre_put_super,
86 .umount_begin = ll_umount_begin,
87 .umount_lustre = ll_umount_lustre,
88 .fh_to_dentry = ll_fh_to_dentry,
89 .dentry_to_fh = ll_dentry_to_fh
92 static struct file_system_type lustre_fs_type = {
95 .fs_flags = FS_NFSEXP_FSID,
96 .read_super = lustre_read_super,
99 static int __init init_lustre_lite(void)
103 printk(KERN_INFO "Lustre: Lustre Lite Client File System; "
104 "info@clusterfs.com\n");
105 ll_file_data_slab = kmem_cache_create("ll_file_data",
106 sizeof(struct ll_file_data), 0,
107 SLAB_HWCACHE_ALIGN, NULL, NULL);
108 if (ll_file_data_slab == NULL)
111 ll_intent_slab = kmem_cache_create("lustre_intent_data",
112 sizeof(struct lustre_intent_data),
113 0, SLAB_HWCACHE_ALIGN, NULL,
115 if (ll_intent_slab == NULL) {
116 kmem_cache_destroy(ll_file_data_slab);
120 proc_lustre_fs_root = proc_lustre_root ? proc_mkdir("llite", proc_lustre_root) : NULL;
122 rc = register_filesystem(&lustre_lite_fs_type);
127 rc = register_filesystem(&lustre_fs_type);
132 rc = ll_gns_thread_start();
136 ll_capa_timer.function = ll_capa_timer_callback;
137 ll_capa_timer.data = 0;
138 init_timer(&ll_capa_timer);
140 rc = ll_capa_thread_start();
149 unregister_filesystem(&lustre_fs_type);
151 unregister_filesystem(&lustre_lite_fs_type);
153 kmem_cache_destroy(ll_intent_slab);
154 kmem_cache_destroy(ll_file_data_slab);
159 static void __exit exit_lustre_lite(void)
161 unregister_filesystem(&lustre_lite_fs_type);
162 unregister_filesystem(&lustre_fs_type);
164 del_timer(&ll_capa_timer);
165 ll_capa_thread_stop();
166 ll_gns_thread_stop();
168 LASSERTF(kmem_cache_destroy(ll_file_data_slab) == 0,
169 "couldn't destroy ll_file_data slab\n");
170 LASSERTF(kmem_cache_destroy(ll_intent_slab) == 0,
171 "couldn't destroy ll_intent_slab slab\n");
173 if (proc_lustre_fs_root) {
174 lprocfs_remove(proc_lustre_fs_root);
175 proc_lustre_fs_root = NULL;
179 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
180 MODULE_DESCRIPTION("Lustre Lite Client File System");
181 MODULE_LICENSE("GPL");
183 module_init(init_lustre_lite);
184 module_exit(exit_lustre_lite);