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: David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH v2] btrfs-progs: support free space tree in mkfs
Date: Tue, 8 Sep 2020 21:55:59 +0200	[thread overview]
Message-ID: <20200908195559.GC18399@twin.jikos.cz> (raw)
In-Reply-To: <cf7462fe8c14448703d845d235dce7aca1faf795.1599157021.git.boris@bur.io>

On Thu, Sep 03, 2020 at 11:19:23AM -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>
> ---
> - add mkfs test
> - add documentation
> - add safe version and sysfs file to feature struct
> 
>  Documentation/mkfs.btrfs.asciidoc            |  6 ++++++
>  common/fsfeatures.c                          | 10 ++++++++--
>  common/fsfeatures.h                          |  3 ++-
>  kernel-shared/disk-io.c                      |  5 +++++
>  kernel-shared/free-space-tree.c              |  1 +
>  mkfs/main.c                                  |  8 ++++++++
>  tests/mkfs-tests/023-free-space-tree/test.sh | 21 ++++++++++++++++++++
>  7 files changed, 51 insertions(+), 3 deletions(-)
>  create mode 100755 tests/mkfs-tests/023-free-space-tree/test.sh
> 
> diff --git a/Documentation/mkfs.btrfs.asciidoc b/Documentation/mkfs.btrfs.asciidoc
> index 630f575c..8f1e1429 100644
> --- a/Documentation/mkfs.btrfs.asciidoc
> +++ b/Documentation/mkfs.btrfs.asciidoc
> @@ -257,6 +257,12 @@ permanent, this does not replace mount options.
>  Enable quota support (qgroups). The qgroup accounting will be consistent,
>  can be used together with '--rootdir'.  See also `btrfs-quota`(8).
>  
> +*free_space_tree*::
> +(kernel support since 3.4)
> ++
> +Enable the free space tree (mount option space_cache=v2) for persisting the
> +free space cache.
> +
>  BLOCK GROUPS, CHUNKS, RAID
>  --------------------------
>  
> diff --git a/common/fsfeatures.c b/common/fsfeatures.c
> index 48ab37ca..6c391806 100644
> --- a/common/fsfeatures.c
> +++ b/common/fsfeatures.c
> @@ -104,9 +104,15 @@ static const struct btrfs_feature mkfs_features[] = {
>  };
>  
>  static const struct btrfs_feature runtime_features[] = {
> -	{ "quota", BTRFS_RUNTIME_FEATURE_QUOTA, NULL,
> -		VERSION_TO_STRING2(3, 4), NULL, 0, NULL, 0,
> +	{ "quota", BTRFS_RUNTIME_FEATURE_QUOTA,
> +		"free_space_tree",
> +		VERSION_TO_STRING2(3, 4),
> +		VERSION_TO_STRING2(4, 9),
> +		NULL, 0,

This looks mangled, the free_space_tree (sysfs file reference) is in the
quota entry and the 4.9 version for ->safe use should be in the free-space-tree
entry below. I'll fix it.

>  		"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)" },

>  	/* Keep this one last */
>  	{ "list-all", BTRFS_FEATURE_LIST_ALL, NULL }
>  };

  reply	other threads:[~2020-09-08 19:57 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
2020-09-03 18:19   ` [PATCH v2] " Boris Burkov
2020-09-08 19:55     ` David Sterba [this message]
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=20200908195559.GC18399@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=boris@bur.io \
    --cc=dsterba@suse.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).