diff options
author | David Howells <dhowells@redhat.com> | 2009-04-03 11:42:36 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2009-04-03 11:42:36 -0400 |
commit | 06b3db1b9bccdc8c2c743122a89745279e5ecc46 (patch) | |
tree | b60850bd899c1a87b5b372cfbf1e72cf380c862a /fs/fscache/main.c | |
parent | 0dfc41d1efcc4180abfd32f68f0ade540e636ff6 (diff) |
FS-Cache: Add main configuration option, module entry points and debugging
Add the main configuration option, allowing FS-Cache to be selected; the
module entry and exit functions and the debugging stuff used by these patches.
The two configuration options added are:
CONFIG_FSCACHE
CONFIG_FSCACHE_DEBUG
The first enables the facility, and the second makes the debugging statements
enableable through the "debug" module parameter. The value of this parameter
is a bitmask as described in:
Documentation/filesystems/caching/fscache.txt
The module can be loaded at this point, but all it will do at this point in
the patch series is to start up the slow work facility and shut it down again.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Tested-by: Daire Byrne <Daire.Byrne@framestore.com>
Diffstat (limited to 'fs/fscache/main.c')
-rw-r--r-- | fs/fscache/main.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/fs/fscache/main.c b/fs/fscache/main.c new file mode 100644 index 000000000000..76f7c69079c0 --- /dev/null +++ b/fs/fscache/main.c | |||
@@ -0,0 +1,75 @@ | |||
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 | |||
55 | printk(KERN_NOTICE "FS-Cache: Loaded\n"); | ||
56 | return 0; | ||
57 | |||
58 | error_slow_work: | ||
59 | return ret; | ||
60 | } | ||
61 | |||
62 | fs_initcall(fscache_init); | ||
63 | |||
64 | /* | ||
65 | * clean up on module removal | ||
66 | */ | ||
67 | static void __exit fscache_exit(void) | ||
68 | { | ||
69 | _enter(""); | ||
70 | |||
71 | slow_work_unregister_user(); | ||
72 | printk(KERN_NOTICE "FS-Cache: Unloaded\n"); | ||
73 | } | ||
74 | |||
75 | module_exit(fscache_exit); | ||