diff options
author | Jeff Mahoney <jeffm@suse.com> | 2016-06-09 21:38:35 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-07-26 07:53:16 -0400 |
commit | 3cdde2240d4533ff71fbb8dc9c32d5d57d3cdeed (patch) | |
tree | 05a138f31bd51026ecb338cd8720bfbf5f863b25 /fs/btrfs | |
parent | bc074524e123ded281cde25ebc5661910f9679e3 (diff) |
btrfs: btrfs_test_opt and friends should take a btrfs_fs_info
btrfs_test_opt and friends only use the root pointer to access
the fs_info. Let's pass the fs_info directly in preparation to
eliminate similar patterns all over btrfs.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/ctree.h | 22 | ||||
-rw-r--r-- | fs/btrfs/dev-replace.c | 4 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 22 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 30 | ||||
-rw-r--r-- | fs/btrfs/file.c | 2 | ||||
-rw-r--r-- | fs/btrfs/free-space-cache.c | 6 | ||||
-rw-r--r-- | fs/btrfs/inode-map.c | 12 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 12 | ||||
-rw-r--r-- | fs/btrfs/ioctl.c | 2 | ||||
-rw-r--r-- | fs/btrfs/super.c | 132 | ||||
-rw-r--r-- | fs/btrfs/transaction.c | 6 | ||||
-rw-r--r-- | fs/btrfs/tree-log.c | 4 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 11 |
13 files changed, 135 insertions, 130 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 8627b7f26a60..61a53cca5963 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1301,21 +1301,21 @@ struct btrfs_root { | |||
1301 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) | 1301 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) |
1302 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) | 1302 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) |
1303 | #define btrfs_raw_test_opt(o, opt) ((o) & BTRFS_MOUNT_##opt) | 1303 | #define btrfs_raw_test_opt(o, opt) ((o) & BTRFS_MOUNT_##opt) |
1304 | #define btrfs_test_opt(root, opt) ((root)->fs_info->mount_opt & \ | 1304 | #define btrfs_test_opt(fs_info, opt) ((fs_info)->mount_opt & \ |
1305 | BTRFS_MOUNT_##opt) | 1305 | BTRFS_MOUNT_##opt) |
1306 | 1306 | ||
1307 | #define btrfs_set_and_info(root, opt, fmt, args...) \ | 1307 | #define btrfs_set_and_info(fs_info, opt, fmt, args...) \ |
1308 | { \ | 1308 | { \ |
1309 | if (!btrfs_test_opt(root, opt)) \ | 1309 | if (!btrfs_test_opt(fs_info, opt)) \ |
1310 | btrfs_info(root->fs_info, fmt, ##args); \ | 1310 | btrfs_info(fs_info, fmt, ##args); \ |
1311 | btrfs_set_opt(root->fs_info->mount_opt, opt); \ | 1311 | btrfs_set_opt(fs_info->mount_opt, opt); \ |
1312 | } | 1312 | } |
1313 | 1313 | ||
1314 | #define btrfs_clear_and_info(root, opt, fmt, args...) \ | 1314 | #define btrfs_clear_and_info(fs_info, opt, fmt, args...) \ |
1315 | { \ | 1315 | { \ |
1316 | if (btrfs_test_opt(root, opt)) \ | 1316 | if (btrfs_test_opt(fs_info, opt)) \ |
1317 | btrfs_info(root->fs_info, fmt, ##args); \ | 1317 | btrfs_info(fs_info, fmt, ##args); \ |
1318 | btrfs_clear_opt(root->fs_info->mount_opt, opt); \ | 1318 | btrfs_clear_opt(fs_info->mount_opt, opt); \ |
1319 | } | 1319 | } |
1320 | 1320 | ||
1321 | #ifdef CONFIG_BTRFS_DEBUG | 1321 | #ifdef CONFIG_BTRFS_DEBUG |
@@ -1323,9 +1323,9 @@ static inline int | |||
1323 | btrfs_should_fragment_free_space(struct btrfs_root *root, | 1323 | btrfs_should_fragment_free_space(struct btrfs_root *root, |
1324 | struct btrfs_block_group_cache *block_group) | 1324 | struct btrfs_block_group_cache *block_group) |
1325 | { | 1325 | { |
1326 | return (btrfs_test_opt(root, FRAGMENT_METADATA) && | 1326 | return (btrfs_test_opt(root->fs_info, FRAGMENT_METADATA) && |
1327 | block_group->flags & BTRFS_BLOCK_GROUP_METADATA) || | 1327 | block_group->flags & BTRFS_BLOCK_GROUP_METADATA) || |
1328 | (btrfs_test_opt(root, FRAGMENT_DATA) && | 1328 | (btrfs_test_opt(root->fs_info, FRAGMENT_DATA) && |
1329 | block_group->flags & BTRFS_BLOCK_GROUP_DATA); | 1329 | block_group->flags & BTRFS_BLOCK_GROUP_DATA); |
1330 | } | 1330 | } |
1331 | #endif | 1331 | #endif |
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 63ef9cdf0144..e9bbff3c0029 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c | |||
@@ -142,7 +142,7 @@ no_valid_dev_replace_entry_found: | |||
142 | * missing | 142 | * missing |
143 | */ | 143 | */ |
144 | if (!dev_replace->srcdev && | 144 | if (!dev_replace->srcdev && |
145 | !btrfs_test_opt(dev_root, DEGRADED)) { | 145 | !btrfs_test_opt(dev_root->fs_info, DEGRADED)) { |
146 | ret = -EIO; | 146 | ret = -EIO; |
147 | btrfs_warn(fs_info, | 147 | btrfs_warn(fs_info, |
148 | "cannot mount because device replace operation is ongoing and"); | 148 | "cannot mount because device replace operation is ongoing and"); |
@@ -151,7 +151,7 @@ no_valid_dev_replace_entry_found: | |||
151 | src_devid); | 151 | src_devid); |
152 | } | 152 | } |
153 | if (!dev_replace->tgtdev && | 153 | if (!dev_replace->tgtdev && |
154 | !btrfs_test_opt(dev_root, DEGRADED)) { | 154 | !btrfs_test_opt(dev_root->fs_info, DEGRADED)) { |
155 | ret = -EIO; | 155 | ret = -EIO; |
156 | btrfs_warn(fs_info, | 156 | btrfs_warn(fs_info, |
157 | "cannot mount because device replace operation is ongoing and"); | 157 | "cannot mount because device replace operation is ongoing and"); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index cb6d13c39bee..802a3113854f 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -3019,8 +3019,8 @@ retry_root_backup: | |||
3019 | if (IS_ERR(fs_info->transaction_kthread)) | 3019 | if (IS_ERR(fs_info->transaction_kthread)) |
3020 | goto fail_cleaner; | 3020 | goto fail_cleaner; |
3021 | 3021 | ||
3022 | if (!btrfs_test_opt(tree_root, SSD) && | 3022 | if (!btrfs_test_opt(tree_root->fs_info, SSD) && |
3023 | !btrfs_test_opt(tree_root, NOSSD) && | 3023 | !btrfs_test_opt(tree_root->fs_info, NOSSD) && |
3024 | !fs_info->fs_devices->rotating) { | 3024 | !fs_info->fs_devices->rotating) { |
3025 | btrfs_info(fs_info, "detected SSD devices, enabling SSD mode"); | 3025 | btrfs_info(fs_info, "detected SSD devices, enabling SSD mode"); |
3026 | btrfs_set_opt(fs_info->mount_opt, SSD); | 3026 | btrfs_set_opt(fs_info->mount_opt, SSD); |
@@ -3033,9 +3033,9 @@ retry_root_backup: | |||
3033 | btrfs_apply_pending_changes(fs_info); | 3033 | btrfs_apply_pending_changes(fs_info); |
3034 | 3034 | ||
3035 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY | 3035 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY |
3036 | if (btrfs_test_opt(tree_root, CHECK_INTEGRITY)) { | 3036 | if (btrfs_test_opt(tree_root->fs_info, CHECK_INTEGRITY)) { |
3037 | ret = btrfsic_mount(tree_root, fs_devices, | 3037 | ret = btrfsic_mount(tree_root, fs_devices, |
3038 | btrfs_test_opt(tree_root, | 3038 | btrfs_test_opt(tree_root->fs_info, |
3039 | CHECK_INTEGRITY_INCLUDING_EXTENT_DATA) ? | 3039 | CHECK_INTEGRITY_INCLUDING_EXTENT_DATA) ? |
3040 | 1 : 0, | 3040 | 1 : 0, |
3041 | fs_info->check_integrity_print_mask); | 3041 | fs_info->check_integrity_print_mask); |
@@ -3051,7 +3051,7 @@ retry_root_backup: | |||
3051 | 3051 | ||
3052 | /* do not make disk changes in broken FS or nologreplay is given */ | 3052 | /* do not make disk changes in broken FS or nologreplay is given */ |
3053 | if (btrfs_super_log_root(disk_super) != 0 && | 3053 | if (btrfs_super_log_root(disk_super) != 0 && |
3054 | !btrfs_test_opt(tree_root, NOLOGREPLAY)) { | 3054 | !btrfs_test_opt(tree_root->fs_info, NOLOGREPLAY)) { |
3055 | ret = btrfs_replay_log(fs_info, fs_devices); | 3055 | ret = btrfs_replay_log(fs_info, fs_devices); |
3056 | if (ret) { | 3056 | if (ret) { |
3057 | err = ret; | 3057 | err = ret; |
@@ -3092,7 +3092,7 @@ retry_root_backup: | |||
3092 | if (sb->s_flags & MS_RDONLY) | 3092 | if (sb->s_flags & MS_RDONLY) |
3093 | return 0; | 3093 | return 0; |
3094 | 3094 | ||
3095 | if (btrfs_test_opt(tree_root, FREE_SPACE_TREE) && | 3095 | if (btrfs_test_opt(tree_root->fs_info, FREE_SPACE_TREE) && |
3096 | !btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) { | 3096 | !btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) { |
3097 | btrfs_info(fs_info, "creating free space tree"); | 3097 | btrfs_info(fs_info, "creating free space tree"); |
3098 | ret = btrfs_create_free_space_tree(fs_info); | 3098 | ret = btrfs_create_free_space_tree(fs_info); |
@@ -3129,7 +3129,7 @@ retry_root_backup: | |||
3129 | 3129 | ||
3130 | btrfs_qgroup_rescan_resume(fs_info); | 3130 | btrfs_qgroup_rescan_resume(fs_info); |
3131 | 3131 | ||
3132 | if (btrfs_test_opt(tree_root, CLEAR_CACHE) && | 3132 | if (btrfs_test_opt(tree_root->fs_info, CLEAR_CACHE) && |
3133 | btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) { | 3133 | btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) { |
3134 | btrfs_info(fs_info, "clearing free space tree"); | 3134 | btrfs_info(fs_info, "clearing free space tree"); |
3135 | ret = btrfs_clear_free_space_tree(fs_info); | 3135 | ret = btrfs_clear_free_space_tree(fs_info); |
@@ -3150,7 +3150,7 @@ retry_root_backup: | |||
3150 | close_ctree(tree_root); | 3150 | close_ctree(tree_root); |
3151 | return ret; | 3151 | return ret; |
3152 | } | 3152 | } |
3153 | } else if (btrfs_test_opt(tree_root, RESCAN_UUID_TREE) || | 3153 | } else if (btrfs_test_opt(tree_root->fs_info, RESCAN_UUID_TREE) || |
3154 | fs_info->generation != | 3154 | fs_info->generation != |
3155 | btrfs_super_uuid_tree_generation(disk_super)) { | 3155 | btrfs_super_uuid_tree_generation(disk_super)) { |
3156 | btrfs_info(fs_info, "checking UUID tree"); | 3156 | btrfs_info(fs_info, "checking UUID tree"); |
@@ -3227,7 +3227,7 @@ fail: | |||
3227 | return err; | 3227 | return err; |
3228 | 3228 | ||
3229 | recovery_tree_root: | 3229 | recovery_tree_root: |
3230 | if (!btrfs_test_opt(tree_root, USEBACKUPROOT)) | 3230 | if (!btrfs_test_opt(tree_root->fs_info, USEBACKUPROOT)) |
3231 | goto fail_tree_roots; | 3231 | goto fail_tree_roots; |
3232 | 3232 | ||
3233 | free_root_pointers(fs_info, 0); | 3233 | free_root_pointers(fs_info, 0); |
@@ -3642,7 +3642,7 @@ static int write_all_supers(struct btrfs_root *root, int max_mirrors) | |||
3642 | int total_errors = 0; | 3642 | int total_errors = 0; |
3643 | u64 flags; | 3643 | u64 flags; |
3644 | 3644 | ||
3645 | do_barriers = !btrfs_test_opt(root, NOBARRIER); | 3645 | do_barriers = !btrfs_test_opt(root->fs_info, NOBARRIER); |
3646 | backup_super_roots(root->fs_info); | 3646 | backup_super_roots(root->fs_info); |
3647 | 3647 | ||
3648 | sb = root->fs_info->super_for_commit; | 3648 | sb = root->fs_info->super_for_commit; |
@@ -3926,7 +3926,7 @@ void close_ctree(struct btrfs_root *root) | |||
3926 | iput(fs_info->btree_inode); | 3926 | iput(fs_info->btree_inode); |
3927 | 3927 | ||
3928 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY | 3928 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY |
3929 | if (btrfs_test_opt(root, CHECK_INTEGRITY)) | 3929 | if (btrfs_test_opt(root->fs_info, CHECK_INTEGRITY)) |
3930 | btrfsic_unmount(root, fs_info->fs_devices); | 3930 | btrfsic_unmount(root, fs_info->fs_devices); |
3931 | #endif | 3931 | #endif |
3932 | 3932 | ||
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 73f6dd2cf3cb..44b529f183e3 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -3448,7 +3448,7 @@ again: | |||
3448 | 3448 | ||
3449 | spin_lock(&block_group->lock); | 3449 | spin_lock(&block_group->lock); |
3450 | if (block_group->cached != BTRFS_CACHE_FINISHED || | 3450 | if (block_group->cached != BTRFS_CACHE_FINISHED || |
3451 | !btrfs_test_opt(root, SPACE_CACHE)) { | 3451 | !btrfs_test_opt(root->fs_info, SPACE_CACHE)) { |
3452 | /* | 3452 | /* |
3453 | * don't bother trying to write stuff out _if_ | 3453 | * don't bother trying to write stuff out _if_ |
3454 | * a) we're not cached, | 3454 | * a) we're not cached, |
@@ -3525,7 +3525,7 @@ int btrfs_setup_space_cache(struct btrfs_trans_handle *trans, | |||
3525 | struct btrfs_path *path; | 3525 | struct btrfs_path *path; |
3526 | 3526 | ||
3527 | if (list_empty(&cur_trans->dirty_bgs) || | 3527 | if (list_empty(&cur_trans->dirty_bgs) || |
3528 | !btrfs_test_opt(root, SPACE_CACHE)) | 3528 | !btrfs_test_opt(root->fs_info, SPACE_CACHE)) |
3529 | return 0; | 3529 | return 0; |
3530 | 3530 | ||
3531 | path = btrfs_alloc_path(); | 3531 | path = btrfs_alloc_path(); |
@@ -4444,7 +4444,7 @@ void check_system_chunk(struct btrfs_trans_handle *trans, | |||
4444 | thresh = btrfs_calc_trunc_metadata_size(root, num_devs) + | 4444 | thresh = btrfs_calc_trunc_metadata_size(root, num_devs) + |
4445 | btrfs_calc_trans_metadata_size(root, 1); | 4445 | btrfs_calc_trans_metadata_size(root, 1); |
4446 | 4446 | ||
4447 | if (left < thresh && btrfs_test_opt(root, ENOSPC_DEBUG)) { | 4447 | if (left < thresh && btrfs_test_opt(root->fs_info, ENOSPC_DEBUG)) { |
4448 | btrfs_info(root->fs_info, "left=%llu, need=%llu, flags=%llu", | 4448 | btrfs_info(root->fs_info, "left=%llu, need=%llu, flags=%llu", |
4449 | left, thresh, type); | 4449 | left, thresh, type); |
4450 | dump_space_info(info, 0, 0); | 4450 | dump_space_info(info, 0, 0); |
@@ -6216,7 +6216,7 @@ static int update_block_group(struct btrfs_trans_handle *trans, | |||
6216 | spin_lock(&cache->space_info->lock); | 6216 | spin_lock(&cache->space_info->lock); |
6217 | spin_lock(&cache->lock); | 6217 | spin_lock(&cache->lock); |
6218 | 6218 | ||
6219 | if (btrfs_test_opt(root, SPACE_CACHE) && | 6219 | if (btrfs_test_opt(root->fs_info, SPACE_CACHE) && |
6220 | cache->disk_cache_state < BTRFS_DC_CLEAR) | 6220 | cache->disk_cache_state < BTRFS_DC_CLEAR) |
6221 | cache->disk_cache_state = BTRFS_DC_CLEAR; | 6221 | cache->disk_cache_state = BTRFS_DC_CLEAR; |
6222 | 6222 | ||
@@ -6598,7 +6598,7 @@ fetch_cluster_info(struct btrfs_root *root, struct btrfs_space_info *space_info, | |||
6598 | u64 *empty_cluster) | 6598 | u64 *empty_cluster) |
6599 | { | 6599 | { |
6600 | struct btrfs_free_cluster *ret = NULL; | 6600 | struct btrfs_free_cluster *ret = NULL; |
6601 | bool ssd = btrfs_test_opt(root, SSD); | 6601 | bool ssd = btrfs_test_opt(root->fs_info, SSD); |
6602 | 6602 | ||
6603 | *empty_cluster = 0; | 6603 | *empty_cluster = 0; |
6604 | if (btrfs_mixed_space_info(space_info)) | 6604 | if (btrfs_mixed_space_info(space_info)) |
@@ -6743,7 +6743,7 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, | |||
6743 | break; | 6743 | break; |
6744 | } | 6744 | } |
6745 | 6745 | ||
6746 | if (btrfs_test_opt(root, DISCARD)) | 6746 | if (btrfs_test_opt(root->fs_info, DISCARD)) |
6747 | ret = btrfs_discard_extent(root, start, | 6747 | ret = btrfs_discard_extent(root, start, |
6748 | end + 1 - start, NULL); | 6748 | end + 1 - start, NULL); |
6749 | 6749 | ||
@@ -7962,7 +7962,7 @@ again: | |||
7962 | if (num_bytes == min_alloc_size) | 7962 | if (num_bytes == min_alloc_size) |
7963 | final_tried = true; | 7963 | final_tried = true; |
7964 | goto again; | 7964 | goto again; |
7965 | } else if (btrfs_test_opt(root, ENOSPC_DEBUG)) { | 7965 | } else if (btrfs_test_opt(root->fs_info, ENOSPC_DEBUG)) { |
7966 | struct btrfs_space_info *sinfo; | 7966 | struct btrfs_space_info *sinfo; |
7967 | 7967 | ||
7968 | sinfo = __find_space_info(root->fs_info, flags); | 7968 | sinfo = __find_space_info(root->fs_info, flags); |
@@ -7993,7 +7993,7 @@ static int __btrfs_free_reserved_extent(struct btrfs_root *root, | |||
7993 | if (pin) | 7993 | if (pin) |
7994 | pin_down_extent(root, cache, start, len, 1); | 7994 | pin_down_extent(root, cache, start, len, 1); |
7995 | else { | 7995 | else { |
7996 | if (btrfs_test_opt(root, DISCARD)) | 7996 | if (btrfs_test_opt(root->fs_info, DISCARD)) |
7997 | ret = btrfs_discard_extent(root, start, len, NULL); | 7997 | ret = btrfs_discard_extent(root, start, len, NULL); |
7998 | btrfs_add_free_space(cache, start, len); | 7998 | btrfs_add_free_space(cache, start, len); |
7999 | btrfs_update_reserved_bytes(cache, len, RESERVE_FREE, delalloc); | 7999 | btrfs_update_reserved_bytes(cache, len, RESERVE_FREE, delalloc); |
@@ -8301,7 +8301,7 @@ again: | |||
8301 | goto again; | 8301 | goto again; |
8302 | } | 8302 | } |
8303 | 8303 | ||
8304 | if (btrfs_test_opt(root, ENOSPC_DEBUG)) { | 8304 | if (btrfs_test_opt(root->fs_info, ENOSPC_DEBUG)) { |
8305 | static DEFINE_RATELIMIT_STATE(_rs, | 8305 | static DEFINE_RATELIMIT_STATE(_rs, |
8306 | DEFAULT_RATELIMIT_INTERVAL * 10, | 8306 | DEFAULT_RATELIMIT_INTERVAL * 10, |
8307 | /*DEFAULT_RATELIMIT_BURST*/ 1); | 8307 | /*DEFAULT_RATELIMIT_BURST*/ 1); |
@@ -9735,7 +9735,7 @@ int btrfs_can_relocate(struct btrfs_root *root, u64 bytenr) | |||
9735 | int full = 0; | 9735 | int full = 0; |
9736 | int ret = 0; | 9736 | int ret = 0; |
9737 | 9737 | ||
9738 | debug = btrfs_test_opt(root, ENOSPC_DEBUG); | 9738 | debug = btrfs_test_opt(root->fs_info, ENOSPC_DEBUG); |
9739 | 9739 | ||
9740 | block_group = btrfs_lookup_block_group(root->fs_info, bytenr); | 9740 | block_group = btrfs_lookup_block_group(root->fs_info, bytenr); |
9741 | 9741 | ||
@@ -10148,10 +10148,10 @@ int btrfs_read_block_groups(struct btrfs_root *root) | |||
10148 | path->reada = READA_FORWARD; | 10148 | path->reada = READA_FORWARD; |
10149 | 10149 | ||
10150 | cache_gen = btrfs_super_cache_generation(root->fs_info->super_copy); | 10150 | cache_gen = btrfs_super_cache_generation(root->fs_info->super_copy); |
10151 | if (btrfs_test_opt(root, SPACE_CACHE) && | 10151 | if (btrfs_test_opt(root->fs_info, SPACE_CACHE) && |
10152 | btrfs_super_generation(root->fs_info->super_copy) != cache_gen) | 10152 | btrfs_super_generation(root->fs_info->super_copy) != cache_gen) |
10153 | need_clear = 1; | 10153 | need_clear = 1; |
10154 | if (btrfs_test_opt(root, CLEAR_CACHE)) | 10154 | if (btrfs_test_opt(root->fs_info, CLEAR_CACHE)) |
10155 | need_clear = 1; | 10155 | need_clear = 1; |
10156 | 10156 | ||
10157 | while (1) { | 10157 | while (1) { |
@@ -10182,7 +10182,7 @@ int btrfs_read_block_groups(struct btrfs_root *root) | |||
10182 | * b) Setting 'dirty flag' makes sure that we flush | 10182 | * b) Setting 'dirty flag' makes sure that we flush |
10183 | * the new space cache info onto disk. | 10183 | * the new space cache info onto disk. |
10184 | */ | 10184 | */ |
10185 | if (btrfs_test_opt(root, SPACE_CACHE)) | 10185 | if (btrfs_test_opt(root->fs_info, SPACE_CACHE)) |
10186 | cache->disk_cache_state = BTRFS_DC_CLEAR; | 10186 | cache->disk_cache_state = BTRFS_DC_CLEAR; |
10187 | } | 10187 | } |
10188 | 10188 | ||
@@ -10641,7 +10641,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, | |||
10641 | spin_lock(&block_group->space_info->lock); | 10641 | spin_lock(&block_group->space_info->lock); |
10642 | list_del_init(&block_group->ro_list); | 10642 | list_del_init(&block_group->ro_list); |
10643 | 10643 | ||
10644 | if (btrfs_test_opt(root, ENOSPC_DEBUG)) { | 10644 | if (btrfs_test_opt(root->fs_info, ENOSPC_DEBUG)) { |
10645 | WARN_ON(block_group->space_info->total_bytes | 10645 | WARN_ON(block_group->space_info->total_bytes |
10646 | < block_group->key.offset); | 10646 | < block_group->key.offset); |
10647 | WARN_ON(block_group->space_info->bytes_readonly | 10647 | WARN_ON(block_group->space_info->bytes_readonly |
@@ -10909,7 +10909,7 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info) | |||
10909 | spin_unlock(&space_info->lock); | 10909 | spin_unlock(&space_info->lock); |
10910 | 10910 | ||
10911 | /* DISCARD can flip during remount */ | 10911 | /* DISCARD can flip during remount */ |
10912 | trimming = btrfs_test_opt(root, DISCARD); | 10912 | trimming = btrfs_test_opt(root->fs_info, DISCARD); |
10913 | 10913 | ||
10914 | /* Implicit trim during transaction commit. */ | 10914 | /* Implicit trim during transaction commit. */ |
10915 | if (trimming) | 10915 | if (trimming) |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 38bea7bb0987..48b94904a519 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -132,7 +132,7 @@ static int __btrfs_add_inode_defrag(struct inode *inode, | |||
132 | 132 | ||
133 | static inline int __need_auto_defrag(struct btrfs_root *root) | 133 | static inline int __need_auto_defrag(struct btrfs_root *root) |
134 | { | 134 | { |
135 | if (!btrfs_test_opt(root, AUTO_DEFRAG)) | 135 | if (!btrfs_test_opt(root->fs_info, AUTO_DEFRAG)) |
136 | return 0; | 136 | return 0; |
137 | 137 | ||
138 | if (btrfs_fs_closing(root->fs_info)) | 138 | if (btrfs_fs_closing(root->fs_info)) |
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 69d270f6602c..cee2049ef64e 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -3026,7 +3026,7 @@ int btrfs_find_space_cluster(struct btrfs_root *root, | |||
3026 | * For metadata, allow allocates with smaller extents. For | 3026 | * For metadata, allow allocates with smaller extents. For |
3027 | * data, keep it dense. | 3027 | * data, keep it dense. |
3028 | */ | 3028 | */ |
3029 | if (btrfs_test_opt(root, SSD_SPREAD)) { | 3029 | if (btrfs_test_opt(root->fs_info, SSD_SPREAD)) { |
3030 | cont1_bytes = min_bytes = bytes + empty_size; | 3030 | cont1_bytes = min_bytes = bytes + empty_size; |
3031 | } else if (block_group->flags & BTRFS_BLOCK_GROUP_METADATA) { | 3031 | } else if (block_group->flags & BTRFS_BLOCK_GROUP_METADATA) { |
3032 | cont1_bytes = bytes; | 3032 | cont1_bytes = bytes; |
@@ -3470,7 +3470,7 @@ int load_free_ino_cache(struct btrfs_fs_info *fs_info, struct btrfs_root *root) | |||
3470 | int ret = 0; | 3470 | int ret = 0; |
3471 | u64 root_gen = btrfs_root_generation(&root->root_item); | 3471 | u64 root_gen = btrfs_root_generation(&root->root_item); |
3472 | 3472 | ||
3473 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | 3473 | if (!btrfs_test_opt(root->fs_info, INODE_MAP_CACHE)) |
3474 | return 0; | 3474 | return 0; |
3475 | 3475 | ||
3476 | /* | 3476 | /* |
@@ -3514,7 +3514,7 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root, | |||
3514 | struct btrfs_io_ctl io_ctl; | 3514 | struct btrfs_io_ctl io_ctl; |
3515 | bool release_metadata = true; | 3515 | bool release_metadata = true; |
3516 | 3516 | ||
3517 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | 3517 | if (!btrfs_test_opt(root->fs_info, INODE_MAP_CACHE)) |
3518 | return 0; | 3518 | return 0; |
3519 | 3519 | ||
3520 | memset(&io_ctl, 0, sizeof(io_ctl)); | 3520 | memset(&io_ctl, 0, sizeof(io_ctl)); |
diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c index 70107f7c9307..e3ad8c197997 100644 --- a/fs/btrfs/inode-map.c +++ b/fs/btrfs/inode-map.c | |||
@@ -38,7 +38,7 @@ static int caching_kthread(void *data) | |||
38 | int slot; | 38 | int slot; |
39 | int ret; | 39 | int ret; |
40 | 40 | ||
41 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | 41 | if (!btrfs_test_opt(root->fs_info, INODE_MAP_CACHE)) |
42 | return 0; | 42 | return 0; |
43 | 43 | ||
44 | path = btrfs_alloc_path(); | 44 | path = btrfs_alloc_path(); |
@@ -141,7 +141,7 @@ static void start_caching(struct btrfs_root *root) | |||
141 | int ret; | 141 | int ret; |
142 | u64 objectid; | 142 | u64 objectid; |
143 | 143 | ||
144 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | 144 | if (!btrfs_test_opt(root->fs_info, INODE_MAP_CACHE)) |
145 | return; | 145 | return; |
146 | 146 | ||
147 | spin_lock(&root->ino_cache_lock); | 147 | spin_lock(&root->ino_cache_lock); |
@@ -185,7 +185,7 @@ static void start_caching(struct btrfs_root *root) | |||
185 | 185 | ||
186 | int btrfs_find_free_ino(struct btrfs_root *root, u64 *objectid) | 186 | int btrfs_find_free_ino(struct btrfs_root *root, u64 *objectid) |
187 | { | 187 | { |
188 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | 188 | if (!btrfs_test_opt(root->fs_info, INODE_MAP_CACHE)) |
189 | return btrfs_find_free_objectid(root, objectid); | 189 | return btrfs_find_free_objectid(root, objectid); |
190 | 190 | ||
191 | again: | 191 | again: |
@@ -211,7 +211,7 @@ void btrfs_return_ino(struct btrfs_root *root, u64 objectid) | |||
211 | { | 211 | { |
212 | struct btrfs_free_space_ctl *pinned = root->free_ino_pinned; | 212 | struct btrfs_free_space_ctl *pinned = root->free_ino_pinned; |
213 | 213 | ||
214 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | 214 | if (!btrfs_test_opt(root->fs_info, INODE_MAP_CACHE)) |
215 | return; | 215 | return; |
216 | again: | 216 | again: |
217 | if (root->ino_cache_state == BTRFS_CACHE_FINISHED) { | 217 | if (root->ino_cache_state == BTRFS_CACHE_FINISHED) { |
@@ -251,7 +251,7 @@ void btrfs_unpin_free_ino(struct btrfs_root *root) | |||
251 | struct rb_node *n; | 251 | struct rb_node *n; |
252 | u64 count; | 252 | u64 count; |
253 | 253 | ||
254 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | 254 | if (!btrfs_test_opt(root->fs_info, INODE_MAP_CACHE)) |
255 | return; | 255 | return; |
256 | 256 | ||
257 | while (1) { | 257 | while (1) { |
@@ -412,7 +412,7 @@ int btrfs_save_ino_cache(struct btrfs_root *root, | |||
412 | if (btrfs_root_refs(&root->root_item) == 0) | 412 | if (btrfs_root_refs(&root->root_item) == 0) |
413 | return 0; | 413 | return 0; |
414 | 414 | ||
415 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | 415 | if (!btrfs_test_opt(root->fs_info, INODE_MAP_CACHE)) |
416 | return 0; | 416 | return 0; |
417 | 417 | ||
418 | path = btrfs_alloc_path(); | 418 | path = btrfs_alloc_path(); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 0612231aaeba..b166ee0763b6 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -376,12 +376,12 @@ static inline int inode_need_compress(struct inode *inode) | |||
376 | struct btrfs_root *root = BTRFS_I(inode)->root; | 376 | struct btrfs_root *root = BTRFS_I(inode)->root; |
377 | 377 | ||
378 | /* force compress */ | 378 | /* force compress */ |
379 | if (btrfs_test_opt(root, FORCE_COMPRESS)) | 379 | if (btrfs_test_opt(root->fs_info, FORCE_COMPRESS)) |
380 | return 1; | 380 | return 1; |
381 | /* bad compression ratios */ | 381 | /* bad compression ratios */ |
382 | if (BTRFS_I(inode)->flags & BTRFS_INODE_NOCOMPRESS) | 382 | if (BTRFS_I(inode)->flags & BTRFS_INODE_NOCOMPRESS) |
383 | return 0; | 383 | return 0; |
384 | if (btrfs_test_opt(root, COMPRESS) || | 384 | if (btrfs_test_opt(root->fs_info, COMPRESS) || |
385 | BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS || | 385 | BTRFS_I(inode)->flags & BTRFS_INODE_COMPRESS || |
386 | BTRFS_I(inode)->force_compress) | 386 | BTRFS_I(inode)->force_compress) |
387 | return 1; | 387 | return 1; |
@@ -622,7 +622,7 @@ cont: | |||
622 | nr_pages_ret = 0; | 622 | nr_pages_ret = 0; |
623 | 623 | ||
624 | /* flag the file so we don't compress in the future */ | 624 | /* flag the file so we don't compress in the future */ |
625 | if (!btrfs_test_opt(root, FORCE_COMPRESS) && | 625 | if (!btrfs_test_opt(root->fs_info, FORCE_COMPRESS) && |
626 | !(BTRFS_I(inode)->force_compress)) { | 626 | !(BTRFS_I(inode)->force_compress)) { |
627 | BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS; | 627 | BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS; |
628 | } | 628 | } |
@@ -1159,7 +1159,7 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page, | |||
1159 | async_cow->start = start; | 1159 | async_cow->start = start; |
1160 | 1160 | ||
1161 | if (BTRFS_I(inode)->flags & BTRFS_INODE_NOCOMPRESS && | 1161 | if (BTRFS_I(inode)->flags & BTRFS_INODE_NOCOMPRESS && |
1162 | !btrfs_test_opt(root, FORCE_COMPRESS)) | 1162 | !btrfs_test_opt(root->fs_info, FORCE_COMPRESS)) |
1163 | cur_end = end; | 1163 | cur_end = end; |
1164 | else | 1164 | else |
1165 | cur_end = min(end, start + SZ_512K - 1); | 1165 | cur_end = min(end, start + SZ_512K - 1); |
@@ -6255,9 +6255,9 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
6255 | btrfs_inherit_iflags(inode, dir); | 6255 | btrfs_inherit_iflags(inode, dir); |
6256 | 6256 | ||
6257 | if (S_ISREG(mode)) { | 6257 | if (S_ISREG(mode)) { |
6258 | if (btrfs_test_opt(root, NODATASUM)) | 6258 | if (btrfs_test_opt(root->fs_info, NODATASUM)) |
6259 | BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM; | 6259 | BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM; |
6260 | if (btrfs_test_opt(root, NODATACOW)) | 6260 | if (btrfs_test_opt(root->fs_info, NODATACOW)) |
6261 | BTRFS_I(inode)->flags |= BTRFS_INODE_NODATACOW | | 6261 | BTRFS_I(inode)->flags |= BTRFS_INODE_NODATACOW | |
6262 | BTRFS_INODE_NODATASUM; | 6262 | BTRFS_INODE_NODATASUM; |
6263 | } | 6263 | } |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 05173563e4a6..ffb1628cd1a1 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -2406,7 +2406,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, | |||
2406 | * rmdir(2). | 2406 | * rmdir(2). |
2407 | */ | 2407 | */ |
2408 | err = -EPERM; | 2408 | err = -EPERM; |
2409 | if (!btrfs_test_opt(root, USER_SUBVOL_RM_ALLOWED)) | 2409 | if (!btrfs_test_opt(root->fs_info, USER_SUBVOL_RM_ALLOWED)) |
2410 | goto out_dput; | 2410 | goto out_dput; |
2411 | 2411 | ||
2412 | /* | 2412 | /* |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index d965abbcac8e..4a0c0aeb0041 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -454,12 +454,12 @@ int btrfs_parse_options(struct btrfs_root *root, char *options, | |||
454 | */ | 454 | */ |
455 | break; | 455 | break; |
456 | case Opt_nodatasum: | 456 | case Opt_nodatasum: |
457 | btrfs_set_and_info(root, NODATASUM, | 457 | btrfs_set_and_info(info, NODATASUM, |
458 | "setting nodatasum"); | 458 | "setting nodatasum"); |
459 | break; | 459 | break; |
460 | case Opt_datasum: | 460 | case Opt_datasum: |
461 | if (btrfs_test_opt(root, NODATASUM)) { | 461 | if (btrfs_test_opt(info, NODATASUM)) { |
462 | if (btrfs_test_opt(root, NODATACOW)) | 462 | if (btrfs_test_opt(info, NODATACOW)) |
463 | btrfs_info(root->fs_info, "setting datasum, datacow enabled"); | 463 | btrfs_info(root->fs_info, "setting datasum, datacow enabled"); |
464 | else | 464 | else |
465 | btrfs_info(root->fs_info, "setting datasum"); | 465 | btrfs_info(root->fs_info, "setting datasum"); |
@@ -468,9 +468,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options, | |||
468 | btrfs_clear_opt(info->mount_opt, NODATASUM); | 468 | btrfs_clear_opt(info->mount_opt, NODATASUM); |
469 | break; | 469 | break; |
470 | case Opt_nodatacow: | 470 | case Opt_nodatacow: |
471 | if (!btrfs_test_opt(root, NODATACOW)) { | 471 | if (!btrfs_test_opt(info, NODATACOW)) { |
472 | if (!btrfs_test_opt(root, COMPRESS) || | 472 | if (!btrfs_test_opt(info, COMPRESS) || |
473 | !btrfs_test_opt(root, FORCE_COMPRESS)) { | 473 | !btrfs_test_opt(info, FORCE_COMPRESS)) { |
474 | btrfs_info(root->fs_info, | 474 | btrfs_info(root->fs_info, |
475 | "setting nodatacow, compression disabled"); | 475 | "setting nodatacow, compression disabled"); |
476 | } else { | 476 | } else { |
@@ -483,7 +483,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options, | |||
483 | btrfs_set_opt(info->mount_opt, NODATASUM); | 483 | btrfs_set_opt(info->mount_opt, NODATASUM); |
484 | break; | 484 | break; |
485 | case Opt_datacow: | 485 | case Opt_datacow: |
486 | btrfs_clear_and_info(root, NODATACOW, | 486 | btrfs_clear_and_info(info, NODATACOW, |
487 | "setting datacow"); | 487 | "setting datacow"); |
488 | break; | 488 | break; |
489 | case Opt_compress_force: | 489 | case Opt_compress_force: |
@@ -492,10 +492,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options, | |||
492 | /* Fallthrough */ | 492 | /* Fallthrough */ |
493 | case Opt_compress: | 493 | case Opt_compress: |
494 | case Opt_compress_type: | 494 | case Opt_compress_type: |
495 | saved_compress_type = btrfs_test_opt(root, COMPRESS) ? | 495 | saved_compress_type = btrfs_test_opt(info, |
496 | COMPRESS) ? | ||
496 | info->compress_type : BTRFS_COMPRESS_NONE; | 497 | info->compress_type : BTRFS_COMPRESS_NONE; |
497 | saved_compress_force = | 498 | saved_compress_force = |
498 | btrfs_test_opt(root, FORCE_COMPRESS); | 499 | btrfs_test_opt(info, FORCE_COMPRESS); |
499 | if (token == Opt_compress || | 500 | if (token == Opt_compress || |
500 | token == Opt_compress_force || | 501 | token == Opt_compress_force || |
501 | strcmp(args[0].from, "zlib") == 0) { | 502 | strcmp(args[0].from, "zlib") == 0) { |
@@ -535,10 +536,10 @@ int btrfs_parse_options(struct btrfs_root *root, char *options, | |||
535 | */ | 536 | */ |
536 | btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS); | 537 | btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS); |
537 | } | 538 | } |
538 | if ((btrfs_test_opt(root, COMPRESS) && | 539 | if ((btrfs_test_opt(info, COMPRESS) && |
539 | (info->compress_type != saved_compress_type || | 540 | (info->compress_type != saved_compress_type || |
540 | compress_force != saved_compress_force)) || | 541 | compress_force != saved_compress_force)) || |
541 | (!btrfs_test_opt(root, COMPRESS) && | 542 | (!btrfs_test_opt(info, COMPRESS) && |
542 | no_compress == 1)) { | 543 | no_compress == 1)) { |
543 | btrfs_info(root->fs_info, | 544 | btrfs_info(root->fs_info, |
544 | "%s %s compression", | 545 | "%s %s compression", |
@@ -548,25 +549,25 @@ int btrfs_parse_options(struct btrfs_root *root, char *options, | |||
548 | compress_force = false; | 549 | compress_force = false; |
549 | break; | 550 | break; |
550 | case Opt_ssd: | 551 | case Opt_ssd: |
551 | btrfs_set_and_info(root, SSD, | 552 | btrfs_set_and_info(info, SSD, |
552 | "use ssd allocation scheme"); | 553 | "use ssd allocation scheme"); |
553 | break; | 554 | break; |
554 | case Opt_ssd_spread: | 555 | case Opt_ssd_spread: |
555 | btrfs_set_and_info(root, SSD_SPREAD, | 556 | btrfs_set_and_info(info, SSD_SPREAD, |
556 | "use spread ssd allocation scheme"); | 557 | "use spread ssd allocation scheme"); |
557 | btrfs_set_opt(info->mount_opt, SSD); | 558 | btrfs_set_opt(info->mount_opt, SSD); |
558 | break; | 559 | break; |
559 | case Opt_nossd: | 560 | case Opt_nossd: |
560 | btrfs_set_and_info(root, NOSSD, | 561 | btrfs_set_and_info(info, NOSSD, |
561 | "not using ssd allocation scheme"); | 562 | "not using ssd allocation scheme"); |
562 | btrfs_clear_opt(info->mount_opt, SSD); | 563 | btrfs_clear_opt(info->mount_opt, SSD); |
563 | break; | 564 | break; |
564 | case Opt_barrier: | 565 | case Opt_barrier: |
565 | btrfs_clear_and_info(root, NOBARRIER, | 566 | btrfs_clear_and_info(info, NOBARRIER, |
566 | "turning on barriers"); | 567 | "turning on barriers"); |
567 | break; | 568 | break; |
568 | case Opt_nobarrier: | 569 | case Opt_nobarrier: |
569 | btrfs_set_and_info(root, NOBARRIER, | 570 | btrfs_set_and_info(info, NOBARRIER, |
570 | "turning off barriers"); | 571 | "turning off barriers"); |
571 | break; | 572 | break; |
572 | case Opt_thread_pool: | 573 | case Opt_thread_pool: |
@@ -626,24 +627,24 @@ int btrfs_parse_options(struct btrfs_root *root, char *options, | |||
626 | root->fs_info->sb->s_flags &= ~MS_POSIXACL; | 627 | root->fs_info->sb->s_flags &= ~MS_POSIXACL; |
627 | break; | 628 | break; |
628 | case Opt_notreelog: | 629 | case Opt_notreelog: |
629 | btrfs_set_and_info(root, NOTREELOG, | 630 | btrfs_set_and_info(info, NOTREELOG, |
630 | "disabling tree log"); | 631 | "disabling tree log"); |
631 | break; | 632 | break; |
632 | case Opt_treelog: | 633 | case Opt_treelog: |
633 | btrfs_clear_and_info(root, NOTREELOG, | 634 | btrfs_clear_and_info(info, NOTREELOG, |
634 | "enabling tree log"); | 635 | "enabling tree log"); |
635 | break; | 636 | break; |
636 | case Opt_norecovery: | 637 | case Opt_norecovery: |
637 | case Opt_nologreplay: | 638 | case Opt_nologreplay: |
638 | btrfs_set_and_info(root, NOLOGREPLAY, | 639 | btrfs_set_and_info(info, NOLOGREPLAY, |
639 | "disabling log replay at mount time"); | 640 | "disabling log replay at mount time"); |
640 | break; | 641 | break; |
641 | case Opt_flushoncommit: | 642 | case Opt_flushoncommit: |
642 | btrfs_set_and_info(root, FLUSHONCOMMIT, | 643 | btrfs_set_and_info(info, FLUSHONCOMMIT, |
643 | "turning on flush-on-commit"); | 644 | "turning on flush-on-commit"); |
644 | break; | 645 | break; |
645 | case Opt_noflushoncommit: | 646 | case Opt_noflushoncommit: |
646 | btrfs_clear_and_info(root, FLUSHONCOMMIT, | 647 | btrfs_clear_and_info(info, FLUSHONCOMMIT, |
647 | "turning off flush-on-commit"); | 648 | "turning off flush-on-commit"); |
648 | break; | 649 | break; |
649 | case Opt_ratio: | 650 | case Opt_ratio: |
@@ -660,11 +661,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options, | |||
660 | } | 661 | } |
661 | break; | 662 | break; |
662 | case Opt_discard: | 663 | case Opt_discard: |
663 | btrfs_set_and_info(root, DISCARD, | 664 | btrfs_set_and_info(info, DISCARD, |
664 | "turning on discard"); | 665 | "turning on discard"); |
665 | break; | 666 | break; |
666 | case Opt_nodiscard: | 667 | case Opt_nodiscard: |
667 | btrfs_clear_and_info(root, DISCARD, | 668 | btrfs_clear_and_info(info, DISCARD, |
668 | "turning off discard"); | 669 | "turning off discard"); |
669 | break; | 670 | break; |
670 | case Opt_space_cache: | 671 | case Opt_space_cache: |
@@ -673,12 +674,13 @@ int btrfs_parse_options(struct btrfs_root *root, char *options, | |||
673 | strcmp(args[0].from, "v1") == 0) { | 674 | strcmp(args[0].from, "v1") == 0) { |
674 | btrfs_clear_opt(root->fs_info->mount_opt, | 675 | btrfs_clear_opt(root->fs_info->mount_opt, |
675 | FREE_SPACE_TREE); | 676 | FREE_SPACE_TREE); |
676 | btrfs_set_and_info(root, SPACE_CACHE, | 677 | btrfs_set_and_info(info, SPACE_CACHE, |
677 | "enabling disk space caching"); | 678 | "enabling disk space caching"); |
678 | } else if (strcmp(args[0].from, "v2") == 0) { | 679 | } else if (strcmp(args[0].from, "v2") == 0) { |
679 | btrfs_clear_opt(root->fs_info->mount_opt, | 680 | btrfs_clear_opt(root->fs_info->mount_opt, |
680 | SPACE_CACHE); | 681 | SPACE_CACHE); |
681 | btrfs_set_and_info(root, FREE_SPACE_TREE, | 682 | btrfs_set_and_info(info, |
683 | FREE_SPACE_TREE, | ||
682 | "enabling free space tree"); | 684 | "enabling free space tree"); |
683 | } else { | 685 | } else { |
684 | ret = -EINVAL; | 686 | ret = -EINVAL; |
@@ -689,12 +691,14 @@ int btrfs_parse_options(struct btrfs_root *root, char *options, | |||
689 | btrfs_set_opt(info->mount_opt, RESCAN_UUID_TREE); | 691 | btrfs_set_opt(info->mount_opt, RESCAN_UUID_TREE); |
690 | break; | 692 | break; |
691 | case Opt_no_space_cache: | 693 | case Opt_no_space_cache: |
692 | if (btrfs_test_opt(root, SPACE_CACHE)) { | 694 | if (btrfs_test_opt(info, SPACE_CACHE)) { |
693 | btrfs_clear_and_info(root, SPACE_CACHE, | 695 | btrfs_clear_and_info(info, |
696 | SPACE_CACHE, | ||
694 | "disabling disk space caching"); | 697 | "disabling disk space caching"); |
695 | } | 698 | } |
696 | if (btrfs_test_opt(root, FREE_SPACE_TREE)) { | 699 | if (btrfs_test_opt(info, FREE_SPACE_TREE)) { |
697 | btrfs_clear_and_info(root, FREE_SPACE_TREE, | 700 | btrfs_clear_and_info(info, |
701 | FREE_SPACE_TREE, | ||
698 | "disabling free space tree"); | 702 | "disabling free space tree"); |
699 | } | 703 | } |
700 | break; | 704 | break; |
@@ -707,7 +711,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options, | |||
707 | "disabling inode map caching"); | 711 | "disabling inode map caching"); |
708 | break; | 712 | break; |
709 | case Opt_clear_cache: | 713 | case Opt_clear_cache: |
710 | btrfs_set_and_info(root, CLEAR_CACHE, | 714 | btrfs_set_and_info(info, CLEAR_CACHE, |
711 | "force clearing of disk cache"); | 715 | "force clearing of disk cache"); |
712 | break; | 716 | break; |
713 | case Opt_user_subvol_rm_allowed: | 717 | case Opt_user_subvol_rm_allowed: |
@@ -720,11 +724,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options, | |||
720 | btrfs_clear_opt(info->mount_opt, ENOSPC_DEBUG); | 724 | btrfs_clear_opt(info->mount_opt, ENOSPC_DEBUG); |
721 | break; | 725 | break; |
722 | case Opt_defrag: | 726 | case Opt_defrag: |
723 | btrfs_set_and_info(root, AUTO_DEFRAG, | 727 | btrfs_set_and_info(info, AUTO_DEFRAG, |
724 | "enabling auto defrag"); | 728 | "enabling auto defrag"); |
725 | break; | 729 | break; |
726 | case Opt_nodefrag: | 730 | case Opt_nodefrag: |
727 | btrfs_clear_and_info(root, AUTO_DEFRAG, | 731 | btrfs_clear_and_info(info, AUTO_DEFRAG, |
728 | "disabling auto defrag"); | 732 | "disabling auto defrag"); |
729 | break; | 733 | break; |
730 | case Opt_recovery: | 734 | case Opt_recovery: |
@@ -832,22 +836,22 @@ check: | |||
832 | /* | 836 | /* |
833 | * Extra check for current option against current flag | 837 | * Extra check for current option against current flag |
834 | */ | 838 | */ |
835 | if (btrfs_test_opt(root, NOLOGREPLAY) && !(new_flags & MS_RDONLY)) { | 839 | if (btrfs_test_opt(info, NOLOGREPLAY) && !(new_flags & MS_RDONLY)) { |
836 | btrfs_err(root->fs_info, | 840 | btrfs_err(root->fs_info, |
837 | "nologreplay must be used with ro mount option"); | 841 | "nologreplay must be used with ro mount option"); |
838 | ret = -EINVAL; | 842 | ret = -EINVAL; |
839 | } | 843 | } |
840 | out: | 844 | out: |
841 | if (btrfs_fs_compat_ro(root->fs_info, FREE_SPACE_TREE) && | 845 | if (btrfs_fs_compat_ro(root->fs_info, FREE_SPACE_TREE) && |
842 | !btrfs_test_opt(root, FREE_SPACE_TREE) && | 846 | !btrfs_test_opt(info, FREE_SPACE_TREE) && |
843 | !btrfs_test_opt(root, CLEAR_CACHE)) { | 847 | !btrfs_test_opt(info, CLEAR_CACHE)) { |
844 | btrfs_err(root->fs_info, "cannot disable free space tree"); | 848 | btrfs_err(root->fs_info, "cannot disable free space tree"); |
845 | ret = -EINVAL; | 849 | ret = -EINVAL; |
846 | 850 | ||
847 | } | 851 | } |
848 | if (!ret && btrfs_test_opt(root, SPACE_CACHE)) | 852 | if (!ret && btrfs_test_opt(info, SPACE_CACHE)) |
849 | btrfs_info(root->fs_info, "disk space caching is enabled"); | 853 | btrfs_info(root->fs_info, "disk space caching is enabled"); |
850 | if (!ret && btrfs_test_opt(root, FREE_SPACE_TREE)) | 854 | if (!ret && btrfs_test_opt(info, FREE_SPACE_TREE)) |
851 | btrfs_info(root->fs_info, "using free space tree"); | 855 | btrfs_info(root->fs_info, "using free space tree"); |
852 | kfree(orig); | 856 | kfree(orig); |
853 | return ret; | 857 | return ret; |
@@ -1214,13 +1218,13 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry) | |||
1214 | struct btrfs_root *root = info->tree_root; | 1218 | struct btrfs_root *root = info->tree_root; |
1215 | char *compress_type; | 1219 | char *compress_type; |
1216 | 1220 | ||
1217 | if (btrfs_test_opt(root, DEGRADED)) | 1221 | if (btrfs_test_opt(info, DEGRADED)) |
1218 | seq_puts(seq, ",degraded"); | 1222 | seq_puts(seq, ",degraded"); |
1219 | if (btrfs_test_opt(root, NODATASUM)) | 1223 | if (btrfs_test_opt(info, NODATASUM)) |
1220 | seq_puts(seq, ",nodatasum"); | 1224 | seq_puts(seq, ",nodatasum"); |
1221 | if (btrfs_test_opt(root, NODATACOW)) | 1225 | if (btrfs_test_opt(info, NODATACOW)) |
1222 | seq_puts(seq, ",nodatacow"); | 1226 | seq_puts(seq, ",nodatacow"); |
1223 | if (btrfs_test_opt(root, NOBARRIER)) | 1227 | if (btrfs_test_opt(info, NOBARRIER)) |
1224 | seq_puts(seq, ",nobarrier"); | 1228 | seq_puts(seq, ",nobarrier"); |
1225 | if (info->max_inline != BTRFS_DEFAULT_MAX_INLINE) | 1229 | if (info->max_inline != BTRFS_DEFAULT_MAX_INLINE) |
1226 | seq_printf(seq, ",max_inline=%llu", info->max_inline); | 1230 | seq_printf(seq, ",max_inline=%llu", info->max_inline); |
@@ -1229,56 +1233,56 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry) | |||
1229 | if (info->thread_pool_size != min_t(unsigned long, | 1233 | if (info->thread_pool_size != min_t(unsigned long, |
1230 | num_online_cpus() + 2, 8)) | 1234 | num_online_cpus() + 2, 8)) |
1231 | seq_printf(seq, ",thread_pool=%d", info->thread_pool_size); | 1235 | seq_printf(seq, ",thread_pool=%d", info->thread_pool_size); |
1232 | if (btrfs_test_opt(root, COMPRESS)) { | 1236 | if (btrfs_test_opt(info, COMPRESS)) { |
1233 | if (info->compress_type == BTRFS_COMPRESS_ZLIB) | 1237 | if (info->compress_type == BTRFS_COMPRESS_ZLIB) |
1234 | compress_type = "zlib"; | 1238 | compress_type = "zlib"; |
1235 | else | 1239 | else |
1236 | compress_type = "lzo"; | 1240 | compress_type = "lzo"; |
1237 | if (btrfs_test_opt(root, FORCE_COMPRESS)) | 1241 | if (btrfs_test_opt(info, FORCE_COMPRESS)) |
1238 | seq_printf(seq, ",compress-force=%s", compress_type); | 1242 | seq_printf(seq, ",compress-force=%s", compress_type); |
1239 | else | 1243 | else |
1240 | seq_printf(seq, ",compress=%s", compress_type); | 1244 | seq_printf(seq, ",compress=%s", compress_type); |
1241 | } | 1245 | } |
1242 | if (btrfs_test_opt(root, NOSSD)) | 1246 | if (btrfs_test_opt(info, NOSSD)) |
1243 | seq_puts(seq, ",nossd"); | 1247 | seq_puts(seq, ",nossd"); |
1244 | if (btrfs_test_opt(root, SSD_SPREAD)) | 1248 | if (btrfs_test_opt(info, SSD_SPREAD)) |
1245 | seq_puts(seq, ",ssd_spread"); | 1249 | seq_puts(seq, ",ssd_spread"); |
1246 | else if (btrfs_test_opt(root, SSD)) | 1250 | else if (btrfs_test_opt(info, SSD)) |
1247 | seq_puts(seq, ",ssd"); | 1251 | seq_puts(seq, ",ssd"); |
1248 | if (btrfs_test_opt(root, NOTREELOG)) | 1252 | if (btrfs_test_opt(info, NOTREELOG)) |
1249 | seq_puts(seq, ",notreelog"); | 1253 | seq_puts(seq, ",notreelog"); |
1250 | if (btrfs_test_opt(root, NOLOGREPLAY)) | 1254 | if (btrfs_test_opt(info, NOLOGREPLAY)) |
1251 | seq_puts(seq, ",nologreplay"); | 1255 | seq_puts(seq, ",nologreplay"); |
1252 | if (btrfs_test_opt(root, FLUSHONCOMMIT)) | 1256 | if (btrfs_test_opt(info, FLUSHONCOMMIT)) |
1253 | seq_puts(seq, ",flushoncommit"); | 1257 | seq_puts(seq, ",flushoncommit"); |
1254 | if (btrfs_test_opt(root, DISCARD)) | 1258 | if (btrfs_test_opt(info, DISCARD)) |
1255 | seq_puts(seq, ",discard"); | 1259 | seq_puts(seq, ",discard"); |
1256 | if (!(root->fs_info->sb->s_flags & MS_POSIXACL)) | 1260 | if (!(root->fs_info->sb->s_flags & MS_POSIXACL)) |
1257 | seq_puts(seq, ",noacl"); | 1261 | seq_puts(seq, ",noacl"); |
1258 | if (btrfs_test_opt(root, SPACE_CACHE)) | 1262 | if (btrfs_test_opt(info, SPACE_CACHE)) |
1259 | seq_puts(seq, ",space_cache"); | 1263 | seq_puts(seq, ",space_cache"); |
1260 | else if (btrfs_test_opt(root, FREE_SPACE_TREE)) | 1264 | else if (btrfs_test_opt(info, FREE_SPACE_TREE)) |
1261 | seq_puts(seq, ",space_cache=v2"); | 1265 | seq_puts(seq, ",space_cache=v2"); |
1262 | else | 1266 | else |
1263 | seq_puts(seq, ",nospace_cache"); | 1267 | seq_puts(seq, ",nospace_cache"); |
1264 | if (btrfs_test_opt(root, RESCAN_UUID_TREE)) | 1268 | if (btrfs_test_opt(info, RESCAN_UUID_TREE)) |
1265 | seq_puts(seq, ",rescan_uuid_tree"); | 1269 | seq_puts(seq, ",rescan_uuid_tree"); |
1266 | if (btrfs_test_opt(root, CLEAR_CACHE)) | 1270 | if (btrfs_test_opt(info, CLEAR_CACHE)) |
1267 | seq_puts(seq, ",clear_cache"); | 1271 | seq_puts(seq, ",clear_cache"); |
1268 | if (btrfs_test_opt(root, USER_SUBVOL_RM_ALLOWED)) | 1272 | if (btrfs_test_opt(info, USER_SUBVOL_RM_ALLOWED)) |
1269 | seq_puts(seq, ",user_subvol_rm_allowed"); | 1273 | seq_puts(seq, ",user_subvol_rm_allowed"); |
1270 | if (btrfs_test_opt(root, ENOSPC_DEBUG)) | 1274 | if (btrfs_test_opt(info, ENOSPC_DEBUG)) |
1271 | seq_puts(seq, ",enospc_debug"); | 1275 | seq_puts(seq, ",enospc_debug"); |
1272 | if (btrfs_test_opt(root, AUTO_DEFRAG)) | 1276 | if (btrfs_test_opt(info, AUTO_DEFRAG)) |
1273 | seq_puts(seq, ",autodefrag"); | 1277 | seq_puts(seq, ",autodefrag"); |
1274 | if (btrfs_test_opt(root, INODE_MAP_CACHE)) | 1278 | if (btrfs_test_opt(info, INODE_MAP_CACHE)) |
1275 | seq_puts(seq, ",inode_cache"); | 1279 | seq_puts(seq, ",inode_cache"); |
1276 | if (btrfs_test_opt(root, SKIP_BALANCE)) | 1280 | if (btrfs_test_opt(info, SKIP_BALANCE)) |
1277 | seq_puts(seq, ",skip_balance"); | 1281 | seq_puts(seq, ",skip_balance"); |
1278 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY | 1282 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY |
1279 | if (btrfs_test_opt(root, CHECK_INTEGRITY_INCLUDING_EXTENT_DATA)) | 1283 | if (btrfs_test_opt(info, CHECK_INTEGRITY_INCLUDING_EXTENT_DATA)) |
1280 | seq_puts(seq, ",check_int_data"); | 1284 | seq_puts(seq, ",check_int_data"); |
1281 | else if (btrfs_test_opt(root, CHECK_INTEGRITY)) | 1285 | else if (btrfs_test_opt(info, CHECK_INTEGRITY)) |
1282 | seq_puts(seq, ",check_int"); | 1286 | seq_puts(seq, ",check_int"); |
1283 | if (info->check_integrity_print_mask) | 1287 | if (info->check_integrity_print_mask) |
1284 | seq_printf(seq, ",check_int_print_mask=%d", | 1288 | seq_printf(seq, ",check_int_print_mask=%d", |
@@ -1287,14 +1291,14 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry) | |||
1287 | if (info->metadata_ratio) | 1291 | if (info->metadata_ratio) |
1288 | seq_printf(seq, ",metadata_ratio=%d", | 1292 | seq_printf(seq, ",metadata_ratio=%d", |
1289 | info->metadata_ratio); | 1293 | info->metadata_ratio); |
1290 | if (btrfs_test_opt(root, PANIC_ON_FATAL_ERROR)) | 1294 | if (btrfs_test_opt(info, PANIC_ON_FATAL_ERROR)) |
1291 | seq_puts(seq, ",fatal_errors=panic"); | 1295 | seq_puts(seq, ",fatal_errors=panic"); |
1292 | if (info->commit_interval != BTRFS_DEFAULT_COMMIT_INTERVAL) | 1296 | if (info->commit_interval != BTRFS_DEFAULT_COMMIT_INTERVAL) |
1293 | seq_printf(seq, ",commit=%d", info->commit_interval); | 1297 | seq_printf(seq, ",commit=%d", info->commit_interval); |
1294 | #ifdef CONFIG_BTRFS_DEBUG | 1298 | #ifdef CONFIG_BTRFS_DEBUG |
1295 | if (btrfs_test_opt(root, FRAGMENT_DATA)) | 1299 | if (btrfs_test_opt(info, FRAGMENT_DATA)) |
1296 | seq_puts(seq, ",fragment=data"); | 1300 | seq_puts(seq, ",fragment=data"); |
1297 | if (btrfs_test_opt(root, FRAGMENT_METADATA)) | 1301 | if (btrfs_test_opt(info, FRAGMENT_METADATA)) |
1298 | seq_puts(seq, ",fragment=metadata"); | 1302 | seq_puts(seq, ",fragment=metadata"); |
1299 | #endif | 1303 | #endif |
1300 | seq_printf(seq, ",subvolid=%llu", | 1304 | seq_printf(seq, ",subvolid=%llu", |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 948aa186b353..d986447d19a4 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -1709,7 +1709,7 @@ static void update_super_roots(struct btrfs_root *root) | |||
1709 | super->root = root_item->bytenr; | 1709 | super->root = root_item->bytenr; |
1710 | super->generation = root_item->generation; | 1710 | super->generation = root_item->generation; |
1711 | super->root_level = root_item->level; | 1711 | super->root_level = root_item->level; |
1712 | if (btrfs_test_opt(root, SPACE_CACHE)) | 1712 | if (btrfs_test_opt(root->fs_info, SPACE_CACHE)) |
1713 | super->cache_generation = root_item->generation; | 1713 | super->cache_generation = root_item->generation; |
1714 | if (root->fs_info->update_uuid_tree_gen) | 1714 | if (root->fs_info->update_uuid_tree_gen) |
1715 | super->uuid_tree_generation = root_item->generation; | 1715 | super->uuid_tree_generation = root_item->generation; |
@@ -1895,14 +1895,14 @@ static void cleanup_transaction(struct btrfs_trans_handle *trans, | |||
1895 | 1895 | ||
1896 | static inline int btrfs_start_delalloc_flush(struct btrfs_fs_info *fs_info) | 1896 | static inline int btrfs_start_delalloc_flush(struct btrfs_fs_info *fs_info) |
1897 | { | 1897 | { |
1898 | if (btrfs_test_opt(fs_info->tree_root, FLUSHONCOMMIT)) | 1898 | if (btrfs_test_opt(fs_info, FLUSHONCOMMIT)) |
1899 | return btrfs_start_delalloc_roots(fs_info, 1, -1); | 1899 | return btrfs_start_delalloc_roots(fs_info, 1, -1); |
1900 | return 0; | 1900 | return 0; |
1901 | } | 1901 | } |
1902 | 1902 | ||
1903 | static inline void btrfs_wait_delalloc_flush(struct btrfs_fs_info *fs_info) | 1903 | static inline void btrfs_wait_delalloc_flush(struct btrfs_fs_info *fs_info) |
1904 | { | 1904 | { |
1905 | if (btrfs_test_opt(fs_info->tree_root, FLUSHONCOMMIT)) | 1905 | if (btrfs_test_opt(fs_info, FLUSHONCOMMIT)) |
1906 | btrfs_wait_ordered_roots(fs_info, -1, 0, (u64)-1); | 1906 | btrfs_wait_ordered_roots(fs_info, -1, 0, (u64)-1); |
1907 | } | 1907 | } |
1908 | 1908 | ||
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index aa4475e3046b..391bd3ddaed3 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -2757,7 +2757,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
2757 | while (1) { | 2757 | while (1) { |
2758 | int batch = atomic_read(&root->log_batch); | 2758 | int batch = atomic_read(&root->log_batch); |
2759 | /* when we're on an ssd, just kick the log commit out */ | 2759 | /* when we're on an ssd, just kick the log commit out */ |
2760 | if (!btrfs_test_opt(root, SSD) && | 2760 | if (!btrfs_test_opt(root->fs_info, SSD) && |
2761 | test_bit(BTRFS_ROOT_MULTI_LOG_TASKS, &root->state)) { | 2761 | test_bit(BTRFS_ROOT_MULTI_LOG_TASKS, &root->state)) { |
2762 | mutex_unlock(&root->log_mutex); | 2762 | mutex_unlock(&root->log_mutex); |
2763 | schedule_timeout_uninterruptible(1); | 2763 | schedule_timeout_uninterruptible(1); |
@@ -5305,7 +5305,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | |||
5305 | 5305 | ||
5306 | sb = inode->i_sb; | 5306 | sb = inode->i_sb; |
5307 | 5307 | ||
5308 | if (btrfs_test_opt(root, NOTREELOG)) { | 5308 | if (btrfs_test_opt(root->fs_info, NOTREELOG)) { |
5309 | ret = 1; | 5309 | ret = 1; |
5310 | goto end_no_trans; | 5310 | goto end_no_trans; |
5311 | } | 5311 | } |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 05aec96e4c96..5e409e28a5c0 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -3944,7 +3944,7 @@ int btrfs_resume_balance_async(struct btrfs_fs_info *fs_info) | |||
3944 | } | 3944 | } |
3945 | spin_unlock(&fs_info->balance_lock); | 3945 | spin_unlock(&fs_info->balance_lock); |
3946 | 3946 | ||
3947 | if (btrfs_test_opt(fs_info->tree_root, SKIP_BALANCE)) { | 3947 | if (btrfs_test_opt(fs_info, SKIP_BALANCE)) { |
3948 | btrfs_info(fs_info, "force skipping balance"); | 3948 | btrfs_info(fs_info, "force skipping balance"); |
3949 | return 0; | 3949 | return 0; |
3950 | } | 3950 | } |
@@ -6455,7 +6455,8 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key, | |||
6455 | BTRFS_UUID_SIZE); | 6455 | BTRFS_UUID_SIZE); |
6456 | map->stripes[i].dev = btrfs_find_device(root->fs_info, devid, | 6456 | map->stripes[i].dev = btrfs_find_device(root->fs_info, devid, |
6457 | uuid, NULL); | 6457 | uuid, NULL); |
6458 | if (!map->stripes[i].dev && !btrfs_test_opt(root, DEGRADED)) { | 6458 | if (!map->stripes[i].dev && |
6459 | !btrfs_test_opt(root->fs_info, DEGRADED)) { | ||
6459 | free_extent_map(em); | 6460 | free_extent_map(em); |
6460 | return -EIO; | 6461 | return -EIO; |
6461 | } | 6462 | } |
@@ -6523,7 +6524,7 @@ static struct btrfs_fs_devices *open_seed_devices(struct btrfs_root *root, | |||
6523 | 6524 | ||
6524 | fs_devices = find_fsid(fsid); | 6525 | fs_devices = find_fsid(fsid); |
6525 | if (!fs_devices) { | 6526 | if (!fs_devices) { |
6526 | if (!btrfs_test_opt(root, DEGRADED)) | 6527 | if (!btrfs_test_opt(root->fs_info, DEGRADED)) |
6527 | return ERR_PTR(-ENOENT); | 6528 | return ERR_PTR(-ENOENT); |
6528 | 6529 | ||
6529 | fs_devices = alloc_fs_devices(fsid); | 6530 | fs_devices = alloc_fs_devices(fsid); |
@@ -6585,7 +6586,7 @@ static int read_one_dev(struct btrfs_root *root, | |||
6585 | 6586 | ||
6586 | device = btrfs_find_device(root->fs_info, devid, dev_uuid, fs_uuid); | 6587 | device = btrfs_find_device(root->fs_info, devid, dev_uuid, fs_uuid); |
6587 | if (!device) { | 6588 | if (!device) { |
6588 | if (!btrfs_test_opt(root, DEGRADED)) | 6589 | if (!btrfs_test_opt(root->fs_info, DEGRADED)) |
6589 | return -EIO; | 6590 | return -EIO; |
6590 | 6591 | ||
6591 | device = add_missing_dev(root, fs_devices, devid, dev_uuid); | 6592 | device = add_missing_dev(root, fs_devices, devid, dev_uuid); |
@@ -6594,7 +6595,7 @@ static int read_one_dev(struct btrfs_root *root, | |||
6594 | btrfs_warn(root->fs_info, "devid %llu uuid %pU missing", | 6595 | btrfs_warn(root->fs_info, "devid %llu uuid %pU missing", |
6595 | devid, dev_uuid); | 6596 | devid, dev_uuid); |
6596 | } else { | 6597 | } else { |
6597 | if (!device->bdev && !btrfs_test_opt(root, DEGRADED)) | 6598 | if (!device->bdev && !btrfs_test_opt(root->fs_info, DEGRADED)) |
6598 | return -EIO; | 6599 | return -EIO; |
6599 | 6600 | ||
6600 | if(!device->bdev && !device->missing) { | 6601 | if(!device->bdev && !device->missing) { |