]> git.hungrycats.org Git - linux/commitdiff
btrfs: factor btrfs_init_dev_replace_locks() out of open_ctree()
authorEric Sandeen <sandeen@redhat.com>
Fri, 1 Aug 2014 23:12:41 +0000 (18:12 -0500)
committerZygo Blaxell <zblaxell@waya.furryterror.org>
Fri, 27 Mar 2015 03:31:27 +0000 (23:31 -0400)
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
[renamed to btrfs_init_dev_replace_locks]
Signed-off-by: David Sterba <dsterba@suse.cz>
(cherry picked from commit ad6183680c0845ff8052a919b97c71b4fec8f33a)

fs/btrfs/disk-io.c

index 7bff7870ea764a41ddeaeb23db856f63fc555b06..f66b009618c263bb800622259ce3b070df0e94b6 100644 (file)
@@ -2200,6 +2200,16 @@ static void btrfs_init_btree_inode(struct btrfs_fs_info *fs_info,
        btrfs_insert_inode_hash(fs_info->btree_inode);
 }
 
+static void btrfs_init_dev_replace_locks(struct btrfs_fs_info *fs_info)
+{
+       fs_info->dev_replace.lock_owner = 0;
+       atomic_set(&fs_info->dev_replace.nesting_level, 0);
+       mutex_init(&fs_info->dev_replace.lock_finishing_cancel_unmount);
+       mutex_init(&fs_info->dev_replace.lock_management_lock);
+       mutex_init(&fs_info->dev_replace.lock);
+       init_waitqueue_head(&fs_info->replace_wait);
+}
+
 int open_ctree(struct super_block *sb,
               struct btrfs_fs_devices *fs_devices,
               char *options)
@@ -2349,7 +2359,6 @@ int open_ctree(struct super_block *sb,
        btrfs_init_delayed_root(fs_info->delayed_root);
 
        btrfs_init_scrub(fs_info);
-       init_waitqueue_head(&fs_info->replace_wait);
 #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
        fs_info->check_integrity_print_mask = 0;
 #endif
@@ -2385,11 +2394,8 @@ int open_ctree(struct super_block *sb,
        init_rwsem(&fs_info->cleanup_work_sem);
        init_rwsem(&fs_info->subvol_sem);
        sema_init(&fs_info->uuid_tree_rescan_sem, 1);
-       fs_info->dev_replace.lock_owner = 0;
-       atomic_set(&fs_info->dev_replace.nesting_level, 0);
-       mutex_init(&fs_info->dev_replace.lock_finishing_cancel_unmount);
-       mutex_init(&fs_info->dev_replace.lock_management_lock);
-       mutex_init(&fs_info->dev_replace.lock);
+
+       btrfs_init_dev_replace_locks(fs_info);
 
        spin_lock_init(&fs_info->qgroup_lock);
        mutex_init(&fs_info->qgroup_ioctl_lock);