diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2012-01-16 15:04:49 -0500 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2012-01-16 15:04:49 -0500 |
commit | 837d5b6e46d1a4af5b6cc8f2fe83cb5de79a2961 (patch) | |
tree | 4ef87d05240e90480749c345274a83094caf66f0 /fs/btrfs/disk-io.c | |
parent | 9555c6c180600b40f6e86bd4dc53bf47e06ed663 (diff) |
Btrfs: allow for pausing restriper
Implement an ioctl for pausing restriper. This pauses the relocation,
but balance is still considered to be "in progress": balance item is
not deleted, other volume operations cannot be started, etc. If paused
in the middle of profile changing operation we will continue making
allocations with the target profile.
Add a hook to close_ctree() to pause restriper and free its data
structures on unmount. (It's safe to unmount when restriper is in
"paused" state, we will resume with the same parameters on the next
mount)
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index eb7a11ac5b73..8ce837407800 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2004,7 +2004,10 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
2004 | 2004 | ||
2005 | spin_lock_init(&fs_info->balance_lock); | 2005 | spin_lock_init(&fs_info->balance_lock); |
2006 | mutex_init(&fs_info->balance_mutex); | 2006 | mutex_init(&fs_info->balance_mutex); |
2007 | atomic_set(&fs_info->balance_running, 0); | ||
2008 | atomic_set(&fs_info->balance_pause_req, 0); | ||
2007 | fs_info->balance_ctl = NULL; | 2009 | fs_info->balance_ctl = NULL; |
2010 | init_waitqueue_head(&fs_info->balance_wait_q); | ||
2008 | 2011 | ||
2009 | sb->s_blocksize = 4096; | 2012 | sb->s_blocksize = 4096; |
2010 | sb->s_blocksize_bits = blksize_bits(4096); | 2013 | sb->s_blocksize_bits = blksize_bits(4096); |
@@ -2980,6 +2983,9 @@ int close_ctree(struct btrfs_root *root) | |||
2980 | fs_info->closing = 1; | 2983 | fs_info->closing = 1; |
2981 | smp_mb(); | 2984 | smp_mb(); |
2982 | 2985 | ||
2986 | /* pause restriper - we want to resume on mount */ | ||
2987 | btrfs_pause_balance(root->fs_info); | ||
2988 | |||
2983 | btrfs_scrub_cancel(root); | 2989 | btrfs_scrub_cancel(root); |
2984 | 2990 | ||
2985 | /* wait for any defraggers to finish */ | 2991 | /* wait for any defraggers to finish */ |