Skip to content

Chunk allocator unification

Qu Wenruo linux-btrfs 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest9 patches 0 repliesNew
  2. v210 patches 5 repliesSuperseded
  3. v17 patches 9 repliesSuperseded

Changes in v3 from the cover letter

Use standard library function qsort() to replace the kernel sort(), suggested by David.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9btrfs-progs: Refactor parameter of BTRFS_MAX_DEVS() from root to fs_infovolumes.c+3 -30 replies
2/9btrfs-progs: Merge btrfs_alloc_data_chunk into btrfs_alloc_chunkconvert/main.c extent-tree.c mkfs/main.c +2 more+94 -1460 replies
3/9btrfs-progs: Make btrfs_alloc_chunk to handle block group creationconvert/main.c extent-tree.c mkfs/main.c +1 more+8 -350 replies
4/9btrfs-progs: Introduce btrfs_raid_array and related infrastructuresctree.h volumes.c volumes.h+107 -10 replies
5/9btrfs-progs: volumes: Allow find_free_dev_extent() to return maximum hole sizevolumes.c+3 -30 replies
6/9btrfs-progs: volumes: Unify free dev extent search behavior between kernel and btrfs-progs.kerncompat.h volumes.c volumes.h+284 -3480 replies
7/9btrfs-progs: Move chunk stripe size calcution function to volumes.hcheck/main.c volumes.h+22 -220 replies
8/9btrfs-progs: Use btrfs_device->fs_info to replace btrfs_device->dev_rootutils.c volumes.c volumes.h+5 -50 replies
9/9btrfs-progs: Refactor btrfs_alloc_chunk to mimic kernel structure and behaviorvolumes.c+260 -1610 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/9] Chunk allocator unification

This patchset can be fetched from github:
https://github.com/adam900710/btrfs-progs/tree/libbtrfs_prepare

This patchset unified a large part of chunk allocator (free device extent search) between kernel and btrfs-progs.
And reuses kernel function structures like btrfs_finish_chunk_alloc() and btrfs_alloc_dev_extent().

Before the unification:

               Kernel                |              Btrfs-progs
 btrfs_alloc_chunk()                 | btrfs_alloc_chunk()
 |- __btrfs_alloc_chunk()            | |- Do all the work
                                     |
 btrfs_create_pending_block_groups() |
 |- btrfs_insert_item()              |
 |- btrfs_finish_chunk_alloc()       |
    |- btrfs_alloc_dev_extent()      |

After the unification:

               Kernel                |              Btrfs-progs
 btrfs_alloc_chunk()                 | btrfs_alloc_chunk()
 |- __btrfs_alloc_chunk()            | |- __btrfs_alloc_chunk()
                                     | |- btrfs_finish_chunk_alloc()
 btrfs_create_pending_block_groups() |    |- btrfs_alloc_dev_extent()
 |- btrfs_insert_item()              |
 |- btrfs_finish_chunk_alloc()       |

And the similiar functions are share the same code base, with minor member/functions change.

Changelog:
v2:
Make error handler in patch 7 better.
New patches to unify more functions used in btrfs_alloc_chunk()

v3:
Use standard library function qsort() to replace the kernel sort(), suggested by David.

Qu Wenruo (9):
btrfs-progs: Refactor parameter of BTRFS_MAX_DEVS() from root to
fs_info
btrfs-progs: Merge btrfs_alloc_data_chunk into btrfs_alloc_chunk
btrfs-progs: Make btrfs_alloc_chunk to handle block group creation
btrfs-progs: Introduce btrfs_raid_array and related infrastructures
btrfs-progs: volumes: Allow find_free_dev_extent() to return maximum
hole size
btrfs-progs: volumes: Unify free dev extent search behavior between
kernel and btrfs-progs.
btrfs-progs: Move chunk stripe size calcution function to volumes.h
btrfs-progs: Use btrfs_device->fs_info to replace

    btrfs_device->dev_root

btrfs-progs: Refactor btrfs_alloc_chunk to mimic kernel structure and
behavior

 check/main.c   |  22 --
 convert/main.c |  10 +-
 ctree.h        |  12 +-
 extent-tree.c  |  12 +-
 kerncompat.h   |   5 +
 mkfs/main.c    |  27 +-
 utils.c        |   2 +-
 volumes.c      | 926 ++++++++++++++++++++++++++++++---------------------------
 volumes.h      |  66 +++-
 9 files changed, 572 insertions(+), 510 deletions(-)
Signature · 1 line
2.16.2