summaryrefslogtreecommitdiffstats
path: root/fs/fscache/main.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2009-04-03 16:42:38 +0100
committerDavid Howells <dhowells@redhat.com>2009-04-03 16:42:38 +0100
commit955d00917f0c094e0f2fb88df967e980ab66b8ca (patch)
treec6109684239fd45462e494fb4f26aa8e2e651922 /fs/fscache/main.c
parent4c515dd47ab41be3f89e757d441661795470b376 (diff)
downloadop-kernel-dev-955d00917f0c094e0f2fb88df967e980ab66b8ca.zip
op-kernel-dev-955d00917f0c094e0f2fb88df967e980ab66b8ca.tar.gz
FS-Cache: Provide a slab for cookie allocation
Provide a slab from which can be allocated the FS-Cache cookies that will be presented to the netfs. Also provide a slab constructor and a function to recursively discard a cookie and its ancestor chain. 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.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/fscache/main.c b/fs/fscache/main.c
index c2f3e63..48b79d2 100644
--- a/fs/fscache/main.c
+++ b/fs/fscache/main.c
@@ -56,6 +56,18 @@ static int __init fscache_init(void)
if (ret < 0)
goto error_proc;
+ fscache_cookie_jar = kmem_cache_create("fscache_cookie_jar",
+ sizeof(struct fscache_cookie),
+ 0,
+ 0,
+ fscache_cookie_init_once);
+ if (!fscache_cookie_jar) {
+ printk(KERN_NOTICE
+ "FS-Cache: Failed to allocate a cookie jar\n");
+ ret = -ENOMEM;
+ goto error_cookie_jar;
+ }
+
fscache_root = kobject_create_and_add("fscache", kernel_kobj);
if (!fscache_root)
goto error_kobj;
@@ -64,6 +76,8 @@ static int __init fscache_init(void)
return 0;
error_kobj:
+ kmem_cache_destroy(fscache_cookie_jar);
+error_cookie_jar:
fscache_proc_cleanup();
error_proc:
slow_work_unregister_user();
@@ -81,6 +95,7 @@ static void __exit fscache_exit(void)
_enter("");
kobject_put(fscache_root);
+ kmem_cache_destroy(fscache_cookie_jar);
fscache_proc_cleanup();
slow_work_unregister_user();
printk(KERN_NOTICE "FS-Cache: Unloaded\n");
OpenPOWER on IntegriCloud