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 <lustre_lite.h>
31 #include <lustre_ha.h>
32 #include <lustre_dlm.h>
33 #include <linux/init.h>
35 #include <linux/random.h>
36 #include <linux/cache_def.h>
37 #include <lprocfs_status.h>
38 #include "llite_internal.h"
39 #include <lustre/lustre_user.h>
41 extern struct address_space_operations ll_aops;
42 extern struct address_space_operations ll_dir_aops;
45 /* exported operations */
46 struct super_operations lustre_super_operations =
48 .read_inode2 = ll_read_inode2,
49 .clear_inode = ll_clear_inode,
50 .delete_inode = ll_delete_inode,
51 .put_super = ll_put_super,
53 .umount_begin = ll_umount_begin,
54 .fh_to_dentry = ll_fh_to_dentry,
55 .dentry_to_fh = ll_dentry_to_fh,
56 .remount_fs = ll_remount_fs,
60 void lustre_register_client_process_config(int (*cpc)(struct lustre_cfg *lcfg));
62 static int __init init_lustre_lite(void)
66 printk(KERN_INFO "Lustre: Lustre Client File System; "
67 "info@clusterfs.com\n");
68 ll_file_data_slab = kmem_cache_create("ll_file_data",
69 sizeof(struct ll_file_data), 0,
70 SLAB_HWCACHE_ALIGN, NULL, NULL);
71 if (ll_file_data_slab == NULL)
74 LASSERT(ll_remote_perm_cachep == NULL);
75 ll_remote_perm_cachep = kmem_cache_create("ll_remote_perm",
76 sizeof(struct ll_remote_perm),
77 0, SLAB_HWCACHE_ALIGN, NULL,
79 if (!ll_remote_perm_cachep) {
80 kmem_cache_destroy(ll_file_data_slab);
81 ll_file_data_slab = NULL;
85 LASSERT(ll_rmtperm_hash_cachep == NULL);
86 ll_rmtperm_hash_cachep = kmem_cache_create("ll_rmtperm_hash",
87 REMOTE_PERM_HASHSIZE *
88 sizeof(struct list_head),
89 0, SLAB_HWCACHE_ALIGN, NULL,
91 if (!ll_rmtperm_hash_cachep) {
92 kmem_cache_destroy(ll_remote_perm_cachep);
93 kmem_cache_destroy(ll_file_data_slab);
94 ll_remote_perm_cachep = NULL;
95 ll_file_data_slab = NULL;
100 proc_lustre_fs_root = proc_mkdir("llite", proc_lustre_root);
102 ll_register_cache(&ll_cache_definition);
104 lustre_register_client_fill_super(ll_fill_super);
105 lustre_register_client_process_config(ll_process_config);
107 get_random_bytes(seed, sizeof(seed));
108 ll_srand(seed[0], seed[1]);
113 static void __exit exit_lustre_lite(void)
117 lustre_register_client_fill_super(NULL);
118 lustre_register_client_process_config(NULL);
120 ll_unregister_cache(&ll_cache_definition);
122 rc = kmem_cache_destroy(ll_rmtperm_hash_cachep);
123 LASSERTF(rc == 0, "couldn't destroy ll_rmtperm_hash_cachep\n");
124 ll_rmtperm_hash_cachep = NULL;
126 rc = kmem_cache_destroy(ll_remote_perm_cachep);
127 LASSERTF(rc == 0, "couldn't destroy ll_remote_perm_cachep\n");
128 ll_remote_perm_cachep = NULL;
130 rc = kmem_cache_destroy(ll_file_data_slab);
131 LASSERTF(rc == 0, "couldn't destroy ll_file_data slab\n");
132 if (ll_async_page_slab) {
133 rc = kmem_cache_destroy(ll_async_page_slab);
134 LASSERTF(rc == 0, "couldn't destroy ll_async_page slab\n");
137 if (proc_lustre_fs_root) {
138 lprocfs_remove(proc_lustre_fs_root);
139 proc_lustre_fs_root = NULL;
143 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
144 MODULE_DESCRIPTION("Lustre Lite Client File System");
145 MODULE_LICENSE("GPL");
147 module_init(init_lustre_lite);
148 module_exit(exit_lustre_lite);