Commit | Line | Data |
---|---|---|
06b3db1b DH |
1 | /* General filesystem local caching manager |
2 | * | |
3 | * Copyright (C) 2004-2007 Red Hat, Inc. All Rights Reserved. | |
4 | * Written by David Howells (dhowells@redhat.com) | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version | |
9 | * 2 of the License, or (at your option) any later version. | |
10 | */ | |
11 | ||
12 | #define FSCACHE_DEBUG_LEVEL CACHE | |
13 | #include <linux/module.h> | |
14 | #include <linux/init.h> | |
15 | #include <linux/sched.h> | |
16 | #include <linux/completion.h> | |
17 | #include <linux/slab.h> | |
18 | #include "internal.h" | |
19 | ||
20 | MODULE_DESCRIPTION("FS Cache Manager"); | |
21 | MODULE_AUTHOR("Red Hat, Inc."); | |
22 | MODULE_LICENSE("GPL"); | |
23 | ||
24 | unsigned fscache_defer_lookup = 1; | |
25 | module_param_named(defer_lookup, fscache_defer_lookup, uint, | |
26 | S_IWUSR | S_IRUGO); | |
27 | MODULE_PARM_DESC(fscache_defer_lookup, | |
28 | "Defer cookie lookup to background thread"); | |
29 | ||
30 | unsigned fscache_defer_create = 1; | |
31 | module_param_named(defer_create, fscache_defer_create, uint, | |
32 | S_IWUSR | S_IRUGO); | |
33 | MODULE_PARM_DESC(fscache_defer_create, | |
34 | "Defer cookie creation to background thread"); | |
35 | ||
36 | unsigned fscache_debug; | |
37 | module_param_named(debug, fscache_debug, uint, | |
38 | S_IWUSR | S_IRUGO); | |
39 | MODULE_PARM_DESC(fscache_debug, | |
40 | "FS-Cache debugging mask"); | |
41 | ||
42 | struct kobject *fscache_root; | |
43 | ||
44 | /* | |
45 | * initialise the fs caching module | |
46 | */ | |
47 | static int __init fscache_init(void) | |
48 | { | |
49 | int ret; | |
50 | ||
51 | ret = slow_work_register_user(); | |
52 | if (ret < 0) | |
53 | goto error_slow_work; | |
54 | ||
7394daa8 DH |
55 | ret = fscache_proc_init(); |
56 | if (ret < 0) | |
57 | goto error_proc; | |
58 | ||
4c515dd4 DH |
59 | fscache_root = kobject_create_and_add("fscache", kernel_kobj); |
60 | if (!fscache_root) | |
61 | goto error_kobj; | |
62 | ||
06b3db1b DH |
63 | printk(KERN_NOTICE "FS-Cache: Loaded\n"); |
64 | return 0; | |
65 | ||
4c515dd4 DH |
66 | error_kobj: |
67 | fscache_proc_cleanup(); | |
7394daa8 DH |
68 | error_proc: |
69 | slow_work_unregister_user(); | |
06b3db1b DH |
70 | error_slow_work: |
71 | return ret; | |
72 | } | |
73 | ||
74 | fs_initcall(fscache_init); | |
75 | ||
76 | /* | |
77 | * clean up on module removal | |
78 | */ | |
79 | static void __exit fscache_exit(void) | |
80 | { | |
81 | _enter(""); | |
82 | ||
4c515dd4 | 83 | kobject_put(fscache_root); |
7394daa8 | 84 | fscache_proc_cleanup(); |
06b3db1b DH |
85 | slow_work_unregister_user(); |
86 | printk(KERN_NOTICE "FS-Cache: Unloaded\n"); | |
87 | } | |
88 | ||
89 | module_exit(fscache_exit); |