From: Anand Jain <anand.jain@oracle.com>
To: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/7] btrfs-progs: export btrfs_feature structure
Date: Thu, 21 Sep 2023 08:32:50 +0800 [thread overview]
Message-ID: <51ca231b-7245-354a-a7d4-0449000ea4e6@oracle.com> (raw)
In-Reply-To: <512e1bb1572d5ffc3557a86a4ce3860420352214.1693900169.git.wqu@suse.com>
On 05/09/2023 15:51, Qu Wenruo wrote:
> For the incoming "btrfs tune" subcommand, we will have different
> features supported by that subcommand.
>
> Instead of bloating the runtime and mkfs features, here we just export
> btrfs_feature, so each subcommand can have their own definition of
> supported features.
>
Looks good.
> And since we're here, also add needed headers for future users of
> "fsfeatures.h".
>
I don't see anything added, missed?
Thanks, Anand
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
> common/fsfeatures.c | 53 ---------------------------------------------
> common/fsfeatures.h | 50 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 50 insertions(+), 53 deletions(-)
>
> diff --git a/common/fsfeatures.c b/common/fsfeatures.c
> index 9ee392d3a8a6..f8eeea7695c1 100644
> --- a/common/fsfeatures.c
> +++ b/common/fsfeatures.c
> @@ -32,64 +32,11 @@
> #include "common/sysfs-utils.h"
> #include "common/messages.h"
>
> -/*
> - * Insert a root item for temporary tree root
> - *
> - * Only used in make_btrfs_v2().
> - */
> -#define VERSION_TO_STRING3(name, a,b,c) \
> - .name ## _str = #a "." #b "." #c, \
> - .name ## _ver = KERNEL_VERSION(a,b,c)
> -#define VERSION_TO_STRING2(name, a,b) \
> - .name ## _str = #a "." #b, \
> - .name ## _ver = KERNEL_VERSION(a,b,0)
> -#define VERSION_NULL(name) \
> - .name ## _str = NULL, \
> - .name ## _ver = 0
> -
> enum feature_source {
> FS_FEATURES,
> RUNTIME_FEATURES,
> };
>
> -/*
> - * Feature stability status and versions: compat <= safe <= default
> - */
> -struct btrfs_feature {
> - const char *name;
> -
> - /*
> - * At least one of the bit must be set in the following *_flag member.
> - *
> - * For features like list-all and quota which don't have any
> - * incompat/compat_ro bit set, it go to runtime_flag.
> - */
> - u64 incompat_flag;
> - u64 compat_ro_flag;
> - u64 runtime_flag;
> -
> - const char *sysfs_name;
> - /*
> - * Compatibility with kernel of given version. Filesystem can be
> - * mounted.
> - */
> - const char *compat_str;
> - u32 compat_ver;
> - /*
> - * Considered safe for use, but is not on by default, even if the
> - * kernel supports the feature.
> - */
> - const char *safe_str;
> - u32 safe_ver;
> - /*
> - * Considered safe for use and will be turned on by default if
> - * supported by the running kernel.
> - */
> - const char *default_str;
> - u32 default_ver;
> - const char *desc;
> -};
> -
> static const struct btrfs_feature mkfs_features[] = {
> {
> .name = "mixed-bg",
> diff --git a/common/fsfeatures.h b/common/fsfeatures.h
> index c4ab704862cd..c9fb489d2d79 100644
> --- a/common/fsfeatures.h
> +++ b/common/fsfeatures.h
> @@ -19,7 +19,9 @@
>
> #include "kerncompat.h"
> #include <stdio.h>
> +#include <linux/version.h>
> #include "kernel-lib/sizes.h"
> +#include "kernel-shared/uapi/btrfs.h"
>
> #define BTRFS_MKFS_DEFAULT_NODE_SIZE SZ_16K
>
> @@ -43,6 +45,54 @@ struct btrfs_mkfs_features {
> */
> #define BTRFS_FEATURE_STRING_BUF_SIZE (160)
>
> +#define VERSION_TO_STRING3(name, a,b,c) \
> + .name ## _str = #a "." #b "." #c, \
> + .name ## _ver = KERNEL_VERSION(a,b,c)
> +#define VERSION_TO_STRING2(name, a,b) \
> + .name ## _str = #a "." #b, \
> + .name ## _ver = KERNEL_VERSION(a,b,0)
> +#define VERSION_NULL(name) \
> + .name ## _str = NULL, \
> + .name ## _ver = 0
> +
> +/*
> + * Feature stability status and versions: compat <= safe <= default
> + */
> +struct btrfs_feature {
> + const char *name;
> +
> + /*
> + * At least one of the bit must be set in the following *_flag member.
> + *
> + * For features like list-all and quota which don't have any
> + * incompat/compat_ro bit set, it go to runtime_flag.
> + */
> + u64 incompat_flag;
> + u64 compat_ro_flag;
> + u64 runtime_flag;
> +
> + const char *sysfs_name;
> + /*
> + * Compatibility with kernel of given version. Filesystem can be
> + * mounted.
> + */
> + const char *compat_str;
> + u32 compat_ver;
> + /*
> + * Considered safe for use, but is not on by default, even if the
> + * kernel supports the feature.
> + */
> + const char *safe_str;
> + u32 safe_ver;
> + /*
> + * Considered safe for use and will be turned on by default if
> + * supported by the running kernel.
> + */
> + const char *default_str;
> + u32 default_ver;
> + const char *desc;
> +};
> +
> static const struct btrfs_mkfs_features btrfs_mkfs_default_features = {
> .compat_ro_flags = BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE |
> BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID,
next prev parent reply other threads:[~2023-09-21 0:33 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-05 7:51 [PATCH 0/7] btrfs-progs: cmds/tune: add set/clear features Qu Wenruo
2023-09-05 7:51 ` [PATCH 1/7] btrfs-progs: export btrfs_feature structure Qu Wenruo
2023-09-21 0:32 ` Anand Jain [this message]
2023-09-21 21:35 ` Qu Wenruo
2023-09-05 7:51 ` [PATCH 2/7] btrfs-progs: cmds: add "btrfs tune set" subcommand group Qu Wenruo
2023-09-21 0:53 ` Anand Jain
2023-09-21 2:13 ` Qu Wenruo
2023-10-13 17:47 ` David Sterba
2023-10-30 8:26 ` Anand Jain
2023-09-05 7:51 ` [PATCH 3/7] btrfs-progs: cmds/tune: add set support for free-space-tree feature Qu Wenruo
2023-09-05 7:51 ` [PATCH 4/7] btrfs-progs: cmds/tune: add set support for block-group-tree feature Qu Wenruo
2023-09-05 7:51 ` [PATCH 5/7] btrfs-progs: cmds/tune: add set support for seeding device Qu Wenruo
2023-09-05 7:51 ` [PATCH 6/7] btrfs-progs: cmds/tune: add "btrfs tune clear" subcommand Qu Wenruo
2023-09-05 7:51 ` [PATCH 7/7] btrfs-progs: tests/cli: add a test case for "btrfs tune" subcommand Qu Wenruo
2023-09-20 23:03 ` [PATCH 0/7] btrfs-progs: cmds/tune: add set/clear features Qu Wenruo
2023-09-21 22:33 ` waxhead
2023-09-21 22:53 ` Qu Wenruo
2023-10-13 17:55 ` David Sterba
2023-10-13 18:50 ` David Sterba
2023-10-13 20:53 ` Qu Wenruo
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=51ca231b-7245-354a-a7d4-0449000ea4e6@oracle.com \
--to=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.com \
/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;
as well as URLs for NNTP newsgroup(s).