OSDN Git Service

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[uclinux-h8/linux.git] / fs / ocfs2 / super.c
index 302854e..7db631e 100644 (file)
 #include "suballoc.h"
 
 #include "buffer_head_io.h"
+#include "filecheck.h"
 
 static struct kmem_cache *ocfs2_inode_cachep;
 struct kmem_cache *ocfs2_dquot_cachep;
 struct kmem_cache *ocfs2_qf_chunk_cachep;
 
-/* OCFS2 needs to schedule several different types of work which
- * require cluster locking, disk I/O, recovery waits, etc. Since these
- * types of work tend to be heavy we avoid using the kernel events
- * workqueue and schedule on our own. */
-struct workqueue_struct *ocfs2_wq = NULL;
-
 static struct dentry *ocfs2_debugfs_root;
 
 MODULE_AUTHOR("Oracle");
@@ -1205,6 +1200,9 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
        /* Start this when the mount is almost sure of being successful */
        ocfs2_orphan_scan_start(osb);
 
+       /* Create filecheck sysfile /sys/fs/ocfs2/<devname>/filecheck */
+       ocfs2_filecheck_create_sysfs(sb);
+
        return status;
 
 read_super_error:
@@ -1609,33 +1607,25 @@ static int __init ocfs2_init(void)
        if (status < 0)
                goto out2;
 
-       ocfs2_wq = create_singlethread_workqueue("ocfs2_wq");
-       if (!ocfs2_wq) {
-               status = -ENOMEM;
-               goto out3;
-       }
-
        ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL);
        if (!ocfs2_debugfs_root) {
                status = -ENOMEM;
                mlog(ML_ERROR, "Unable to create ocfs2 debugfs root.\n");
-               goto out4;
+               goto out3;
        }
 
        ocfs2_set_locking_protocol();
 
        status = register_quota_format(&ocfs2_quota_format);
        if (status < 0)
-               goto out4;
+               goto out3;
        status = register_filesystem(&ocfs2_fs_type);
        if (!status)
                return 0;
 
        unregister_quota_format(&ocfs2_quota_format);
-out4:
-       destroy_workqueue(ocfs2_wq);
-       debugfs_remove(ocfs2_debugfs_root);
 out3:
+       debugfs_remove(ocfs2_debugfs_root);
        ocfs2_free_mem_caches();
 out2:
        exit_ocfs2_uptodate_cache();
@@ -1646,11 +1636,6 @@ out1:
 
 static void __exit ocfs2_exit(void)
 {
-       if (ocfs2_wq) {
-               flush_workqueue(ocfs2_wq);
-               destroy_workqueue(ocfs2_wq);
-       }
-
        unregister_quota_format(&ocfs2_quota_format);
 
        debugfs_remove(ocfs2_debugfs_root);
@@ -1668,6 +1653,7 @@ static void ocfs2_put_super(struct super_block *sb)
 
        ocfs2_sync_blockdev(sb);
        ocfs2_dismount_volume(sb, 0);
+       ocfs2_filecheck_remove_sysfs(sb);
 }
 
 static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
@@ -1740,8 +1726,8 @@ static void ocfs2_inode_init_once(void *data)
        spin_lock_init(&oi->ip_lock);
        ocfs2_extent_map_init(&oi->vfs_inode);
        INIT_LIST_HEAD(&oi->ip_io_markers);
+       INIT_LIST_HEAD(&oi->ip_unwritten_list);
        oi->ip_dir_start_lookup = 0;
-       mutex_init(&oi->ip_unaligned_aio);
        init_rwsem(&oi->ip_alloc_sem);
        init_rwsem(&oi->ip_xattr_sem);
        mutex_init(&oi->ip_io_mutex);
@@ -2344,6 +2330,12 @@ static int ocfs2_initialize_super(struct super_block *sb,
        }
        cleancache_init_shared_fs(sb);
 
+       osb->ocfs2_wq = create_singlethread_workqueue("ocfs2_wq");
+       if (!osb->ocfs2_wq) {
+               status = -ENOMEM;
+               mlog_errno(status);
+       }
+
 bail:
        return status;
 }
@@ -2531,6 +2523,12 @@ static void ocfs2_delete_osb(struct ocfs2_super *osb)
 {
        /* This function assumes that the caller has the main osb resource */
 
+       /* ocfs2_initializer_super have already created this workqueue */
+       if (osb->ocfs2_wq) {
+               flush_workqueue(osb->ocfs2_wq);
+               destroy_workqueue(osb->ocfs2_wq);
+       }
+
        ocfs2_free_slot_info(osb);
 
        kfree(osb->osb_orphan_wipes);