All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/20] btrfs: refactor and generalize chunk/dev_extent/extent allocation
@ 2020-02-06 10:41 Naohiro Aota
  2020-02-06 10:41 ` [PATCH 01/20] btrfs: change type of full_search to bool Naohiro Aota
                   ` (20 more replies)
  0 siblings, 21 replies; 52+ messages in thread
From: Naohiro Aota @ 2020-02-06 10:41 UTC (permalink / raw)
  To: linux-btrfs, David Sterba
  Cc: Chris Mason, Josef Bacik, Nikolay Borisov, Damien Le Moal,
	Johannes Thumshirn, Hannes Reinecke, Anand Jain, linux-fsdevel,
	Naohiro Aota

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

On top of this series, we can simplify some part of the "btrfs: zoned
block device support" 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 has no functional changes except introducing "enum
btrfs_chunk_allocation_policy" and "enum
btrfs_extent_allocation_policy".

* 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.

__btrfs_alloc_chunk() is split into four functions. set_parameters()
initializes the parameters of an allocation. gather_device_info()
loops over devices and gather information of
them. decide_stripe_size() decides the size of chunk and
device_extent. And, create_chunk() creates a chunk and device extents.

* Refactoring extent allocator

Three functions are introduced in
find_free_extent(). prepare_allocation() initializes the parameters
and gives a hint byte to start the allocation with. do_allocation()
handles the actual allocation in a given block group.
release_block_group() is called when it gives up an allocation from a
block group, so the allocation context should be reset.

Two functions are introduced in find_free_extent_update_loop().
found_extent() is called when the allocator finally find a proper
extent. chunk_allocation_failed() is called when it failed to allocate
a new chunk. An allocator implementation can use this hook to set the
next stage to try e.g. LOOP_NO_EMPTY_SIZE.

Furthermore, LOOP_NO_EMPTY_SIZE stage is tweaked so that other
allocator than the current clustered allocator skips this stage.

* Patch organization

Patch 1 is a trivial patch to fix the type of an argument of
find_free_extent_update_loop().

Patches 2-9 refactors chunk and device_extent allocation functions:
find_free_dev_extent_start() and __btrfs_alloc_chunk().

Patches 10-20 refactors extent allocation function: find_free_extent()
and find_free_extent_update_loop().

Naohiro Aota (20):
  btrfs: change type of full_search to bool
  btrfs: introduce chunk allocation policy
  btrfs: refactor find_free_dev_extent_start()
  btrfs: introduce alloc_chunk_ctl
  btrfs: factor out set_parameters()
  btrfs: factor out gather_device_info()
  btrfs: factor out decide_stripe_size()
  btrfs: factor out create_chunk()
  btrfs: parameterize dev_extent_min
  btrfs: introduce extent allocation policy
  btrfs: move hint_byte into find_free_extent_ctl
  btrfs: introduce clustered_alloc_info
  btrfs: factor out do_allocation()
  btrfs: drop unnecessary arguments from clustered allocation functions
  btrfs: factor out release_block_group()
  btrfs: factor out found_extent()
  btrfs: drop unnecessary arguments from find_free_extent_update_loop()
  btrfs: factor out chunk_allocation_failed()
  btrfs: add assertion on LOOP_NO_EMPTY_SIZE stage
  btrfs: factor out prepare_allocation()

 fs/btrfs/extent-tree.c | 378 ++++++++++++++++++++++++++-------------
 fs/btrfs/volumes.c     | 397 +++++++++++++++++++++++++++--------------
 fs/btrfs/volumes.h     |   6 +
 3 files changed, 525 insertions(+), 256 deletions(-)

-- 
2.25.0


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

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

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-06 10:41 [PATCH 00/20] btrfs: refactor and generalize chunk/dev_extent/extent allocation Naohiro Aota
2020-02-06 10:41 ` [PATCH 01/20] btrfs: change type of full_search to bool Naohiro Aota
2020-02-06 11:26   ` Johannes Thumshirn
2020-02-06 16:03   ` Josef Bacik
2020-02-06 10:41 ` [PATCH 02/20] btrfs: introduce chunk allocation policy Naohiro Aota
2020-02-06 11:30   ` Johannes Thumshirn
2020-02-07  6:11     ` Naohiro Aota
2020-02-06 16:06   ` Josef Bacik
2020-02-06 16:07   ` Josef Bacik
2020-02-06 10:41 ` [PATCH 03/20] btrfs: refactor find_free_dev_extent_start() Naohiro Aota
2020-02-06 12:02   ` Johannes Thumshirn
2020-02-07  6:22     ` Naohiro Aota
2020-02-06 16:34   ` Josef Bacik
2020-02-06 10:41 ` [PATCH 04/20] btrfs: introduce alloc_chunk_ctl Naohiro Aota
2020-02-06 12:07   ` Johannes Thumshirn
2020-02-06 16:38   ` Josef Bacik
2020-02-07  7:08     ` Naohiro Aota
2020-02-06 10:41 ` [PATCH 05/20] btrfs: factor out set_parameters() Naohiro Aota
2020-02-06 13:51   ` Johannes Thumshirn
2020-02-06 16:40   ` Josef Bacik
2020-02-07  7:59     ` Naohiro Aota
2020-02-06 10:42 ` [PATCH 06/20] btrfs: factor out gather_device_info() Naohiro Aota
2020-02-06 15:43   ` Johannes Thumshirn
2020-02-07  9:54     ` Naohiro Aota
2020-02-06 16:44   ` Josef Bacik
2020-02-06 10:42 ` [PATCH 07/20] btrfs: factor out decide_stripe_size() Naohiro Aota
2020-02-06 15:59   ` Johannes Thumshirn
2020-02-06 16:47   ` Josef Bacik
2020-02-06 10:42 ` [PATCH 08/20] btrfs: factor out create_chunk() Naohiro Aota
2020-02-06 16:49   ` Josef Bacik
2020-02-07  9:17     ` Naohiro Aota
2020-02-06 10:42 ` [PATCH 09/20] btrfs: parameterize dev_extent_min Naohiro Aota
2020-02-06 16:52   ` Josef Bacik
2020-02-07  9:00     ` Naohiro Aota
2020-02-06 10:42 ` [PATCH 10/20] btrfs: introduce extent allocation policy Naohiro Aota
2020-02-06 10:42 ` [PATCH 11/20] btrfs: move hint_byte into find_free_extent_ctl Naohiro Aota
2020-02-06 10:42 ` [PATCH 12/20] btrfs: introduce clustered_alloc_info Naohiro Aota
2020-02-06 12:44   ` Su Yue
2020-02-07  9:25     ` Naohiro Aota
2020-02-06 17:01   ` Josef Bacik
2020-02-07  9:53     ` Naohiro Aota
2020-02-06 10:42 ` [PATCH 13/20] btrfs: factor out do_allocation() Naohiro Aota
2020-02-06 10:42 ` [PATCH 14/20] btrfs: drop unnecessary arguments from clustered allocation functions Naohiro Aota
2020-02-06 10:42 ` [PATCH 15/20] btrfs: factor out release_block_group() Naohiro Aota
2020-02-06 10:42 ` [PATCH 16/20] btrfs: factor out found_extent() Naohiro Aota
2020-02-06 10:42 ` [PATCH 17/20] btrfs: drop unnecessary arguments from find_free_extent_update_loop() Naohiro Aota
2020-02-06 10:42 ` [PATCH 18/20] btrfs: factor out chunk_allocation_failed() Naohiro Aota
2020-02-06 10:42 ` [PATCH 19/20] btrfs: skip LOOP_NO_EMPTY_SIZE if not clustered allocation Naohiro Aota
2020-02-06 10:42 ` [PATCH 20/20] btrfs: factor out prepare_allocation() Naohiro Aota
2020-02-06 11:43 ` [PATCH 00/20] btrfs: refactor and generalize chunk/dev_extent/extent allocation Martin Steigerwald
2020-02-07  6:06   ` Naohiro Aota
2020-02-07  8:02     ` Martin Steigerwald

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.