mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 14:41:39 +00:00
btrfs: add fs_parameter definitions
In order to convert to the new mount API we have to change how we do the mount option parsing. For now we're going to duplicate these helpers to make it easier to follow, and then remove the old code once everything is in place. This patch contains the re-definition of all of our mount options into the new fs_parameter_spec format. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Acked-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
2496bff6e5
commit
15ddcdd34e
126
fs/btrfs/super.c
126
fs/btrfs/super.c
@ -27,6 +27,7 @@
|
||||
#include <linux/crc32c.h>
|
||||
#include <linux/btrfs.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/fs_parser.h>
|
||||
#include "messages.h"
|
||||
#include "delayed-inode.h"
|
||||
#include "ctree.h"
|
||||
@ -135,7 +136,7 @@ enum {
|
||||
/* Debugging options */
|
||||
Opt_enospc_debug, Opt_noenospc_debug,
|
||||
#ifdef CONFIG_BTRFS_DEBUG
|
||||
Opt_fragment_data, Opt_fragment_metadata, Opt_fragment_all,
|
||||
Opt_fragment, Opt_fragment_data, Opt_fragment_metadata, Opt_fragment_all,
|
||||
#endif
|
||||
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
|
||||
Opt_ref_verify,
|
||||
@ -225,6 +226,129 @@ static const match_table_t rescue_tokens = {
|
||||
{Opt_err, NULL},
|
||||
};
|
||||
|
||||
enum {
|
||||
Opt_fatal_errors_panic,
|
||||
Opt_fatal_errors_bug,
|
||||
};
|
||||
|
||||
static const struct constant_table btrfs_parameter_fatal_errors[] = {
|
||||
{ "panic", Opt_fatal_errors_panic },
|
||||
{ "bug", Opt_fatal_errors_bug },
|
||||
{}
|
||||
};
|
||||
|
||||
enum {
|
||||
Opt_discard_sync,
|
||||
Opt_discard_async,
|
||||
};
|
||||
|
||||
static const struct constant_table btrfs_parameter_discard[] = {
|
||||
{ "sync", Opt_discard_sync },
|
||||
{ "async", Opt_discard_async },
|
||||
{}
|
||||
};
|
||||
|
||||
enum {
|
||||
Opt_space_cache_v1,
|
||||
Opt_space_cache_v2,
|
||||
};
|
||||
|
||||
static const struct constant_table btrfs_parameter_space_cache[] = {
|
||||
{ "v1", Opt_space_cache_v1 },
|
||||
{ "v2", Opt_space_cache_v2 },
|
||||
{}
|
||||
};
|
||||
|
||||
enum {
|
||||
Opt_rescue_usebackuproot,
|
||||
Opt_rescue_nologreplay,
|
||||
Opt_rescue_ignorebadroots,
|
||||
Opt_rescue_ignoredatacsums,
|
||||
Opt_rescue_parameter_all,
|
||||
};
|
||||
|
||||
static const struct constant_table btrfs_parameter_rescue[] = {
|
||||
{ "usebackuproot", Opt_rescue_usebackuproot },
|
||||
{ "nologreplay", Opt_rescue_nologreplay },
|
||||
{ "ignorebadroots", Opt_rescue_ignorebadroots },
|
||||
{ "ibadroots", Opt_rescue_ignorebadroots },
|
||||
{ "ignoredatacsums", Opt_rescue_ignoredatacsums },
|
||||
{ "idatacsums", Opt_rescue_ignoredatacsums },
|
||||
{ "all", Opt_rescue_parameter_all },
|
||||
{}
|
||||
};
|
||||
|
||||
#ifdef CONFIG_BTRFS_DEBUG
|
||||
enum {
|
||||
Opt_fragment_parameter_data,
|
||||
Opt_fragment_parameter_metadata,
|
||||
Opt_fragment_parameter_all,
|
||||
};
|
||||
|
||||
static const struct constant_table btrfs_parameter_fragment[] = {
|
||||
{ "data", Opt_fragment_parameter_data },
|
||||
{ "metadata", Opt_fragment_parameter_metadata },
|
||||
{ "all", Opt_fragment_parameter_all },
|
||||
{}
|
||||
};
|
||||
#endif
|
||||
|
||||
static const struct fs_parameter_spec btrfs_fs_parameters[] __maybe_unused = {
|
||||
fsparam_flag_no("acl", Opt_acl),
|
||||
fsparam_flag_no("autodefrag", Opt_defrag),
|
||||
fsparam_flag_no("barrier", Opt_barrier),
|
||||
fsparam_flag("clear_cache", Opt_clear_cache),
|
||||
fsparam_u32("commit", Opt_commit_interval),
|
||||
fsparam_flag("compress", Opt_compress),
|
||||
fsparam_string("compress", Opt_compress_type),
|
||||
fsparam_flag("compress-force", Opt_compress_force),
|
||||
fsparam_string("compress-force", Opt_compress_force_type),
|
||||
fsparam_flag_no("datacow", Opt_datacow),
|
||||
fsparam_flag_no("datasum", Opt_datasum),
|
||||
fsparam_flag("degraded", Opt_degraded),
|
||||
fsparam_string("device", Opt_device),
|
||||
fsparam_flag_no("discard", Opt_discard),
|
||||
fsparam_enum("discard", Opt_discard_mode, btrfs_parameter_discard),
|
||||
fsparam_enum("fatal_errors", Opt_fatal_errors, btrfs_parameter_fatal_errors),
|
||||
fsparam_flag_no("flushoncommit", Opt_flushoncommit),
|
||||
fsparam_flag_no("inode_cache", Opt_inode_cache),
|
||||
fsparam_string("max_inline", Opt_max_inline),
|
||||
fsparam_u32("metadata_ratio", Opt_ratio),
|
||||
fsparam_flag("rescan_uuid_tree", Opt_rescan_uuid_tree),
|
||||
fsparam_flag("skip_balance", Opt_skip_balance),
|
||||
fsparam_flag_no("space_cache", Opt_space_cache),
|
||||
fsparam_enum("space_cache", Opt_space_cache_version, btrfs_parameter_space_cache),
|
||||
fsparam_flag_no("ssd", Opt_ssd),
|
||||
fsparam_flag_no("ssd_spread", Opt_ssd_spread),
|
||||
fsparam_string("subvol", Opt_subvol),
|
||||
fsparam_flag("subvol=", Opt_subvol_empty),
|
||||
fsparam_u64("subvolid", Opt_subvolid),
|
||||
fsparam_u32("thread_pool", Opt_thread_pool),
|
||||
fsparam_flag_no("treelog", Opt_treelog),
|
||||
fsparam_flag("user_subvol_rm_allowed", Opt_user_subvol_rm_allowed),
|
||||
|
||||
/* Rescue options. */
|
||||
fsparam_enum("rescue", Opt_rescue, btrfs_parameter_rescue),
|
||||
/* Deprecated, with alias rescue=nologreplay */
|
||||
__fsparam(NULL, "nologreplay", Opt_nologreplay, fs_param_deprecated, NULL),
|
||||
/* Deprecated, with alias rescue=usebackuproot */
|
||||
__fsparam(NULL, "usebackuproot", Opt_usebackuproot, fs_param_deprecated, NULL),
|
||||
|
||||
/* Deprecated options. */
|
||||
__fsparam(NULL, "recovery", Opt_recovery,
|
||||
fs_param_neg_with_no | fs_param_deprecated, NULL),
|
||||
|
||||
/* Debugging options. */
|
||||
fsparam_flag_no("enospc_debug", Opt_enospc_debug),
|
||||
#ifdef CONFIG_BTRFS_DEBUG
|
||||
fsparam_enum("fragment", Opt_fragment, btrfs_parameter_fragment),
|
||||
#endif
|
||||
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
|
||||
fsparam_flag("ref_verify", Opt_ref_verify),
|
||||
#endif
|
||||
{}
|
||||
};
|
||||
|
||||
static bool check_ro_option(struct btrfs_fs_info *fs_info, unsigned long opt,
|
||||
const char *opt_name)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user