From: David Sterba <dsterba@suse.cz>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com,
linux-fsdevel@vger.kernel.org, brauner@kernel.org
Subject: Re: [PATCH v2 08/18] btrfs: add fs_parameter definitions
Date: Tue, 14 Nov 2023 18:49:32 +0100 [thread overview]
Message-ID: <20231114174932.GE11264@twin.jikos.cz> (raw)
In-Reply-To: <24771d34a49eb428d6415197f390bf41dcef495c.1699470345.git.josef@toxicpanda.com>
On Wed, Nov 08, 2023 at 02:08:43PM -0500, Josef Bacik wrote:
> 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-definiton of all of our mount
> options into the new fs_parameter_spec format.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
> fs/btrfs/super.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 127 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index d7070269e3ea..0e9cb9ed6508 100644
> --- a/fs/btrfs/super.c
> +++ b/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"
> @@ -132,7 +133,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,
> @@ -222,6 +223,131 @@ 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("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("degraded", Opt_degraded),
> + fsparam_string("device", Opt_device),
> + 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),
I think it's a good opportunity to remove this option completely, its
functionality is gone since 5.11, that's eough time. I'm fine with
removing it both before or after the API switch.
> + fsparam_string("max_inline", Opt_max_inline),
> + fsparam_flag_no("barrier", Opt_barrier),
> + fsparam_flag_no("datacow", Opt_datacow),
> + fsparam_flag_no("datasum", Opt_datasum),
> + fsparam_flag_no("autodefrag", Opt_defrag),
> + fsparam_flag_no("discard", Opt_discard),
> + fsparam_enum("discard", Opt_discard_mode, btrfs_parameter_discard),
> + 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),
Same here, 'recovery' obsoleted by the rescue options in 4.5.
> +
> + /* 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)
> {
> --
> 2.41.0
>
next prev parent reply other threads:[~2023-11-14 17:56 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-08 19:08 [PATCH v2 00/18] btrfs: convert to the new mount API Josef Bacik
2023-11-08 19:08 ` [PATCH v2 01/18] fs: indicate request originates from old mount api Josef Bacik
2023-11-08 19:08 ` [PATCH v2 02/18] btrfs: split out the mount option validation code into its own helper Josef Bacik
2023-11-14 6:32 ` Anand Jain
2023-11-14 17:35 ` David Sterba
2023-11-08 19:08 ` [PATCH v2 03/18] btrfs: set default compress type at btrfs_init_fs_info time Josef Bacik
2023-11-08 19:08 ` [PATCH v2 04/18] btrfs: move space cache settings into open_ctree Josef Bacik
2023-11-15 0:06 ` Anand Jain
2023-11-20 21:54 ` Josef Bacik
2023-11-08 19:08 ` [PATCH v2 05/18] btrfs: do not allow free space tree rebuild on extent tree v2 Josef Bacik
2023-11-15 9:49 ` Anand Jain
2023-11-16 20:09 ` David Sterba
2023-11-08 19:08 ` [PATCH v2 06/18] btrfs: split out ro->rw and rw->ro helpers into their own functions Josef Bacik
2023-11-08 19:08 ` [PATCH v2 07/18] btrfs: add a NOSPACECACHE mount option flag Josef Bacik
2023-11-08 19:08 ` [PATCH v2 08/18] btrfs: add fs_parameter definitions Josef Bacik
2023-11-14 17:49 ` David Sterba [this message]
2023-11-08 19:08 ` [PATCH v2 09/18] btrfs: add parse_param callback for the new mount api Josef Bacik
2023-11-14 18:13 ` David Sterba
2023-11-22 16:12 ` Josef Bacik
2023-11-08 19:08 ` [PATCH v2 10/18] btrfs: add fs context handling functions Josef Bacik
2023-11-08 19:08 ` [PATCH v2 11/18] btrfs: add reconfigure callback for fs_context Josef Bacik
2023-11-14 18:23 ` David Sterba
2023-11-08 19:08 ` [PATCH v2 12/18] btrfs: add get_tree callback for new mount API Josef Bacik
2023-11-14 18:35 ` David Sterba
2023-11-08 19:08 ` [PATCH v2 13/18] btrfs: handle the ro->rw transition for mounting different subovls Josef Bacik
2023-11-08 19:08 ` [PATCH v2 14/18] btrfs: switch to the new mount API Josef Bacik
2023-11-08 19:08 ` [PATCH v2 15/18] btrfs: move the device specific mount options to super.c Josef Bacik
2023-11-08 19:08 ` [PATCH v2 16/18] btrfs: remove old mount API code Josef Bacik
2023-11-08 19:08 ` [PATCH v2 17/18] btrfs: move one shot mount option clearing to super.c Josef Bacik
2023-11-08 19:08 ` [PATCH v2 18/18] btrfs: set clear_cache if we use usebackuproot Josef Bacik
2023-11-08 23:02 ` [PATCH v2 00/18] btrfs: convert to the new mount API Neal Gompa
2023-11-09 11:55 ` Johannes Thumshirn
2023-11-09 12:55 ` Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231114174932.GE11264@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=brauner@kernel.org \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox