]> Pileus Git - ~andy/linux/blobdiff - fs/fscache/main.c
Merge branch 'sched-docs-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[~andy/linux] / fs / fscache / main.c
index c2f3e637725d5b92bdab3701120dc597e2494a84..4de41b5974991f05b6a1fc4f07fe40ac746770d8 100644 (file)
@@ -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,9 +95,30 @@ 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");
 }
 
 module_exit(fscache_exit);
+
+/*
+ * wait_on_bit() sleep function for uninterruptible waiting
+ */
+int fscache_wait_bit(void *flags)
+{
+       schedule();
+       return 0;
+}
+EXPORT_SYMBOL(fscache_wait_bit);
+
+/*
+ * wait_on_bit() sleep function for interruptible waiting
+ */
+int fscache_wait_bit_interruptible(void *flags)
+{
+       schedule();
+       return signal_pending(current);
+}
+EXPORT_SYMBOL(fscache_wait_bit_interruptible);