Skip to content

btrfs-progs: refactor and generalize chunk/dev_extent allocation

Naohiro Aota linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest12 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12btrfs-progs: introduce chunk allocation policykernel-shared/volumes.c kernel-shared/volumes.h+7 -00 replies
2/12btrfs-progs: refactor find_free_dev_extent_start()kernel-shared/volumes.c+16 -80 replies
3/12btrfs-progs: convert type of alloc_chunk_ctl::typekernel-shared/volumes.c+3 -30 replies
4/12btrfs-progs: consolidate parameter initialization of regular allocatorkernel-shared/volumes.c+64 -480 replies
5/12btrfs-progs: factor out decide_stripe_size()kernel-shared/volumes.c+34 -100 replies
6/12btrfs-progs: factor out create_chunk()kernel-shared/volumes.c+120 -970 replies
7/12btrfs-progs: rewrite btrfs_alloc_data_chunk() using create_chunk()kernel-shared/volumes.c+43 -930 replies
8/12btrfs-progs: fix to use half the available space for DUP profilekernel-shared/volumes.c+4 -10 replies
9/12btrfs-progs: use round_down for allocation calcskernel-shared/volumes.c+6 -60 replies
10/12btrfs-progs: drop alloc_chunk_ctl::stripe_lenkernel-shared/volumes.c+8 -110 replies
11/12btrfs-progs: simplify arguments of chunk_bytes_by_type()kernel-shared/volumes.c+6 -60 replies
12/12btrfs-progs: rename calc_size to stripe_sizekernel-shared/volumes.c+28 -280 replies

Reviews trailers per patch

None of the 12 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJohannes Thumshirn
SeriesR-b
1/12
2/12
3/12
4/12
5/12
6/12
7/12
8/12
9/12
10/12
11/12
12/12

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/12] btrfs-progs: refactor and generalize chunk/dev_extent allocation

This is the userland counterpart of the following series.

https://lore.kernel.org/linux-btrfs/[email protected]/

This series refactors chunk allocation and device_extent allocation functions and make them generalized to be able to implement other allocation policy easily.

On top of this series, we can simplify userland side of the zoned series as adding a new type of chunk allocator and extent allocator for zoned block devices. Furthermore, we will be able to implement and test some other allocator in the idea page of the wiki e.g. SSD caching, dedicated metadata drive, chunk allocation groups, and so on.

This series also fixes a bug of calculating the stripe size in DUP profile, and cleans up the code.

* Refactoring chunk/dev_extent allocator

Two functions are separated from find_free_dev_extent_start(). dev_extent_search_start() decides the starting position of the search. dev_extent_hole_check() checks if a hole found is suitable for device extent allocation.

Split some parts of btrfs_alloc_chunk() into three functions. init_alloc_chunk_policy() initializes the parameters of an allocation. decide_stripe_size() decides the size of chunk and device_extent. And, create_chunk() creates a chunk and device extents.

* Patch organization

Patches 1 and 2 refactor find_free_dev_extent_start().

Patches 3 to 6 refactor btrfs_alloc_chunk() by moving the code into three other functions.

Patch 7 uses create_chunk() to simplify btrfs_alloc_data_chunk().

Patch 8 fixes a bug of calculating stripe size in DUP profile.

Patches 9 to 12 clean up btrfs_alloc_chunk() code by dropping unnecessary parameters, and using better macro/variable name to clarify the meaning.

Naohiro Aota (12):
btrfs-progs: introduce chunk allocation policy
btrfs-progs: refactor find_free_dev_extent_start()
btrfs-progs: convert type of alloc_chunk_ctl::type
btrfs-progs: consolidate parameter initialization of regular allocator
btrfs-progs: factor out decide_stripe_size()
btrfs-progs: factor out create_chunk()
btrfs-progs: rewrite btrfs_alloc_data_chunk() using create_chunk()
btrfs-progs: fix to use half the available space for DUP profile
btrfs-progs: use round_down for allocation calcs
btrfs-progs: drop alloc_chunk_ctl::stripe_len
btrfs-progs: simplify arguments of chunk_bytes_by_type()
btrfs-progs: rename calc_size to stripe_size

 kernel-shared/volumes.c | 514 +++++++++++++++++++++-------------------
 kernel-shared/volumes.h |   6 +
 2 files changed, 274 insertions(+), 246 deletions(-)
Signature · 1 line
2.31.1