linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Boris Burkov <boris@bur.io>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] btrfs-progs: support free space tree in mkfs
Date: Wed, 2 Sep 2020 22:44:53 +0200	[thread overview]
Message-ID: <20200902204453.GN28318@twin.jikos.cz> (raw)
In-Reply-To: <0366b5e12a7e6f95d9f274df52f32231dcbe8b05.1599072541.git.boris@bur.io>

On Wed, Sep 02, 2020 at 11:50:49AM -0700, Boris Burkov wrote:
> Add a runtime feature (-R) flag for the free space tree. A filesystem
> that is mkfs'd with -R free-space-tree then mounted with no options has
> the same contents as one mkfs'd without the option, then mounted with
> '-o space_cache=v2'.
> 
> The only tricky thing is in exactly how to call the tree creation code.
> Using btrfs_create_free_space_tree as is did not quite work, because an
> extra reference to the eb (root->commit_root) is leaked, which mkfs
> complains about with a warning. I opted to follow how the uuid tree is
> created by adding it to the dirty roots list for cleanup by
> commit_tree_roots in commit_transaction. As a result,
> btrfs_create_free_space_tree no longer exactly matches the version in
> the kernel sources.
> 
> Signed-off-by: Boris Burkov <boris@bur.io>

Thanks.

> ---
>  common/fsfeatures.c             | 3 +++
>  common/fsfeatures.h             | 3 ++-
>  kernel-shared/disk-io.c         | 5 +++++
>  kernel-shared/free-space-tree.c | 1 +
>  mkfs/main.c                     | 8 ++++++++
>  5 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/common/fsfeatures.c b/common/fsfeatures.c
> index 48ab37ca..3bebc97f 100644
> --- a/common/fsfeatures.c
> +++ b/common/fsfeatures.c
> @@ -107,6 +107,9 @@ static const struct btrfs_feature runtime_features[] = {
>  	{ "quota", BTRFS_RUNTIME_FEATURE_QUOTA, NULL,
>  		VERSION_TO_STRING2(3, 4), NULL, 0, NULL, 0,
>  		"quota support (qgroups)" },
> +	{ "free-space-tree", BTRFS_RUNTIME_FEATURE_FREE_SPACE_TREE, NULL,
> +		VERSION_TO_STRING2(4, 5), NULL, 0, NULL, 0,
> +		"free space tree (space_cache=v2)" },

The unfilled items are: sysfs file (we have that, free_space_tree), the
safe version is 4.9 (that's where the FREE_SPACE_TREE_VALID bit comes
from).

I've run the mkfs tests with the -R flag and all passed, so I'll enable
it in the CI script, with the fixes mentioned above.

We should still have a separate test, similar to what
mkfs/021-rfeatures-quota-rootdir does but this time the presence of the
feature should be checked at least after mkfs (by inspect+dump-super)
and conditionally by mount in case the kernel supports it.

Last but not least the documentation should be updated for mkfs in the
section 'RUNTIME FEATURES'. Thanks.

  parent reply	other threads:[~2020-09-02 20:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02 18:50 [PATCH] btrfs-progs: support free space tree in mkfs Boris Burkov
2020-09-02 19:09 ` Josef Bacik
2020-09-02 20:44 ` David Sterba [this message]
2020-09-03 18:19   ` [PATCH v2] " Boris Burkov
2020-09-08 19:55     ` David Sterba
2020-09-08 20:41       ` Boris Burkov

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=20200902204453.GN28318@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=boris@bur.io \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).