aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2014-08-01 19:12:38 -0400
committerDavid Sterba <dsterba@suse.cz>2015-02-16 12:48:45 -0500
commit638aa7ed4667f63ec45b264d1b6e259a79638733 (patch)
tree9b016f5f42ca6c823ed91ca277d9916ce5ea2b51 /fs
parent04892340777484351473f1756e6f870500c00a48 (diff)
btrfs: factor btrfs_init_scrub() out of open_ctree()
Signed-off-by: Eric Sandeen <sandeen@redhat.com> [renamed to btrfs_init_scrub] Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/disk-io.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 6f37d9fc5d28..2936a3958f3c 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2147,6 +2147,17 @@ void btrfs_free_fs_roots(struct btrfs_fs_info *fs_info)
2147 } 2147 }
2148} 2148}
2149 2149
2150static void btrfs_init_scrub(struct btrfs_fs_info *fs_info)
2151{
2152 mutex_init(&fs_info->scrub_lock);
2153 atomic_set(&fs_info->scrubs_running, 0);
2154 atomic_set(&fs_info->scrub_pause_req, 0);
2155 atomic_set(&fs_info->scrubs_paused, 0);
2156 atomic_set(&fs_info->scrub_cancel_req, 0);
2157 init_waitqueue_head(&fs_info->scrub_pause_wait);
2158 fs_info->scrub_workers_refcnt = 0;
2159}
2160
2150int open_ctree(struct super_block *sb, 2161int open_ctree(struct super_block *sb,
2151 struct btrfs_fs_devices *fs_devices, 2162 struct btrfs_fs_devices *fs_devices,
2152 char *options) 2163 char *options)
@@ -2295,14 +2306,8 @@ int open_ctree(struct super_block *sb,
2295 } 2306 }
2296 btrfs_init_delayed_root(fs_info->delayed_root); 2307 btrfs_init_delayed_root(fs_info->delayed_root);
2297 2308
2298 mutex_init(&fs_info->scrub_lock); 2309 btrfs_init_scrub(fs_info);
2299 atomic_set(&fs_info->scrubs_running, 0);
2300 atomic_set(&fs_info->scrub_pause_req, 0);
2301 atomic_set(&fs_info->scrubs_paused, 0);
2302 atomic_set(&fs_info->scrub_cancel_req, 0);
2303 init_waitqueue_head(&fs_info->replace_wait); 2310 init_waitqueue_head(&fs_info->replace_wait);
2304 init_waitqueue_head(&fs_info->scrub_pause_wait);
2305 fs_info->scrub_workers_refcnt = 0;
2306#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY 2311#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
2307 fs_info->check_integrity_print_mask = 0; 2312 fs_info->check_integrity_print_mask = 0;
2308#endif 2313#endif