Revert "writeback: fix WB_SYNC_NONE writeback from umount"
[safe/jmp/linux-2.6] / fs / gfs2 / main.c
index 86fe067..fb2a5f9 100644 (file)
@@ -14,8 +14,8 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/gfs2_ondisk.h>
-#include <linux/lm_interface.h>
 #include <asm/atomic.h>
+#include <linux/slow-work.h>
 
 #include "gfs2.h"
 #include "incore.h"
@@ -47,13 +47,27 @@ static void gfs2_init_glock_once(void *foo)
        INIT_HLIST_NODE(&gl->gl_list);
        spin_lock_init(&gl->gl_spin);
        INIT_LIST_HEAD(&gl->gl_holders);
-       gl->gl_lvb = NULL;
-       atomic_set(&gl->gl_lvb_count, 0);
        INIT_LIST_HEAD(&gl->gl_lru);
        INIT_LIST_HEAD(&gl->gl_ail_list);
        atomic_set(&gl->gl_ail_count, 0);
 }
 
+static void gfs2_init_gl_aspace_once(void *foo)
+{
+       struct gfs2_glock *gl = foo;
+       struct address_space *mapping = (struct address_space *)(gl + 1);
+
+       gfs2_init_glock_once(gl);
+       memset(mapping, 0, sizeof(*mapping));
+       INIT_RADIX_TREE(&mapping->page_tree, GFP_ATOMIC);
+       spin_lock_init(&mapping->tree_lock);
+       spin_lock_init(&mapping->i_mmap_lock);
+       INIT_LIST_HEAD(&mapping->private_list);
+       spin_lock_init(&mapping->private_lock);
+       INIT_RAW_PRIO_TREE_ROOT(&mapping->i_mmap);
+       INIT_LIST_HEAD(&mapping->i_mmap_nonlinear);
+}
+
 /**
  * init_gfs2_fs - Register GFS2 as a filesystem
  *
@@ -80,6 +94,14 @@ static int __init init_gfs2_fs(void)
        if (!gfs2_glock_cachep)
                goto fail;
 
+       gfs2_glock_aspace_cachep = kmem_cache_create("gfs2_glock(aspace)",
+                                       sizeof(struct gfs2_glock) +
+                                       sizeof(struct address_space),
+                                       0, 0, gfs2_init_gl_aspace_once);
+
+       if (!gfs2_glock_aspace_cachep)
+               goto fail;
+
        gfs2_inode_cachep = kmem_cache_create("gfs2_inode",
                                              sizeof(struct gfs2_inode),
                                              0,  SLAB_RECLAIM_ACCOUNT|
@@ -116,12 +138,18 @@ static int __init init_gfs2_fs(void)
        if (error)
                goto fail_unregister;
 
+       error = slow_work_register_user(THIS_MODULE);
+       if (error)
+               goto fail_slow;
+
        gfs2_register_debugfs();
 
        printk("GFS2 (built %s %s) installed\n", __DATE__, __TIME__);
 
        return 0;
 
+fail_slow:
+       unregister_filesystem(&gfs2meta_fs_type);
 fail_unregister:
        unregister_filesystem(&gfs2_fs_type);
 fail:
@@ -140,6 +168,9 @@ fail:
        if (gfs2_inode_cachep)
                kmem_cache_destroy(gfs2_inode_cachep);
 
+       if (gfs2_glock_aspace_cachep)
+               kmem_cache_destroy(gfs2_glock_aspace_cachep);
+
        if (gfs2_glock_cachep)
                kmem_cache_destroy(gfs2_glock_cachep);
 
@@ -159,11 +190,13 @@ static void __exit exit_gfs2_fs(void)
        gfs2_unregister_debugfs();
        unregister_filesystem(&gfs2_fs_type);
        unregister_filesystem(&gfs2meta_fs_type);
+       slow_work_unregister_user(THIS_MODULE);
 
        kmem_cache_destroy(gfs2_quotad_cachep);
        kmem_cache_destroy(gfs2_rgrpd_cachep);
        kmem_cache_destroy(gfs2_bufdata_cachep);
        kmem_cache_destroy(gfs2_inode_cachep);
+       kmem_cache_destroy(gfs2_glock_aspace_cachep);
        kmem_cache_destroy(gfs2_glock_cachep);
 
        gfs2_sys_uninit();