diff options
author | Eric Sandeen <sandeen@redhat.com> | 2014-08-01 19:12:39 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2015-02-16 12:48:45 -0500 |
commit | 779a65a495b76aee7fae500ac7ae360dc8fd81ff (patch) | |
tree | 921f1f328a371a56d047d28eb3708eee16cd197c /fs/btrfs/disk-io.c | |
parent | 638aa7ed4667f63ec45b264d1b6e259a79638733 (diff) |
btrfs: factor btrfs_init_balance() out of open_ctree()
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
[renamed to btrfs_init_balance]
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 2936a3958f3c..b95b033b2494 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2158,6 +2158,17 @@ static void btrfs_init_scrub(struct btrfs_fs_info *fs_info) | |||
2158 | fs_info->scrub_workers_refcnt = 0; | 2158 | fs_info->scrub_workers_refcnt = 0; |
2159 | } | 2159 | } |
2160 | 2160 | ||
2161 | static void btrfs_init_balance(struct btrfs_fs_info *fs_info) | ||
2162 | { | ||
2163 | spin_lock_init(&fs_info->balance_lock); | ||
2164 | mutex_init(&fs_info->balance_mutex); | ||
2165 | atomic_set(&fs_info->balance_running, 0); | ||
2166 | atomic_set(&fs_info->balance_pause_req, 0); | ||
2167 | atomic_set(&fs_info->balance_cancel_req, 0); | ||
2168 | fs_info->balance_ctl = NULL; | ||
2169 | init_waitqueue_head(&fs_info->balance_wait_q); | ||
2170 | } | ||
2171 | |||
2161 | int open_ctree(struct super_block *sb, | 2172 | int open_ctree(struct super_block *sb, |
2162 | struct btrfs_fs_devices *fs_devices, | 2173 | struct btrfs_fs_devices *fs_devices, |
2163 | char *options) | 2174 | char *options) |
@@ -2311,14 +2322,7 @@ int open_ctree(struct super_block *sb, | |||
2311 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY | 2322 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY |
2312 | fs_info->check_integrity_print_mask = 0; | 2323 | fs_info->check_integrity_print_mask = 0; |
2313 | #endif | 2324 | #endif |
2314 | 2325 | btrfs_init_balance(fs_info); | |
2315 | spin_lock_init(&fs_info->balance_lock); | ||
2316 | mutex_init(&fs_info->balance_mutex); | ||
2317 | atomic_set(&fs_info->balance_running, 0); | ||
2318 | atomic_set(&fs_info->balance_pause_req, 0); | ||
2319 | atomic_set(&fs_info->balance_cancel_req, 0); | ||
2320 | fs_info->balance_ctl = NULL; | ||
2321 | init_waitqueue_head(&fs_info->balance_wait_q); | ||
2322 | btrfs_init_async_reclaim_work(&fs_info->async_reclaim_work); | 2326 | btrfs_init_async_reclaim_work(&fs_info->async_reclaim_work); |
2323 | 2327 | ||
2324 | sb->s_blocksize = 4096; | 2328 | sb->s_blocksize = 4096; |