Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4457c1c7 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba
Browse files

btrfs: Remove fs_info argument from add_new_free_space



This function also takes a btrfs_block_group_cache which contains a
referene to the fs_info. So use that and remove the extra argument.

Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 66afee18
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -2832,7 +2832,7 @@ void btrfs_wait_for_snapshot_creation(struct btrfs_root *root);
void check_system_chunk(struct btrfs_trans_handle *trans,
void check_system_chunk(struct btrfs_trans_handle *trans,
			struct btrfs_fs_info *fs_info, const u64 type);
			struct btrfs_fs_info *fs_info, const u64 type);
u64 add_new_free_space(struct btrfs_block_group_cache *block_group,
u64 add_new_free_space(struct btrfs_block_group_cache *block_group,
		       struct btrfs_fs_info *info, u64 start, u64 end);
		       u64 start, u64 end);


/* ctree.c */
/* ctree.c */
int btrfs_bin_search(struct extent_buffer *eb, const struct btrfs_key *key,
int btrfs_bin_search(struct extent_buffer *eb, const struct btrfs_key *key,
+6 −7
Original line number Original line Diff line number Diff line
@@ -343,8 +343,9 @@ static void fragment_free_space(struct btrfs_block_group_cache *block_group)
 * since their free space will be released as soon as the transaction commits.
 * since their free space will be released as soon as the transaction commits.
 */
 */
u64 add_new_free_space(struct btrfs_block_group_cache *block_group,
u64 add_new_free_space(struct btrfs_block_group_cache *block_group,
		       struct btrfs_fs_info *info, u64 start, u64 end)
		       u64 start, u64 end)
{
{
	struct btrfs_fs_info *info = block_group->fs_info;
	u64 extent_start, extent_end, size, total_added = 0;
	u64 extent_start, extent_end, size, total_added = 0;
	int ret;
	int ret;


@@ -489,8 +490,7 @@ static int load_extent_tree_free(struct btrfs_caching_control *caching_ctl)


		if (key.type == BTRFS_EXTENT_ITEM_KEY ||
		if (key.type == BTRFS_EXTENT_ITEM_KEY ||
		    key.type == BTRFS_METADATA_ITEM_KEY) {
		    key.type == BTRFS_METADATA_ITEM_KEY) {
			total_found += add_new_free_space(block_group,
			total_found += add_new_free_space(block_group, last,
							  fs_info, last,
							  key.objectid);
							  key.objectid);
			if (key.type == BTRFS_METADATA_ITEM_KEY)
			if (key.type == BTRFS_METADATA_ITEM_KEY)
				last = key.objectid +
				last = key.objectid +
@@ -508,7 +508,7 @@ static int load_extent_tree_free(struct btrfs_caching_control *caching_ctl)
	}
	}
	ret = 0;
	ret = 0;


	total_found += add_new_free_space(block_group, fs_info, last,
	total_found += add_new_free_space(block_group, last,
					  block_group->key.objectid +
					  block_group->key.objectid +
					  block_group->key.offset);
					  block_group->key.offset);
	caching_ctl->progress = (u64)-1;
	caching_ctl->progress = (u64)-1;
@@ -10162,8 +10162,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info)
		} else if (btrfs_block_group_used(&cache->item) == 0) {
		} else if (btrfs_block_group_used(&cache->item) == 0) {
			cache->last_byte_to_unpin = (u64)-1;
			cache->last_byte_to_unpin = (u64)-1;
			cache->cached = BTRFS_CACHE_FINISHED;
			cache->cached = BTRFS_CACHE_FINISHED;
			add_new_free_space(cache, info,
			add_new_free_space(cache, found_key.objectid,
					   found_key.objectid,
					   found_key.objectid +
					   found_key.objectid +
					   found_key.offset);
					   found_key.offset);
			free_excluded_extents(info, cache);
			free_excluded_extents(info, cache);
@@ -10300,7 +10299,7 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans,
		return ret;
		return ret;
	}
	}


	add_new_free_space(cache, fs_info, chunk_offset, chunk_offset + size);
	add_new_free_space(cache, chunk_offset, chunk_offset + size);


	free_excluded_extents(fs_info, cache);
	free_excluded_extents(fs_info, cache);


+3 −5
Original line number Original line Diff line number Diff line
@@ -1438,7 +1438,6 @@ static int load_free_space_bitmaps(struct btrfs_caching_control *caching_ctl,
				extent_start = offset;
				extent_start = offset;
			} else if (prev_bit == 1 && bit == 0) {
			} else if (prev_bit == 1 && bit == 0) {
				total_found += add_new_free_space(block_group,
				total_found += add_new_free_space(block_group,
								  fs_info,
								  extent_start,
								  extent_start,
								  offset);
								  offset);
				if (total_found > CACHING_CTL_WAKE_UP) {
				if (total_found > CACHING_CTL_WAKE_UP) {
@@ -1452,8 +1451,8 @@ static int load_free_space_bitmaps(struct btrfs_caching_control *caching_ctl,
		}
		}
	}
	}
	if (prev_bit == 1) {
	if (prev_bit == 1) {
		total_found += add_new_free_space(block_group, fs_info,
		total_found += add_new_free_space(block_group, extent_start,
						  extent_start, end);
						  end);
		extent_count++;
		extent_count++;
	}
	}


@@ -1510,8 +1509,7 @@ static int load_free_space_extents(struct btrfs_caching_control *caching_ctl,


		caching_ctl->progress = key.objectid;
		caching_ctl->progress = key.objectid;


		total_found += add_new_free_space(block_group, fs_info,
		total_found += add_new_free_space(block_group, key.objectid,
						  key.objectid,
						  key.objectid + key.offset);
						  key.objectid + key.offset);
		if (total_found > CACHING_CTL_WAKE_UP) {
		if (total_found > CACHING_CTL_WAKE_UP) {
			total_found = 0;
			total_found = 0;