Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
[cascardo/linux.git] / fs / ocfs2 / super.c
index 5f9bf8f..a7cdd56 100644 (file)
@@ -561,6 +561,9 @@ static struct inode *ocfs2_alloc_inode(struct super_block *sb)
        if (!oi)
                return NULL;
 
+       oi->i_sync_tid = 0;
+       oi->i_datasync_tid = 0;
+
        jbd2_journal_init_jbd_inode(&oi->ip_jinode, &oi->vfs_inode);
        return &oi->vfs_inode;
 }
@@ -1240,30 +1243,11 @@ static struct dentry *ocfs2_mount(struct file_system_type *fs_type,
        return mount_bdev(fs_type, flags, dev_name, data, ocfs2_fill_super);
 }
 
-static void ocfs2_kill_sb(struct super_block *sb)
-{
-       struct ocfs2_super *osb = OCFS2_SB(sb);
-
-       /* Failed mount? */
-       if (!osb || atomic_read(&osb->vol_state) == VOLUME_DISABLED)
-               goto out;
-
-       /* Prevent further queueing of inode drop events */
-       spin_lock(&dentry_list_lock);
-       ocfs2_set_osb_flag(osb, OCFS2_OSB_DROP_DENTRY_LOCK_IMMED);
-       spin_unlock(&dentry_list_lock);
-       /* Wait for work to finish and/or remove it */
-       cancel_work_sync(&osb->dentry_lock_work);
-out:
-       kill_block_super(sb);
-}
-
 static struct file_system_type ocfs2_fs_type = {
        .owner          = THIS_MODULE,
        .name           = "ocfs2",
        .mount          = ocfs2_mount,
-       .kill_sb        = ocfs2_kill_sb,
-
+       .kill_sb        = kill_block_super,
        .fs_flags       = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE,
        .next           = NULL
 };
@@ -1614,14 +1598,9 @@ static int ocfs2_show_options(struct seq_file *s, struct dentry *root)
        return 0;
 }
 
-wait_queue_head_t ocfs2__ioend_wq[OCFS2_IOEND_WQ_HASH_SZ];
-
 static int __init ocfs2_init(void)
 {
-       int status, i;
-
-       for (i = 0; i < OCFS2_IOEND_WQ_HASH_SZ; i++)
-               init_waitqueue_head(&ocfs2__ioend_wq[i]);
+       int status;
 
        status = init_ocfs2_uptodate_cache();
        if (status < 0)
@@ -1763,7 +1742,7 @@ static void ocfs2_inode_init_once(void *data)
        ocfs2_extent_map_init(&oi->vfs_inode);
        INIT_LIST_HEAD(&oi->ip_io_markers);
        oi->ip_dir_start_lookup = 0;
-       atomic_set(&oi->ip_unaligned_aio, 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);
@@ -1934,17 +1913,16 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err)
 
        debugfs_remove(osb->osb_ctxt);
 
-       /*
-        * Flush inode dropping work queue so that deletes are
-        * performed while the filesystem is still working
-        */
-       ocfs2_drop_all_dl_inodes(osb);
-
        /* Orphan scan should be stopped as early as possible */
        ocfs2_orphan_scan_stop(osb);
 
        ocfs2_disable_quotas(osb);
 
+       /* All dquots should be freed by now */
+       WARN_ON(!llist_empty(&osb->dquot_drop_list));
+       /* Wait for worker to be done with the work structure in osb */
+       cancel_work_sync(&osb->dquot_drop_work);
+
        ocfs2_shutdown_local_alloc(osb);
 
        /* This will disable recovery and flush any recovery work. */
@@ -2079,7 +2057,6 @@ static int ocfs2_initialize_super(struct super_block *sb,
        struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data;
        struct inode *inode = NULL;
        struct ocfs2_journal *journal;
-       __le32 uuid_net_key;
        struct ocfs2_super *osb;
        u64 total_blocks;
 
@@ -2125,6 +2102,8 @@ static int ocfs2_initialize_super(struct super_block *sb,
        spin_lock_init(&osb->osb_xattr_lock);
        ocfs2_init_steal_slots(osb);
 
+       mutex_init(&osb->system_file_mutex);
+
        atomic_set(&osb->alloc_stats.moves, 0);
        atomic_set(&osb->alloc_stats.local_data, 0);
        atomic_set(&osb->alloc_stats.bitmap_data, 0);
@@ -2278,8 +2257,8 @@ static int ocfs2_initialize_super(struct super_block *sb,
        INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery);
        journal->j_state = OCFS2_JOURNAL_FREE;
 
-       INIT_WORK(&osb->dentry_lock_work, ocfs2_drop_dl_inodes);
-       osb->dentry_lock_list = NULL;
+       INIT_WORK(&osb->dquot_drop_work, ocfs2_drop_dquot_refs);
+       init_llist_head(&osb->dquot_drop_list);
 
        /* get some pseudo constants for clustersize bits */
        osb->s_clustersize_bits =
@@ -2313,8 +2292,6 @@ static int ocfs2_initialize_super(struct super_block *sb,
                goto bail;
        }
 
-       memcpy(&uuid_net_key, di->id2.i_super.s_uuid, sizeof(uuid_net_key));
-
        strncpy(osb->vol_label, di->id2.i_super.s_label, 63);
        osb->vol_label[63] = '\0';
        osb->root_blkno = le64_to_cpu(di->id2.i_super.s_root_blkno);