public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/3] btrfs-progs: a more generic uuid tree rebuild ability
Date: Fri, 26 Jul 2024 19:29:52 +0930	[thread overview]
Message-ID: <cover.1721987605.git.wqu@suse.com> (raw)

Inspired by Mark's previous attempt to add multi-subvolume mkfs support,
one of the problem he hits is the uuid tree generation.

Currently the uuid tree is only generated for mkfs, but that's
hard-coded for FS_TREE. Furthermore btrfs-convert doesn't really
generate a UUID tree at all.

Thus this patchset introduces a more generic uuid tree rebuild, without
the need to touch the existing subvolume creation code.

This is done by:

- Create a new uuid tree if there is not one

- Empty the existing uuid tree

- Iterate through all subvolumes
  * If the subvolume has no valid UUID, regenerate one
  * Add the uuid entry for the subvolume UUID
  * If the subvolume has received UUID, also add it to UUID tree

This can handle all the situations I can think of, include the future
multi-subvolume mkfs support.

The first two patches are just cleanup and preparation, the main dish is
the last patch.

Qu Wenruo (3):
  btrfs-progs: move uuid-tree definitions to kernel-shared/uuid-tree.h
  btrfs-progs: cross-port btrfs_uuid_tree_add() from kernel
  btrfs-progs: introduce btrfs_rebuild_uuid_tree() for mkfs and
    btrfs-convert

 common/root-tree-utils.c  | 265 ++++++++++++++++++++++++++++++++++++++
 common/root-tree-utils.h  |   1 +
 common/send-utils.c       |   1 +
 convert/main.c            |   5 +
 kernel-shared/ctree.h     |  11 --
 kernel-shared/uuid-tree.c | 120 +++++++++++++++++
 kernel-shared/uuid-tree.h |  35 +++++
 mkfs/main.c               |  94 +-------------
 8 files changed, 431 insertions(+), 101 deletions(-)
 create mode 100644 kernel-shared/uuid-tree.h

--
2.45.2


             reply	other threads:[~2024-07-26 10:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26  9:59 Qu Wenruo [this message]
2024-07-26  9:59 ` [PATCH 1/3] btrfs-progs: move uuid-tree definitions to kernel-shared/uuid-tree.h Qu Wenruo
2024-07-26  9:59 ` [PATCH 2/3] btrfs-progs: cross-port btrfs_uuid_tree_add() from kernel Qu Wenruo
2024-07-26  9:59 ` [PATCH 3/3] btrfs-progs: introduce btrfs_rebuild_uuid_tree() for mkfs and btrfs-convert Qu Wenruo
2024-07-26 10:03   ` Qu Wenruo
2024-07-26 14:49   ` Josef Bacik
2024-07-26 15:35   ` David Sterba
2024-07-26 22:33     ` Qu Wenruo
2024-07-26 22:58       ` David Sterba

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=cover.1721987605.git.wqu@suse.com \
    --to=wqu@suse.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