diff options
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 864ce334f696..4071fe2bd098 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -2241,6 +2241,13 @@ static int btrfs_freeze(struct super_block *sb) | |||
2241 | struct btrfs_trans_handle *trans; | 2241 | struct btrfs_trans_handle *trans; |
2242 | struct btrfs_root *root = btrfs_sb(sb)->tree_root; | 2242 | struct btrfs_root *root = btrfs_sb(sb)->tree_root; |
2243 | 2243 | ||
2244 | root->fs_info->fs_frozen = 1; | ||
2245 | /* | ||
2246 | * We don't need a barrier here, we'll wait for any transaction that | ||
2247 | * could be in progress on other threads (and do delayed iputs that | ||
2248 | * we want to avoid on a frozen filesystem), or do the commit | ||
2249 | * ourselves. | ||
2250 | */ | ||
2244 | trans = btrfs_attach_transaction_barrier(root); | 2251 | trans = btrfs_attach_transaction_barrier(root); |
2245 | if (IS_ERR(trans)) { | 2252 | if (IS_ERR(trans)) { |
2246 | /* no transaction, don't bother */ | 2253 | /* no transaction, don't bother */ |
@@ -2251,6 +2258,14 @@ static int btrfs_freeze(struct super_block *sb) | |||
2251 | return btrfs_commit_transaction(trans, root); | 2258 | return btrfs_commit_transaction(trans, root); |
2252 | } | 2259 | } |
2253 | 2260 | ||
2261 | static int btrfs_unfreeze(struct super_block *sb) | ||
2262 | { | ||
2263 | struct btrfs_root *root = btrfs_sb(sb)->tree_root; | ||
2264 | |||
2265 | root->fs_info->fs_frozen = 0; | ||
2266 | return 0; | ||
2267 | } | ||
2268 | |||
2254 | static int btrfs_show_devname(struct seq_file *m, struct dentry *root) | 2269 | static int btrfs_show_devname(struct seq_file *m, struct dentry *root) |
2255 | { | 2270 | { |
2256 | struct btrfs_fs_info *fs_info = btrfs_sb(root->d_sb); | 2271 | struct btrfs_fs_info *fs_info = btrfs_sb(root->d_sb); |
@@ -2299,6 +2314,7 @@ static const struct super_operations btrfs_super_ops = { | |||
2299 | .statfs = btrfs_statfs, | 2314 | .statfs = btrfs_statfs, |
2300 | .remount_fs = btrfs_remount, | 2315 | .remount_fs = btrfs_remount, |
2301 | .freeze_fs = btrfs_freeze, | 2316 | .freeze_fs = btrfs_freeze, |
2317 | .unfreeze_fs = btrfs_unfreeze, | ||
2302 | }; | 2318 | }; |
2303 | 2319 | ||
2304 | static const struct file_operations btrfs_ctl_fops = { | 2320 | static const struct file_operations btrfs_ctl_fops = { |