aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2014-08-01 19:12:41 -0400
committerDavid Sterba <dsterba@suse.cz>2015-02-16 12:48:46 -0500
commitad6183680c0845ff8052a919b97c71b4fec8f33a (patch)
tree61bf05df5eb7e4dfaa15220b1e145f47018bc4fc
parentf37938e0e22f90740cfbfe74ecd9aad5e8369b9d (diff)
btrfs: factor btrfs_init_dev_replace_locks() out of open_ctree()
Signed-off-by: Eric Sandeen <sandeen@redhat.com> [renamed to btrfs_init_dev_replace_locks] Signed-off-by: David Sterba <dsterba@suse.cz>
-rw-r--r--fs/btrfs/disk-io.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 6a64e666de05..2b905a76a45e 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2199,6 +2199,16 @@ static void btrfs_init_btree_inode(struct btrfs_fs_info *fs_info,
2199 btrfs_insert_inode_hash(fs_info->btree_inode); 2199 btrfs_insert_inode_hash(fs_info->btree_inode);
2200} 2200}
2201 2201
2202static void btrfs_init_dev_replace_locks(struct btrfs_fs_info *fs_info)
2203{
2204 fs_info->dev_replace.lock_owner = 0;
2205 atomic_set(&fs_info->dev_replace.nesting_level, 0);
2206 mutex_init(&fs_info->dev_replace.lock_finishing_cancel_unmount);
2207 mutex_init(&fs_info->dev_replace.lock_management_lock);
2208 mutex_init(&fs_info->dev_replace.lock);
2209 init_waitqueue_head(&fs_info->replace_wait);
2210}
2211
2202int open_ctree(struct super_block *sb, 2212int open_ctree(struct super_block *sb,
2203 struct btrfs_fs_devices *fs_devices, 2213 struct btrfs_fs_devices *fs_devices,
2204 char *options) 2214 char *options)
@@ -2348,7 +2358,6 @@ int open_ctree(struct super_block *sb,
2348 btrfs_init_delayed_root(fs_info->delayed_root); 2358 btrfs_init_delayed_root(fs_info->delayed_root);
2349 2359
2350 btrfs_init_scrub(fs_info); 2360 btrfs_init_scrub(fs_info);
2351 init_waitqueue_head(&fs_info->replace_wait);
2352#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY 2361#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
2353 fs_info->check_integrity_print_mask = 0; 2362 fs_info->check_integrity_print_mask = 0;
2354#endif 2363#endif
@@ -2384,11 +2393,8 @@ int open_ctree(struct super_block *sb,
2384 init_rwsem(&fs_info->cleanup_work_sem); 2393 init_rwsem(&fs_info->cleanup_work_sem);
2385 init_rwsem(&fs_info->subvol_sem); 2394 init_rwsem(&fs_info->subvol_sem);
2386 sema_init(&fs_info->uuid_tree_rescan_sem, 1); 2395 sema_init(&fs_info->uuid_tree_rescan_sem, 1);
2387 fs_info->dev_replace.lock_owner = 0; 2396
2388 atomic_set(&fs_info->dev_replace.nesting_level, 0); 2397 btrfs_init_dev_replace_locks(fs_info);
2389 mutex_init(&fs_info->dev_replace.lock_finishing_cancel_unmount);
2390 mutex_init(&fs_info->dev_replace.lock_management_lock);
2391 mutex_init(&fs_info->dev_replace.lock);
2392 2398
2393 spin_lock_init(&fs_info->qgroup_lock); 2399 spin_lock_init(&fs_info->qgroup_lock);
2394 mutex_init(&fs_info->qgroup_ioctl_lock); 2400 mutex_init(&fs_info->qgroup_ioctl_lock);