diff mbox series

[RFC,1/8] btrfs: fs_context: Add initial fscontext parameters

Message ID 20200812163654.17080-2-marcos@mpdesouza.com (mailing list archive)
State New, archived
Headers show
Series btrfs: convert to fscontext | expand

Commit Message

Marcos Paulo de Souza Aug. 12, 2020, 4:36 p.m. UTC
From: Marcos Paulo de Souza <mpdesouza@suse.com>

The same old parameters but now using the fs_parameter_spec form. As
the fscontext has a flag_no variant we don't need to map the Opt_no*
version of the same flags.

Opt_fragment is added as a generic entry point for all fragment type to
be used only in fscontext argument parser.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
 fs/btrfs/super.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
diff mbox series

Patch

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 53639de3a064..4e6654af90ea 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -6,6 +6,7 @@ 
 #include <linux/blkdev.h>
 #include <linux/module.h>
 #include <linux/fs.h>
+#include <linux/fs_parser.h>
 #include <linux/pagemap.h>
 #include <linux/highmem.h>
 #include <linux/time.h>
@@ -370,6 +371,7 @@  enum {
 	Opt_check_integrity_print_mask,
 	Opt_enospc_debug, Opt_noenospc_debug,
 #ifdef CONFIG_BTRFS_DEBUG
+	Opt_fragment,
 	Opt_fragment_data, Opt_fragment_metadata, Opt_fragment_all,
 #endif
 #ifdef CONFIG_BTRFS_FS_REF_VERIFY
@@ -458,6 +460,65 @@  static const match_table_t rescue_tokens = {
 	{Opt_err, NULL},
 };
 
+static const struct fs_parameter_spec btrfs_fs_parameters[] = {
+	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_string("discard", Opt_discard_mode),
+	fsparam_string("fatal_errors", Opt_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("norecovery", Opt_norecovery),
+	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_string("space_cache", Opt_space_cache_version),
+	fsparam_string("subvol", Opt_subvol),
+	fsparam_u64("subvolid", Opt_subvolid),
+	fsparam_flag_no("ssd", Opt_ssd),
+	fsparam_flag_no("ssd_spread", Opt_ssd_spread),
+	fsparam_u32("thread_pool", Opt_thread_pool),
+	fsparam_flag_no("treelog", Opt_treelog),
+	fsparam_flag("user_subvol_rm_allowed", Opt_user_subvol_rm_allowed),
+
+	/* Debugging options */
+	fsparam_flag("check_int", Opt_check_integrity),
+	fsparam_flag("check_int_data", Opt_check_integrity_including_extent_data),
+	fsparam_u32("check_int_print_mask", Opt_check_integrity_print_mask),
+
+	/* Rescue options */
+	fsparam_string("rescue", Opt_rescue),
+	/* Deprecated, with alias rescue=nologreplay */
+	fsparam_flag("nologreplay", Opt_nologreplay),
+	/* Deprecated, with alias rescue=usebackuproot */
+	fsparam_flag("usebackuproot", Opt_usebackuproot),
+
+	/* Deprecated options */
+	fsparam_flag("recovery", Opt_recovery),
+	fsparam_flag_no("enospc_debug", Opt_enospc_debug),
+
+ #ifdef CONFIG_BTRFS_DEBUG
+	fsparam_string("fragment", Opt_fragment),
+ #endif
+ #ifdef CONFIG_BTRFS_FS_REF_VERIFY
+	fsparam_flag("ref_verify", Opt_ref_verify),
+ #endif
+	{}
+};
+
 static int parse_rescue_options(struct btrfs_fs_info *info, const char *options)
 {
 	char *opts;
@@ -2269,6 +2330,7 @@  static struct file_system_type btrfs_fs_type = {
 	.owner		= THIS_MODULE,
 	.name		= "btrfs",
 	.mount		= btrfs_mount,
+	.parameters	= btrfs_fs_parameters,
 	.kill_sb	= btrfs_kill_super,
 	.fs_flags	= FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA,
 };
@@ -2277,6 +2339,7 @@  static struct file_system_type btrfs_root_fs_type = {
 	.owner		= THIS_MODULE,
 	.name		= "btrfs",
 	.mount		= btrfs_mount_root,
+	.parameters	= btrfs_fs_parameters,
 	.kill_sb	= btrfs_kill_super,
 	.fs_flags	= FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA,
 };