btrfs-progs: Sync code for btrfs_block_group
cover btrfs-progs: Sync code for btrfs_block_group
This patchset mostly make btrfs_block_group structure to sync with kernel, providing the basis for later modification. (Hint: skinny bg tree)
Qu Wenruo (3):
btrfs-progs: Kill block_group_cache::key
btrfs-progs: Remove the unused btrfs_block_group_cache::cache
btrfs-progs: Rename btrfs_block_group_cache to btrfs_block_group
check/main.c | 43 ++++--- check/mode-common.c | 4 +- check/mode-lowmem.c | 10 +- cmds/rescue-chunk-recover.c | 6 +- convert/main.c | 8 +- convert/source-fs.c | 4 +- ctree.h | 21 ++-- extent-tree.c | 209 ++++++++++++++++---------------- free-space-cache.c | 32 ++--- free-space-cache.h | 12 +- image/main.c | 2 +- kernel-shared/free-space-tree.c | 117 +++++++++--------- kernel-shared/free-space-tree.h | 6 +- mkfs/main.c | 12 +- transaction.h | 2 +- volumes.h | 4 +- 16 files changed, 247 insertions(+), 245 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/3 btrfs-progs: Kill block_group_cache::key
This would sync the code between kernel and btrfs-progs, and save at least 1 byte for each btrfs_block_group_cache.
--- check/main.c | 29 +++---- check/mode-common.c | 2 +- check/mode-lowmem.c | 4 +- cmds/rescue-chunk-recover.c | 4 +- convert/main.c | 6 +- convert/source-fs.c | 2 +- ctree.h | 3 +- extent-tree.c | 133 ++++++++++++++++---------------- free-space-cache.c | 22 +++--- kernel-shared/free-space-tree.c | 77 +++++++++--------- mkfs/main.c | 10 +-- volumes.h | 2 +- 12 files changed, 150 insertions(+), 144 deletions(-)
check/main.c +16 -13
@@ -5455,7 +5455,7 @@ static int check_cache_range(struct btrfs_root *root,for (i =0 ; i <BTRFS_SUPER_MIRROR_MAX ; i++) { bytenr =btrfs_sb_offset (i); ret =btrfs_rmap_block (root->fs_info, - cache->key.objectid, bytenr, + cache->start, bytenr, &logical, &nr, &stripe_len);if (ret)return ret;
@@ -5547,7 +5547,7 @@ static int verify_space_cache(struct btrfs_root *root, root = root->fs_info->extent_root; - last =max_t (u64, cache->key.objectid,BTRFS_SUPER_INFO_OFFSET ); + last =max_t (u64, cache->start,BTRFS_SUPER_INFO_OFFSET );btrfs_init_path (&path); key.objectid = last;
@@ -5569,7 +5569,7 @@ static int verify_space_cache(struct btrfs_root *root, } leaf = path.nodes[0 ];btrfs_item_key_to_cpu (leaf, &key, path.slots[0 ]); -if (key.objectid >= cache->key.offset + cache->key.objectid) +if (key.objectid >= cache->start + cache->length)break ;if (key.type !=BTRFS_EXTENT_ITEM_KEY && key.type !=BTRFS_METADATA_ITEM_KEY ) {
@@ -5597,10 +5597,9 @@ static int verify_space_cache(struct btrfs_root *root, path.slots[0 ]++; } -if (last < cache->key.objectid + cache->key.offset) +if (last < cache->start + cache->length) ret =check_cache_range (root, cache, last, - cache->key.objectid + - cache->key.offset - last); + cache->start + cache->length - last); out:btrfs_release_path (&path);
@@ -5628,7 +5627,7 @@ static int check_space_cache(struct btrfs_root *root)if (!cache)break ; - start = cache->key.objectid + cache->key.offset; + start = cache->start + cache->length;if (!cache->free_space_ctl) {if (btrfs_init_free_space_ctl (cache, root->fs_info->sectorsize)) {
@@ -5669,7 +5668,7 @@ static int check_space_cache(struct btrfs_root *root) ret =verify_space_cache (root, cache);if (ret) {fprintf (stderr,"cache appears valid but isn't %llu\n" , - cache->key.objectid); + cache->start); error++; } }
@@ -8970,7 +8969,7 @@ static int reset_block_groups(struct btrfs_fs_info *fs_info)if (!cache)break ; cache->cached =1 ; - start = cache->key.objectid + cache->key.offset; + start = cache->start + cache->length; }btrfs_release_path (&path);
@@ -9156,17 +9155,21 @@ again:while (1 ) {struct btrfs_block_group_item bgi;struct btrfs_block_group_cache *cache; +struct btrfs_key key; cache =btrfs_lookup_first_block_group (fs_info, start);if (!cache)break ; - start = cache->key.objectid + cache->key.offset; + start = cache->start + cache->length;btrfs_set_block_group_used (&bgi, cache->used);btrfs_set_block_group_chunk_objectid (&bgi,BTRFS_FIRST_CHUNK_TREE_OBJECTID );btrfs_set_block_group_flags (&bgi, cache->flags); - ret =btrfs_insert_item (trans, fs_info->extent_root, - &cache->key, &bgi,sizeof (bgi)); + key.objectid = cache->start; + key.type =BTRFS_BLOCK_GROUP_ITEM_KEY ; + key.offset = cache->length; + ret =btrfs_insert_item (trans, fs_info->extent_root, &key, + &bgi,sizeof (bgi));if (ret) {fprintf (stderr,"Error adding block group\n" );return ret;
@@ -9815,7 +9818,7 @@ static int clear_free_space_cache(struct btrfs_fs_info *fs_info) ret =btrfs_clear_free_space_cache (fs_info, bg_cache);if (ret <0 )return ret; - current = bg_cache->key.objectid + bg_cache->key.offset; + current = bg_cache->start + bg_cache->length; }/* Don't forget to set cache_generation to -1 */
check/mode-common.c +1 -1
@@ -601,7 +601,7 @@ void reset_cached_block_groups(struct btrfs_fs_info *fs_info)break ;if (cache->cached) cache->cached =0 ; - start = cache->key.objectid + cache->key.offset; + start = cache->start + cache->length; } }
check/mode-lowmem.c +2 -2
@@ -242,8 +242,8 @@ static int modify_block_group_cache(struct btrfs_fs_info *fs_info, struct btrfs_block_group_cache *block_group, int cache) {struct extent_io_tree *free_space_cache = &fs_info->free_space_cache; -u64 start = block_group->key.objectid; -u64 end = start + block_group->key.offset; +u64 start = block_group->start; +u64 end = start + block_group->length;if (cache && !block_group->cached) { block_group->cached =1 ;
cmds/rescue-chunk-recover.c +2 -2
@@ -1097,8 +1097,8 @@ static int block_group_free_all_extent(struct btrfs_trans_handle *trans,if (!cache)return -ENOENT ; - start = cache->key.objectid; - end = start + cache->key.offset -1 ; + start = cache->start; + end = start + cache->length -1 ;if (list_empty (&cache->dirty_list))list_add_tail (&cache->dirty_list, &trans->dirty_bgs);
convert/main.c +3 -3
@@ -300,13 +300,13 @@ static int create_image_file_range(struct btrfs_trans_handle *trans,if (!(bg_cache->flags &BTRFS_BLOCK_GROUP_DATA )) {error ("data bytenr %llu is covered by non-data block group %llu flags 0x%llu" , - bytenr, bg_cache->key.objectid, bg_cache->flags); + bytenr, bg_cache->start, bg_cache->flags);return -EINVAL ; }/* The extent should never cross block group boundary */ - len =min_t (u64, len, bg_cache->key.objectid + - bg_cache->key.offset - bytenr); + len =min_t (u64, len, bg_cache->start + bg_cache->length - + bytenr); }if (len !=round_down (len, root->fs_info->sectorsize)) {
convert/source-fs.c +1 -1
@@ -120,7 +120,7 @@ int block_iterate_proc(u64 disk_block, u64 file_block, }else { cache =btrfs_lookup_block_group (root->fs_info, bytenr);BUG_ON (!cache); - bytenr = cache->key.objectid + cache->key.offset; + bytenr = cache->start + cache->length; } idata->first_block = file_block;
ctree.h +2 -1
@@ -1106,9 +1106,10 @@ struct btrfs_space_info {struct btrfs_block_group_cache {struct cache_extent cache; -struct btrfs_key key;struct btrfs_space_info *space_info;struct btrfs_free_space_ctl *free_space_ctl; +u64 start; +u64 length;u64 used;u64 bytes_super;u64 pinned;
extent-tree.c +67 -66
353 lines not on this page · raw message
free-space-cache.c +11 -11
@@ -446,15 +446,15 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info,return 0 ; ret =__load_free_space_cache (fs_info->tree_root, ctl, path, - block_group->key.objectid); + block_group->start);btrfs_free_path (path); - bg_free = block_group->key.offset - used - block_group->bytes_super; + bg_free = block_group->length - used - block_group->bytes_super; diff = ctl->free_space - bg_free;if (ret ==1 && diff) {fprintf (stderr,"block group %llu has wrong amount of free space, free space cache has %llu block group has %llu\n" , - block_group->key.objectid, ctl->free_space, bg_free); + block_group->start, ctl->free_space, bg_free);__btrfs_remove_free_space_cache (ctl);/* * Due to btrfs_reserve_extent() can happen out of a
@@ -479,7 +479,7 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info,fprintf (stderr,"failed to load free space cache for block group %llu\n" , - block_group->key.objectid); + block_group->start); }return ret;
@@ -797,7 +797,7 @@ int btrfs_init_free_space_ctl(struct btrfs_block_group_cache *block_group, ctl->sectorsize = sectorsize; ctl->unit = sectorsize; - ctl->start = block_group->key.objectid; + ctl->start = block_group->start; ctl->private = block_group; block_group->free_space_ctl = ctl;
@@ -917,7 +917,7 @@ int btrfs_clear_free_space_cache(struct btrfs_fs_info *fs_info, key.objectid =BTRFS_FREE_SPACE_OBJECTID ; key.type =0 ; - key.offset = bg->key.objectid; + key.offset = bg->start; ret =btrfs_search_slot (trans, tree_root, &key, &path,-1 ,1 );if (ret >0 ) {
@@ -937,7 +937,7 @@ int btrfs_clear_free_space_cache(struct btrfs_fs_info *fs_info, ret =btrfs_del_item (trans, tree_root, &path);if (ret <0 ) {error ("failed to remove free space header for block group %llu: %d" , - bg->key.objectid, ret); + bg->start, ret); goto out; }btrfs_release_path (&path);
@@ -949,7 +949,7 @@ int btrfs_clear_free_space_cache(struct btrfs_fs_info *fs_info, ret =btrfs_search_slot (trans, tree_root, &key, &path,-1 ,1 );if (ret <0 ) {error ("failed to locate free space cache extent for block group %llu: %d" , - bg->key.objectid, ret); + bg->start, ret); goto out; }while (1 ) {
@@ -966,7 +966,7 @@ int btrfs_clear_free_space_cache(struct btrfs_fs_info *fs_info,if (ret <0 ) {error ("failed to locate free space cache extent for block group %llu: %d" , - bg->key.objectid, ret); + bg->start, ret); goto out; } node = path.nodes[0 ];
@@ -1005,14 +1005,14 @@ int btrfs_clear_free_space_cache(struct btrfs_fs_info *fs_info,if (ret <0 ) {error ("failed to locate free space cache inode %llu for block group %llu: %d" , - ino, bg->key.objectid, ret); + ino, bg->start, ret); goto out; } ret =btrfs_del_item (trans, tree_root, &path);if (ret <0 ) {error ("failed to delete free space cache inode %llu for block group %llu: %d" , - ino, bg->key.objectid, ret); + ino, bg->start, ret); } out:btrfs_release_path (&path);
kernel-shared/free-space-tree.c +39 -38
229 lines not on this page · raw message
mkfs/main.c +5 -5
@@ -695,14 +695,14 @@ static void update_chunk_allocation(struct btrfs_fs_info *fs_info,if (!bg_cache)break ;if ((bg_cache->flags & mixed_flag) == mixed_flag) - allocation->mixed += bg_cache->key.offset; + allocation->mixed += bg_cache->length;else if (bg_cache->flags &BTRFS_BLOCK_GROUP_DATA ) - allocation->data += bg_cache->key.offset; + allocation->data += bg_cache->length;else if (bg_cache->flags &BTRFS_BLOCK_GROUP_METADATA ) - allocation->metadata += bg_cache->key.offset; + allocation->metadata += bg_cache->length;else - allocation->system += bg_cache->key.offset; - search_start = bg_cache->key.objectid + bg_cache->key.offset; + allocation->system += bg_cache->length; + search_start = bg_cache->start + bg_cache->length; } }
volumes.h +1 -1
@@ -216,7 +216,7 @@ static inline int check_crossing_stripes(struct btrfs_fs_info *fs_info,*/ if (!bg_cache)return 0 ; - bg_offset = start - bg_cache->key.objectid; + bg_offset = start - bg_cache->start;return (bg_offset /BTRFS_STRIPE_LEN != (bg_offset + len -1 ) /BTRFS_STRIPE_LEN );
Signature · 1 line
2.26.2
PATCH 2/3 btrfs-progs: Remove the unused btrfs_block_group_cache::cache
In reply to Qu WenruoThere is no user of that member.
--- ctree.h | 1 - 1 file changed, 1 deletion(-)
ctree.h +0 -1
@@ -1105,7 +1105,6 @@ struct btrfs_space_info { };struct btrfs_block_group_cache { -struct cache_extent cache;struct btrfs_space_info *space_info;struct btrfs_free_space_ctl *free_space_ctl;u64 start;
Signature · 1 line
2.26.2
PATCH 3/3 btrfs-progs: Rename btrfs_block_group_cache to btrfs_block_group
In reply to Qu WenruoTo keep the same naming across kernel and btrfs-progs.
--- check/main.c | 14 +++--- check/mode-common.c | 2 +- check/mode-lowmem.c | 6 +-- cmds/rescue-chunk-recover.c | 2 +- convert/main.c | 2 +- convert/source-fs.c | 2 +- ctree.h | 17 ++++---- extent-tree.c | 76 ++++++++++++++++----------------- free-space-cache.c | 10 ++--- free-space-cache.h | 12 +++--- image/main.c | 2 +- kernel-shared/free-space-tree.c | 40 ++++++++--------- kernel-shared/free-space-tree.h | 6 +-- mkfs/main.c | 2 +- transaction.h | 2 +- volumes.h | 2 +- 16 files changed, 97 insertions(+), 100 deletions(-)
check/main.c +7 -7
@@ -4541,7 +4541,7 @@ static struct data_backref *alloc_data_backref(struct extent_record *rec,/* Check if the type of extent matches with its chunk */ static void check_extent_type (struct extent_record *rec) { -struct btrfs_block_group_cache *bg_cache; +struct btrfs_block_group *bg_cache; bg_cache =btrfs_lookup_first_block_group (global_info, rec->start);if (!bg_cache)
@@ -5443,7 +5443,7 @@ out: }static int check_cache_range (struct btrfs_root *root, -struct btrfs_block_group_cache *cache, +struct btrfs_block_group *cache,u64 offset,u64 bytes) {struct btrfs_free_space *entry;
@@ -5537,7 +5537,7 @@ static int check_cache_range(struct btrfs_root *root, }static int verify_space_cache (struct btrfs_root *root, -struct btrfs_block_group_cache *cache) +struct btrfs_block_group *cache) {struct btrfs_path path;struct extent_buffer *leaf;
@@ -5616,7 +5616,7 @@ out:static int check_space_cache (struct btrfs_root *root) { -struct btrfs_block_group_cache *cache; +struct btrfs_block_group *cache;u64 start =BTRFS_SUPER_INFO_OFFSET +BTRFS_SUPER_INFO_SIZE ;int ret;int error =0 ;
@@ -8908,7 +8908,7 @@ static int btrfs_fsck_reinit_root(struct btrfs_trans_handle *trans,static int reset_block_groups (struct btrfs_fs_info *fs_info) { -struct btrfs_block_group_cache *cache; +struct btrfs_block_group *cache;struct btrfs_path path;struct extent_buffer *leaf;struct btrfs_chunk *chunk;
@@ -9154,7 +9154,7 @@ again:*/ while (1 ) {struct btrfs_block_group_item bgi; -struct btrfs_block_group_cache *cache; +struct btrfs_block_group *cache;struct btrfs_key key; cache =btrfs_lookup_first_block_group (fs_info, start);
@@ -9806,7 +9806,7 @@ out:static int clear_free_space_cache (struct btrfs_fs_info *fs_info) {struct btrfs_trans_handle *trans; -struct btrfs_block_group_cache *bg_cache; +struct btrfs_block_group *bg_cache;u64 current =0 ;int ret =0 ;
check/mode-common.c +1 -1
@@ -582,7 +582,7 @@ int check_child_node(struct extent_buffer *parent, int slot,void reset_cached_block_groups (struct btrfs_fs_info *fs_info) { -struct btrfs_block_group_cache *cache; +struct btrfs_block_group *cache;u64 start, end;int ret;
check/mode-lowmem.c +3 -3
@@ -239,7 +239,7 @@ static int update_nodes_refs(struct btrfs_root *root, u64 bytenr,* according to @cache. */ static int modify_block_group_cache (struct btrfs_fs_info *fs_info, -struct btrfs_block_group_cache *block_group,int cache) +struct btrfs_block_group *block_group,int cache) {struct extent_io_tree *free_space_cache = &fs_info->free_space_cache;u64 start = block_group->start;
@@ -269,7 +269,7 @@ static int modify_block_groups_cache(struct btrfs_fs_info *fs_info, u64 flags,struct btrfs_root *root = fs_info->extent_root;struct btrfs_key key;struct btrfs_path path; -struct btrfs_block_group_cache *bg_cache; +struct btrfs_block_group *bg_cache;struct btrfs_block_group_item *bi;struct btrfs_block_group_item bg_item;struct extent_buffer *eb;
@@ -367,7 +367,7 @@ out:static int force_cow_in_new_chunk (struct btrfs_fs_info *fs_info,u64 *start_ret) { -struct btrfs_block_group_cache *bg; +struct btrfs_block_group *bg;u64 start;u64 nbytes;u64 alloc_profile;
cmds/rescue-chunk-recover.c +1 -1
@@ -1087,7 +1087,7 @@ err:static int block_group_free_all_extent (struct btrfs_trans_handle *trans,struct block_group_record *bg) { -struct btrfs_block_group_cache *cache; +struct btrfs_block_group *cache;struct btrfs_fs_info *info;u64 start;u64 end;
convert/main.c +1 -1
@@ -202,7 +202,7 @@ static int create_image_file_range(struct btrfs_trans_handle *trans, u32 convert_flags) {struct cache_extent *cache; -struct btrfs_block_group_cache *bg_cache; +struct btrfs_block_group *bg_cache;u64 len = *ret_len;u64 disk_bytenr;int i;
convert/source-fs.c +1 -1
@@ -90,7 +90,7 @@ int block_iterate_proc(u64 disk_block, u64 file_block,u64 reserved_boundary;int do_barrier;struct btrfs_root *root = idata->root; -struct btrfs_block_group_cache *cache; +struct btrfs_block_group *cache;u32 sectorsize = root->fs_info->sectorsize;u64 bytenr = disk_block * sectorsize;
ctree.h +8 -9
@@ -1104,7 +1104,7 @@ struct btrfs_space_info {struct list_head list; }; -struct btrfs_block_group_cache { +struct btrfs_block_group {struct btrfs_space_info *space_info;struct btrfs_free_space_ctl *free_space_ctl;u64 start;
@@ -2539,10 +2539,9 @@ int btrfs_fix_block_accounting(struct btrfs_trans_handle *trans);void btrfs_pin_extent (struct btrfs_fs_info *fs_info,u64 bytenr,u64 num_bytes);void btrfs_unpin_extent (struct btrfs_fs_info *fs_info,u64 bytenr,u64 num_bytes); -struct btrfs_block_group_cache *btrfs_lookup_block_group (struct -btrfs_fs_info *info, -u64 bytenr); -struct btrfs_block_group_cache *btrfs_lookup_first_block_group (struct +struct btrfs_block_group *btrfs_lookup_block_group (struct btrfs_fs_info *info, +u64 bytenr); +struct btrfs_block_group *btrfs_lookup_first_block_group (struct btrfs_fs_info *info,u64 bytenr); struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
@@ -2583,7 +2582,7 @@ int update_space_info(struct btrfs_fs_info *info, u64 flags, struct btrfs_space_info **space_info);int btrfs_free_block_groups (struct btrfs_fs_info *info);int btrfs_read_block_groups (struct btrfs_fs_info *info); -struct btrfs_block_group_cache * +struct btrfs_block_group *btrfs_add_block_group (struct btrfs_fs_info *fs_info,u64 bytes_used,u64 type,u64 chunk_offset,u64 size); int btrfs_make_block_group(struct btrfs_trans_handle *trans,
@@ -2601,10 +2600,10 @@ int btrfs_record_file_extent(struct btrfs_trans_handle *trans,int btrfs_free_block_group (struct btrfs_trans_handle *trans,struct btrfs_fs_info *fs_info,u64 bytenr,u64 len);void free_excluded_extents (struct btrfs_fs_info *fs_info, -struct btrfs_block_group_cache *cache); +struct btrfs_block_group *cache);int exclude_super_stripes (struct btrfs_fs_info *fs_info, -struct btrfs_block_group_cache *cache); -u64 add_new_free_space (struct btrfs_block_group_cache *block_group, +struct btrfs_block_group *cache); +u64 add_new_free_space (struct btrfs_block_group *block_group,struct btrfs_fs_info *info,u64 start,u64 end);u64 hash_extent_data_ref (u64 root_objectid,u64 owner,u64 offset);
extent-tree.c +38 -38
264 lines not on this page · raw message
free-space-cache.c +5 -5
@@ -432,7 +432,7 @@ free_cache: }int load_free_space_cache (struct btrfs_fs_info *fs_info, -struct btrfs_block_group_cache *block_group) +struct btrfs_block_group *block_group) {struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl;struct btrfs_path *path;
@@ -766,7 +766,7 @@ static void try_merge_free_space(struct btrfs_free_space_ctl *ctl, } } -void btrfs_dump_free_space (struct btrfs_block_group_cache *block_group, +void btrfs_dump_free_space (struct btrfs_block_group *block_group,u64 bytes) {struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl;
@@ -786,7 +786,7 @@ void btrfs_dump_free_space(struct btrfs_block_group_cache *block_group,printk ("%d blocks of free space at or bigger than bytes is \n" , count); } -int btrfs_init_free_space_ctl (struct btrfs_block_group_cache *block_group, +int btrfs_init_free_space_ctl (struct btrfs_block_group *block_group,int sectorsize) {struct btrfs_free_space_ctl *ctl;
@@ -817,7 +817,7 @@ void __btrfs_remove_free_space_cache(struct btrfs_free_space_ctl *ctl) } } -void btrfs_remove_free_space_cache (struct btrfs_block_group_cache *block_group) +void btrfs_remove_free_space_cache (struct btrfs_block_group *block_group) {__btrfs_remove_free_space_cache (block_group->free_space_ctl); }
@@ -896,7 +896,7 @@ next: }int btrfs_clear_free_space_cache (struct btrfs_fs_info *fs_info, -struct btrfs_block_group_cache *bg) +struct btrfs_block_group *bg) {struct btrfs_trans_handle *trans;struct btrfs_root *tree_root = fs_info->tree_root;
free-space-cache.h +5 -7
@@ -44,21 +44,19 @@ struct btrfs_free_space_ctl { };int load_free_space_cache (struct btrfs_fs_info *fs_info, -struct btrfs_block_group_cache *block_group); +struct btrfs_block_group *block_group);void __btrfs_remove_free_space_cache (struct btrfs_free_space_ctl *ctl); -void btrfs_remove_free_space_cache (struct btrfs_block_group_cache - *block_group); -void btrfs_dump_free_space (struct btrfs_block_group_cache *block_group, -u64 bytes); +void btrfs_remove_free_space_cache (struct btrfs_block_group *block_group); +void btrfs_dump_free_space (struct btrfs_block_group *block_group,u64 bytes);struct btrfs_free_space *btrfs_find_free_space (struct btrfs_free_space_ctl *ctl,u64 offset,u64 bytes); -int btrfs_init_free_space_ctl (struct btrfs_block_group_cache *block_group, +int btrfs_init_free_space_ctl (struct btrfs_block_group *block_group,int sectorsize);void unlink_free_space (struct btrfs_free_space_ctl *ctl,struct btrfs_free_space *info);int btrfs_add_free_space (struct btrfs_free_space_ctl *ctl,u64 offset,u64 bytes);int btrfs_clear_free_space_cache (struct btrfs_fs_info *fs_info, -struct btrfs_block_group_cache *bg); +struct btrfs_block_group *bg);#endif
image/main.c +1 -1
@@ -2341,7 +2341,7 @@ again:static void fixup_block_groups (struct btrfs_trans_handle *trans) {struct btrfs_fs_info *fs_info = trans->fs_info; -struct btrfs_block_group_cache *bg; +struct btrfs_block_group *bg;struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree;struct cache_extent *ce;struct map_lookup *map;
kernel-shared/free-space-tree.c +20 -20
@@ -28,7 +28,7 @@static struct btrfs_free_space_info *search_free_space_info (struct btrfs_trans_handle *trans,struct btrfs_fs_info *fs_info, -struct btrfs_block_group_cache *block_group, +struct btrfs_block_group *block_group,struct btrfs_path *path,int cow) {struct btrfs_root *root = fs_info->free_space_root;
@@ -49,7 +49,7 @@ search_free_space_info(struct btrfs_trans_handle *trans, struct btrfs_free_space_info); } -static int free_space_test_bit (struct btrfs_block_group_cache *block_group, +static int free_space_test_bit (struct btrfs_block_group *block_group,struct btrfs_path *path,u64 offset) {struct extent_buffer *leaf;
@@ -100,7 +100,7 @@ static int btrfs_search_prev_slot(struct btrfs_trans_handle *trans, }static int add_new_free_space_info (struct btrfs_trans_handle *trans, -struct btrfs_block_group_cache *block_group, +struct btrfs_block_group *block_group,struct btrfs_path *path) {struct btrfs_root *root = trans->fs_info->free_space_root;
@@ -175,7 +175,7 @@ static void le_bitmap_set(unsigned long *map, unsigned int start, int len) }static int convert_free_space_to_bitmaps (struct btrfs_trans_handle *trans, -struct btrfs_block_group_cache *block_group, +struct btrfs_block_group *block_group,struct btrfs_path *path) {struct btrfs_fs_info *fs_info = trans->fs_info;
@@ -314,7 +314,7 @@ out: }static int convert_free_space_to_extents (struct btrfs_trans_handle *trans, -struct btrfs_block_group_cache *block_group, +struct btrfs_block_group *block_group,struct btrfs_path *path) {struct btrfs_fs_info *fs_info = trans->fs_info;
@@ -447,7 +447,7 @@ out: }static int update_free_space_extent_count (struct btrfs_trans_handle *trans, -struct btrfs_block_group_cache *block_group, +struct btrfs_block_group *block_group,struct btrfs_path *path,int new_extents) {
@@ -487,7 +487,7 @@ out: } -static void free_space_set_bits (struct btrfs_block_group_cache *block_group, +static void free_space_set_bits (struct btrfs_block_group *block_group,struct btrfs_path *path,u64 *start,u64 *size,int bit) {
@@ -554,7 +554,7 @@ static int free_space_next_bitmap(struct btrfs_trans_handle *trans,* the bitmap. */ static int modify_free_space_bitmap (struct btrfs_trans_handle *trans, -struct btrfs_block_group_cache *block_group, +struct btrfs_block_group *block_group,struct btrfs_path *path,u64 start,u64 size,int remove) {
@@ -667,7 +667,7 @@ out: }static int remove_free_space_extent (struct btrfs_trans_handle *trans, -struct btrfs_block_group_cache *block_group, +struct btrfs_block_group *block_group,struct btrfs_path *path,u64 start,u64 size) {
@@ -753,7 +753,7 @@ out: }static int __remove_from_free_space_tree (struct btrfs_trans_handle *trans, -struct btrfs_block_group_cache *block_group, +struct btrfs_block_group *block_group,struct btrfs_path *path,u64 start,u64 size) {struct btrfs_free_space_info *info;
@@ -777,7 +777,7 @@ static int __remove_from_free_space_tree(struct btrfs_trans_handle *trans,int remove_from_free_space_tree (struct btrfs_trans_handle *trans,u64 start,u64 size) { -struct btrfs_block_group_cache *block_group; +struct btrfs_block_group *block_group;struct btrfs_path *path;int ret;
@@ -807,7 +807,7 @@ out: }static int add_free_space_extent (struct btrfs_trans_handle *trans, -struct btrfs_block_group_cache *block_group, +struct btrfs_block_group *block_group,struct btrfs_path *path,u64 start,u64 size) {
@@ -933,7 +933,7 @@ out: }static int __add_to_free_space_tree (struct btrfs_trans_handle *trans, -struct btrfs_block_group_cache *block_group, +struct btrfs_block_group *block_group,struct btrfs_path *path,u64 start,u64 size) {struct btrfs_fs_info *fs_info = trans->fs_info;
@@ -958,7 +958,7 @@ static int __add_to_free_space_tree(struct btrfs_trans_handle *trans,int add_to_free_space_tree (struct btrfs_trans_handle *trans,u64 start,u64 size) { -struct btrfs_block_group_cache *block_group; +struct btrfs_block_group *block_group;struct btrfs_path *path;int ret;
@@ -987,7 +987,7 @@ out: }int populate_free_space_tree (struct btrfs_trans_handle *trans, -struct btrfs_block_group_cache *block_group) +struct btrfs_block_group *block_group) {struct btrfs_root *extent_root = trans->fs_info->extent_root;struct btrfs_path *path, *path2;
@@ -1074,7 +1074,7 @@ out: }int remove_block_group_free_space (struct btrfs_trans_handle *trans, -struct btrfs_block_group_cache *block_group) +struct btrfs_block_group *block_group) {struct btrfs_root *root = trans->fs_info->free_space_root;struct btrfs_path *path;
@@ -1227,7 +1227,7 @@ abort: }static int load_free_space_bitmaps (struct btrfs_fs_info *fs_info, -struct btrfs_block_group_cache *block_group, +struct btrfs_block_group *block_group,struct btrfs_path *path,u32 expected_extent_count,int *errors)
@@ -1307,7 +1307,7 @@ out: }static int load_free_space_extents (struct btrfs_fs_info *fs_info, -struct btrfs_block_group_cache *block_group, +struct btrfs_block_group *block_group,struct btrfs_path *path,u32 expected_extent_count,int *errors)
@@ -1418,7 +1418,7 @@ int btrfs_create_free_space_tree(struct btrfs_fs_info *fs_info)struct btrfs_trans_handle *trans;struct btrfs_root *tree_root = fs_info->tree_root;struct btrfs_root *free_space_root; -struct btrfs_block_group_cache *block_group; +struct btrfs_block_group *block_group;u64 start =BTRFS_SUPER_INFO_OFFSET +BTRFS_SUPER_INFO_SIZE ;int ret;
@@ -1459,7 +1459,7 @@ abort: }int load_free_space_tree (struct btrfs_fs_info *fs_info, -struct btrfs_block_group_cache *block_group) +struct btrfs_block_group *block_group) {struct btrfs_free_space_info *info;struct btrfs_path *path;
kernel-shared/free-space-tree.h +3 -3
@@ -24,11 +24,11 @@int btrfs_clear_free_space_tree (struct btrfs_fs_info *fs_info);int load_free_space_tree (struct btrfs_fs_info *fs_info, -struct btrfs_block_group_cache *block_group); +struct btrfs_block_group *block_group);int populate_free_space_tree (struct btrfs_trans_handle *trans, -struct btrfs_block_group_cache *block_group); +struct btrfs_block_group *block_group);int remove_block_group_free_space (struct btrfs_trans_handle *trans, -struct btrfs_block_group_cache *block_group); +struct btrfs_block_group *block_group);int add_to_free_space_tree (struct btrfs_trans_handle *trans,u64 start,u64 size); int remove_from_free_space_tree(struct btrfs_trans_handle *trans, u64 start,
mkfs/main.c +1 -1
@@ -681,7 +681,7 @@ out:static void update_chunk_allocation (struct btrfs_fs_info *fs_info,struct mkfs_allocation *allocation) { -struct btrfs_block_group_cache *bg_cache; +struct btrfs_block_group *bg_cache;const u64 mixed_flag =BTRFS_BLOCK_GROUP_DATA |BTRFS_BLOCK_GROUP_METADATA ;u64 search_start =0 ;
transaction.h +1 -1
@@ -34,7 +34,7 @@ struct btrfs_trans_handle {u64 delayed_ref_updates;unsigned long blocks_reserved;unsigned long blocks_used; -struct btrfs_block_group_cache *block_group; +struct btrfs_block_group *block_group;struct btrfs_delayed_ref_root delayed_refs;struct list_head dirty_bgs; };
volumes.h +1 -1
@@ -206,7 +206,7 @@ static inline enum btrfs_raid_types btrfs_bg_flags_to_raid_index(u64 flags)static inline int check_crossing_stripes (struct btrfs_fs_info *fs_info,u64 start,u64 len) { -struct btrfs_block_group_cache *bg_cache; +struct btrfs_block_group *bg_cache;u64 bg_offset; bg_cache =btrfs_lookup_block_group (fs_info, start);
Signature · 1 line
2.26.2