All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs-progs: small cleanups related to subvolume creation
@ 2024-07-02  9:04 Qu Wenruo
  2024-07-02  9:04 ` [PATCH 1/2] btrfs-progs: remove fs_info parameter from btrfs_create_tree() Qu Wenruo
  2024-07-02  9:04 ` [PATCH 2/2] btrfs-progs: introduce btrfs_make_subvolume() Qu Wenruo
  0 siblings, 2 replies; 3+ messages in thread
From: Qu Wenruo @ 2024-07-02  9:04 UTC (permalink / raw)
  To: linux-btrfs

Thanks to Mark's new effort to introduce subvolume creation ability, the
long existing duplicated subvolume creation problem is exposed again.

The first patch to do a small cleanup for btrfs_create_tree() so that
the parameter list matches the kernel one.

The second one is the main dish to fully merge the different functions
to create a subvolume.

We have btrfs_create_tree() to properly create an empty tree, and
btrfs_make_root_dir() to create the initial root dir.

So use them to create btrfs_make_subvolume():

- Calls btrfs_create_tree() to properly create an empty tree
  Unlike btrfs_copy_root() used in create_subvol(), which can be unsafe
  if the source subvolume is not empty.

- Calls btrfs_read_fs_root() to setup the cache and tracking
  Inside create_data_reloc_tree() we directly added the root to
  fs_root_tree, which is only safe for data reloc tree.

  As we didn't properly set the correct tracking flags.

- Calls btrfs_make_root_dir() to setup the root directory
- Calls btrfs_update_root() to reflect the rootdir change

Qu Wenruo (2):
  btrfs-progs: remove fs_info parameter from btrfs_create_tree()
  btrfs-progs: introduce btrfs_make_subvolume()

 Makefile                        |   1 +
 check/main.c                    |   1 +
 common/root-tree-utils.c        | 108 ++++++++++++++++++++++++++++++++
 common/root-tree-utils.h        |  26 ++++++++
 convert/main.c                  |  43 +------------
 kernel-shared/disk-io.c         |   4 +-
 kernel-shared/disk-io.h         |   1 -
 kernel-shared/free-space-tree.c |   2 +-
 mkfs/common.c                   |  39 ------------
 mkfs/common.h                   |   2 -
 mkfs/main.c                     |  78 ++---------------------
 11 files changed, 147 insertions(+), 158 deletions(-)
 create mode 100644 common/root-tree-utils.c
 create mode 100644 common/root-tree-utils.h

--
2.45.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-02  9:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-02  9:04 [PATCH 0/2] btrfs-progs: small cleanups related to subvolume creation Qu Wenruo
2024-07-02  9:04 ` [PATCH 1/2] btrfs-progs: remove fs_info parameter from btrfs_create_tree() Qu Wenruo
2024-07-02  9:04 ` [PATCH 2/2] btrfs-progs: introduce btrfs_make_subvolume() Qu Wenruo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.