[GFS2] Macros removal in gfs2.h
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / fs / gfs2 / main.c
CommitLineData
b3b94faa
DT
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License v.2.
8 */
9
10#include <linux/sched.h>
11#include <linux/slab.h>
12#include <linux/spinlock.h>
13#include <linux/completion.h>
14#include <linux/buffer_head.h>
15#include <linux/module.h>
16#include <linux/init.h>
5c676f6d 17#include <linux/gfs2_ondisk.h>
b3b94faa
DT
18#include <asm/semaphore.h>
19
20#include "gfs2.h"
5c676f6d
SW
21#include "lm_interface.h"
22#include "incore.h"
b3b94faa
DT
23#include "ops_fstype.h"
24#include "sys.h"
5c676f6d 25#include "util.h"
b3b94faa
DT
26
27/**
28 * init_gfs2_fs - Register GFS2 as a filesystem
29 *
30 * Returns: 0 on success, error code on failure
31 */
32
33static int __init init_gfs2_fs(void)
34{
35 int error;
36
37 gfs2_init_lmh();
38
39 error = gfs2_sys_init();
40 if (error)
41 return error;
42
43 error = -ENOMEM;
44
45 gfs2_glock_cachep = kmem_cache_create("gfs2_glock",
46 sizeof(struct gfs2_glock),
47 0, 0, NULL, NULL);
48 if (!gfs2_glock_cachep)
49 goto fail;
50
51 gfs2_inode_cachep = kmem_cache_create("gfs2_inode",
52 sizeof(struct gfs2_inode),
53 0, 0, NULL, NULL);
54 if (!gfs2_inode_cachep)
55 goto fail;
56
57 gfs2_bufdata_cachep = kmem_cache_create("gfs2_bufdata",
58 sizeof(struct gfs2_bufdata),
59 0, 0, NULL, NULL);
60 if (!gfs2_bufdata_cachep)
61 goto fail;
62
63 error = register_filesystem(&gfs2_fs_type);
64 if (error)
65 goto fail;
66
67 printk("GFS2 (built %s %s) installed\n", __DATE__, __TIME__);
68
69 return 0;
70
71 fail:
72 if (gfs2_bufdata_cachep)
73 kmem_cache_destroy(gfs2_bufdata_cachep);
74
75 if (gfs2_inode_cachep)
76 kmem_cache_destroy(gfs2_inode_cachep);
77
78 if (gfs2_glock_cachep)
79 kmem_cache_destroy(gfs2_glock_cachep);
80
81 gfs2_sys_uninit();
82 return error;
83}
84
85/**
86 * exit_gfs2_fs - Unregister the file system
87 *
88 */
89
90static void __exit exit_gfs2_fs(void)
91{
92 unregister_filesystem(&gfs2_fs_type);
93
94 kmem_cache_destroy(gfs2_bufdata_cachep);
95 kmem_cache_destroy(gfs2_inode_cachep);
96 kmem_cache_destroy(gfs2_glock_cachep);
97
98 gfs2_sys_uninit();
99}
100
101MODULE_DESCRIPTION("Global File System");
102MODULE_AUTHOR("Red Hat, Inc.");
103MODULE_LICENSE("GPL");
104
105module_init(init_gfs2_fs);
106module_exit(exit_gfs2_fs);
107