diff options
author | Josef Bacik <josef@toxicpanda.com> | 2019-06-20 15:38:04 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-09-09 14:59:09 +0200 |
commit | 07730d87ac7872b54efa02da5d20b42fd6bb165a (patch) | |
tree | bc1f9b69ef68cf9fc6eb689820e2d30460c483b3 /fs/btrfs/block-group.h | |
parent | 606d1bf10d7ebafdee26e8896b467b885c5233ec (diff) | |
download | linux-07730d87ac7872b54efa02da5d20b42fd6bb165a.tar.bz2 |
btrfs: migrate the chunk allocation code
This feels more at home in block-group.c than in extent-tree.c.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>i
[ refresh ]
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/block-group.h')
-rw-r--r-- | fs/btrfs/block-group.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/btrfs/block-group.h b/fs/btrfs/block-group.h index 886bfa88ae06..de90f7311574 100644 --- a/fs/btrfs/block-group.h +++ b/fs/btrfs/block-group.h @@ -10,6 +10,23 @@ enum btrfs_disk_cache_state { BTRFS_DC_SETUP, }; +/* + * Control flags for do_chunk_alloc's force field CHUNK_ALLOC_NO_FORCE means to + * only allocate a chunk if we really need one. + * + * CHUNK_ALLOC_LIMITED means to only try and allocate one if we have very few + * chunks already allocated. This is used as part of the clustering code to + * help make sure we have a good pool of storage to cluster in, without filling + * the FS with empty chunks + * + * CHUNK_ALLOC_FORCE means it must try to allocate one + */ +enum btrfs_chunk_alloc_enum { + CHUNK_ALLOC_NO_FORCE, + CHUNK_ALLOC_LIMITED, + CHUNK_ALLOC_FORCE, +}; + struct btrfs_caching_control { struct list_head list; struct mutex mutex; @@ -198,6 +215,10 @@ int btrfs_add_reserved_bytes(struct btrfs_block_group_cache *cache, u64 ram_bytes, u64 num_bytes, int delalloc); void btrfs_free_reserved_bytes(struct btrfs_block_group_cache *cache, u64 num_bytes, int delalloc); +int btrfs_chunk_alloc(struct btrfs_trans_handle *trans, u64 flags, + enum btrfs_chunk_alloc_enum force); +int btrfs_force_chunk_alloc(struct btrfs_trans_handle *trans, u64 type); +void check_system_chunk(struct btrfs_trans_handle *trans, const u64 type); static inline int btrfs_block_group_cache_done( struct btrfs_block_group_cache *cache) |