diff options
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 52 |
1 files changed, 41 insertions, 11 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index d41e09fe8e38..00b8f37cc306 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -303,7 +303,8 @@ enum { | |||
303 | Opt_check_integrity_print_mask, Opt_fatal_errors, Opt_rescan_uuid_tree, | 303 | Opt_check_integrity_print_mask, Opt_fatal_errors, Opt_rescan_uuid_tree, |
304 | Opt_commit_interval, Opt_barrier, Opt_nodefrag, Opt_nodiscard, | 304 | Opt_commit_interval, Opt_barrier, Opt_nodefrag, Opt_nodiscard, |
305 | Opt_noenospc_debug, Opt_noflushoncommit, Opt_acl, Opt_datacow, | 305 | Opt_noenospc_debug, Opt_noflushoncommit, Opt_acl, Opt_datacow, |
306 | Opt_datasum, Opt_treelog, Opt_noinode_cache, | 306 | Opt_datasum, Opt_treelog, Opt_noinode_cache, Opt_usebackuproot, |
307 | Opt_nologreplay, Opt_norecovery, | ||
307 | #ifdef CONFIG_BTRFS_DEBUG | 308 | #ifdef CONFIG_BTRFS_DEBUG |
308 | Opt_fragment_data, Opt_fragment_metadata, Opt_fragment_all, | 309 | Opt_fragment_data, Opt_fragment_metadata, Opt_fragment_all, |
309 | #endif | 310 | #endif |
@@ -335,6 +336,8 @@ static const match_table_t tokens = { | |||
335 | {Opt_noacl, "noacl"}, | 336 | {Opt_noacl, "noacl"}, |
336 | {Opt_notreelog, "notreelog"}, | 337 | {Opt_notreelog, "notreelog"}, |
337 | {Opt_treelog, "treelog"}, | 338 | {Opt_treelog, "treelog"}, |
339 | {Opt_nologreplay, "nologreplay"}, | ||
340 | {Opt_norecovery, "norecovery"}, | ||
338 | {Opt_flushoncommit, "flushoncommit"}, | 341 | {Opt_flushoncommit, "flushoncommit"}, |
339 | {Opt_noflushoncommit, "noflushoncommit"}, | 342 | {Opt_noflushoncommit, "noflushoncommit"}, |
340 | {Opt_ratio, "metadata_ratio=%d"}, | 343 | {Opt_ratio, "metadata_ratio=%d"}, |
@@ -352,7 +355,8 @@ static const match_table_t tokens = { | |||
352 | {Opt_inode_cache, "inode_cache"}, | 355 | {Opt_inode_cache, "inode_cache"}, |
353 | {Opt_noinode_cache, "noinode_cache"}, | 356 | {Opt_noinode_cache, "noinode_cache"}, |
354 | {Opt_no_space_cache, "nospace_cache"}, | 357 | {Opt_no_space_cache, "nospace_cache"}, |
355 | {Opt_recovery, "recovery"}, | 358 | {Opt_recovery, "recovery"}, /* deprecated */ |
359 | {Opt_usebackuproot, "usebackuproot"}, | ||
356 | {Opt_skip_balance, "skip_balance"}, | 360 | {Opt_skip_balance, "skip_balance"}, |
357 | {Opt_check_integrity, "check_int"}, | 361 | {Opt_check_integrity, "check_int"}, |
358 | {Opt_check_integrity_including_extent_data, "check_int_data"}, | 362 | {Opt_check_integrity_including_extent_data, "check_int_data"}, |
@@ -373,7 +377,8 @@ static const match_table_t tokens = { | |||
373 | * reading in a new superblock is parsed here. | 377 | * reading in a new superblock is parsed here. |
374 | * XXX JDM: This needs to be cleaned up for remount. | 378 | * XXX JDM: This needs to be cleaned up for remount. |
375 | */ | 379 | */ |
376 | int btrfs_parse_options(struct btrfs_root *root, char *options) | 380 | int btrfs_parse_options(struct btrfs_root *root, char *options, |
381 | unsigned long new_flags) | ||
377 | { | 382 | { |
378 | struct btrfs_fs_info *info = root->fs_info; | 383 | struct btrfs_fs_info *info = root->fs_info; |
379 | substring_t args[MAX_OPT_ARGS]; | 384 | substring_t args[MAX_OPT_ARGS]; |
@@ -393,8 +398,12 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
393 | else if (cache_gen) | 398 | else if (cache_gen) |
394 | btrfs_set_opt(info->mount_opt, SPACE_CACHE); | 399 | btrfs_set_opt(info->mount_opt, SPACE_CACHE); |
395 | 400 | ||
401 | /* | ||
402 | * Even the options are empty, we still need to do extra check | ||
403 | * against new flags | ||
404 | */ | ||
396 | if (!options) | 405 | if (!options) |
397 | goto out; | 406 | goto check; |
398 | 407 | ||
399 | /* | 408 | /* |
400 | * strsep changes the string, duplicate it because parse_options | 409 | * strsep changes the string, duplicate it because parse_options |
@@ -606,6 +615,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
606 | btrfs_clear_and_info(root, NOTREELOG, | 615 | btrfs_clear_and_info(root, NOTREELOG, |
607 | "enabling tree log"); | 616 | "enabling tree log"); |
608 | break; | 617 | break; |
618 | case Opt_norecovery: | ||
619 | case Opt_nologreplay: | ||
620 | btrfs_set_and_info(root, NOLOGREPLAY, | ||
621 | "disabling log replay at mount time"); | ||
622 | break; | ||
609 | case Opt_flushoncommit: | 623 | case Opt_flushoncommit: |
610 | btrfs_set_and_info(root, FLUSHONCOMMIT, | 624 | btrfs_set_and_info(root, FLUSHONCOMMIT, |
611 | "turning on flush-on-commit"); | 625 | "turning on flush-on-commit"); |
@@ -696,8 +710,12 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
696 | "disabling auto defrag"); | 710 | "disabling auto defrag"); |
697 | break; | 711 | break; |
698 | case Opt_recovery: | 712 | case Opt_recovery: |
699 | btrfs_info(root->fs_info, "enabling auto recovery"); | 713 | btrfs_warn(root->fs_info, |
700 | btrfs_set_opt(info->mount_opt, RECOVERY); | 714 | "'recovery' is deprecated, use 'usebackuproot' instead"); |
715 | case Opt_usebackuproot: | ||
716 | btrfs_info(root->fs_info, | ||
717 | "trying to use backup root at mount time"); | ||
718 | btrfs_set_opt(info->mount_opt, USEBACKUPROOT); | ||
701 | break; | 719 | break; |
702 | case Opt_skip_balance: | 720 | case Opt_skip_balance: |
703 | btrfs_set_opt(info->mount_opt, SKIP_BALANCE); | 721 | btrfs_set_opt(info->mount_opt, SKIP_BALANCE); |
@@ -792,6 +810,15 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
792 | break; | 810 | break; |
793 | } | 811 | } |
794 | } | 812 | } |
813 | check: | ||
814 | /* | ||
815 | * Extra check for current option against current flag | ||
816 | */ | ||
817 | if (btrfs_test_opt(root, NOLOGREPLAY) && !(new_flags & MS_RDONLY)) { | ||
818 | btrfs_err(root->fs_info, | ||
819 | "nologreplay must be used with ro mount option"); | ||
820 | ret = -EINVAL; | ||
821 | } | ||
795 | out: | 822 | out: |
796 | if (btrfs_fs_compat_ro(root->fs_info, FREE_SPACE_TREE) && | 823 | if (btrfs_fs_compat_ro(root->fs_info, FREE_SPACE_TREE) && |
797 | !btrfs_test_opt(root, FREE_SPACE_TREE) && | 824 | !btrfs_test_opt(root, FREE_SPACE_TREE) && |
@@ -1202,6 +1229,8 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry) | |||
1202 | seq_puts(seq, ",ssd"); | 1229 | seq_puts(seq, ",ssd"); |
1203 | if (btrfs_test_opt(root, NOTREELOG)) | 1230 | if (btrfs_test_opt(root, NOTREELOG)) |
1204 | seq_puts(seq, ",notreelog"); | 1231 | seq_puts(seq, ",notreelog"); |
1232 | if (btrfs_test_opt(root, NOLOGREPLAY)) | ||
1233 | seq_puts(seq, ",nologreplay"); | ||
1205 | if (btrfs_test_opt(root, FLUSHONCOMMIT)) | 1234 | if (btrfs_test_opt(root, FLUSHONCOMMIT)) |
1206 | seq_puts(seq, ",flushoncommit"); | 1235 | seq_puts(seq, ",flushoncommit"); |
1207 | if (btrfs_test_opt(root, DISCARD)) | 1236 | if (btrfs_test_opt(root, DISCARD)) |
@@ -1228,8 +1257,6 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry) | |||
1228 | seq_puts(seq, ",inode_cache"); | 1257 | seq_puts(seq, ",inode_cache"); |
1229 | if (btrfs_test_opt(root, SKIP_BALANCE)) | 1258 | if (btrfs_test_opt(root, SKIP_BALANCE)) |
1230 | seq_puts(seq, ",skip_balance"); | 1259 | seq_puts(seq, ",skip_balance"); |
1231 | if (btrfs_test_opt(root, RECOVERY)) | ||
1232 | seq_puts(seq, ",recovery"); | ||
1233 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY | 1260 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY |
1234 | if (btrfs_test_opt(root, CHECK_INTEGRITY_INCLUDING_EXTENT_DATA)) | 1261 | if (btrfs_test_opt(root, CHECK_INTEGRITY_INCLUDING_EXTENT_DATA)) |
1235 | seq_puts(seq, ",check_int_data"); | 1262 | seq_puts(seq, ",check_int_data"); |
@@ -1685,7 +1712,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | |||
1685 | } | 1712 | } |
1686 | } | 1713 | } |
1687 | 1714 | ||
1688 | ret = btrfs_parse_options(root, data); | 1715 | ret = btrfs_parse_options(root, data, *flags); |
1689 | if (ret) { | 1716 | if (ret) { |
1690 | ret = -EINVAL; | 1717 | ret = -EINVAL; |
1691 | goto restore; | 1718 | goto restore; |
@@ -2163,6 +2190,9 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd, | |||
2163 | break; | 2190 | break; |
2164 | ret = !(fs_devices->num_devices == fs_devices->total_devices); | 2191 | ret = !(fs_devices->num_devices == fs_devices->total_devices); |
2165 | break; | 2192 | break; |
2193 | case BTRFS_IOC_GET_SUPPORTED_FEATURES: | ||
2194 | ret = btrfs_ioctl_get_supported_features((void __user*)arg); | ||
2195 | break; | ||
2166 | } | 2196 | } |
2167 | 2197 | ||
2168 | kfree(vol); | 2198 | kfree(vol); |
@@ -2261,7 +2291,7 @@ static void btrfs_interface_exit(void) | |||
2261 | misc_deregister(&btrfs_misc); | 2291 | misc_deregister(&btrfs_misc); |
2262 | } | 2292 | } |
2263 | 2293 | ||
2264 | static void btrfs_print_info(void) | 2294 | static void btrfs_print_mod_info(void) |
2265 | { | 2295 | { |
2266 | printk(KERN_INFO "Btrfs loaded" | 2296 | printk(KERN_INFO "Btrfs loaded" |
2267 | #ifdef CONFIG_BTRFS_DEBUG | 2297 | #ifdef CONFIG_BTRFS_DEBUG |
@@ -2363,7 +2393,7 @@ static int __init init_btrfs_fs(void) | |||
2363 | 2393 | ||
2364 | btrfs_init_lockdep(); | 2394 | btrfs_init_lockdep(); |
2365 | 2395 | ||
2366 | btrfs_print_info(); | 2396 | btrfs_print_mod_info(); |
2367 | 2397 | ||
2368 | err = btrfs_run_sanity_tests(); | 2398 | err = btrfs_run_sanity_tests(); |
2369 | if (err) | 2399 | if (err) |