diff options
author | Josef Bacik <josef@toxicpanda.com> | 2019-06-18 16:09:18 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-07-02 06:30:52 -0400 |
commit | d44b72aa12d0a74b67ffabdcab2f64653282dccd (patch) | |
tree | e056841094e9e350bd2a7e8267d809137c969aad | |
parent | fc471cb0c8f0016ac7ec5cc3e329c5e23d83d593 (diff) |
btrfs: export space_info_add_*_bytes
Prep work for consolidating all of the space_info code into one file.
We need to export these so multiple files can use them.
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/extent-tree.c | 40 | ||||
-rw-r--r-- | fs/btrfs/space-info.h | 7 |
2 files changed, 25 insertions, 22 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 16e61acc0179..34d08fc8ba76 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -75,12 +75,6 @@ static void dump_space_info(struct btrfs_fs_info *fs_info, | |||
75 | int dump_block_groups); | 75 | int dump_block_groups); |
76 | static int block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv, | 76 | static int block_rsv_use_bytes(struct btrfs_block_rsv *block_rsv, |
77 | u64 num_bytes); | 77 | u64 num_bytes); |
78 | static void space_info_add_new_bytes(struct btrfs_fs_info *fs_info, | ||
79 | struct btrfs_space_info *space_info, | ||
80 | u64 num_bytes); | ||
81 | static void space_info_add_old_bytes(struct btrfs_fs_info *fs_info, | ||
82 | struct btrfs_space_info *space_info, | ||
83 | u64 num_bytes); | ||
84 | 78 | ||
85 | static noinline int | 79 | static noinline int |
86 | block_group_cache_done(struct btrfs_block_group_cache *cache) | 80 | block_group_cache_done(struct btrfs_block_group_cache *cache) |
@@ -3908,8 +3902,8 @@ static void update_space_info(struct btrfs_fs_info *info, u64 flags, | |||
3908 | found->bytes_readonly += bytes_readonly; | 3902 | found->bytes_readonly += bytes_readonly; |
3909 | if (total_bytes > 0) | 3903 | if (total_bytes > 0) |
3910 | found->full = 0; | 3904 | found->full = 0; |
3911 | space_info_add_new_bytes(info, found, total_bytes - | 3905 | btrfs_space_info_add_new_bytes(info, found, total_bytes - |
3912 | bytes_used - bytes_readonly); | 3906 | bytes_used - bytes_readonly); |
3913 | spin_unlock(&found->lock); | 3907 | spin_unlock(&found->lock); |
3914 | *space_info = found; | 3908 | *space_info = found; |
3915 | } | 3909 | } |
@@ -5108,7 +5102,8 @@ static int wait_reserve_ticket(struct btrfs_fs_info *fs_info, | |||
5108 | spin_unlock(&space_info->lock); | 5102 | spin_unlock(&space_info->lock); |
5109 | 5103 | ||
5110 | if (reclaim_bytes) | 5104 | if (reclaim_bytes) |
5111 | space_info_add_old_bytes(fs_info, space_info, reclaim_bytes); | 5105 | btrfs_space_info_add_old_bytes(fs_info, space_info, |
5106 | reclaim_bytes); | ||
5112 | return ret; | 5107 | return ret; |
5113 | } | 5108 | } |
5114 | 5109 | ||
@@ -5225,7 +5220,8 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info, | |||
5225 | spin_unlock(&space_info->lock); | 5220 | spin_unlock(&space_info->lock); |
5226 | 5221 | ||
5227 | if (reclaim_bytes) | 5222 | if (reclaim_bytes) |
5228 | space_info_add_old_bytes(fs_info, space_info, reclaim_bytes); | 5223 | btrfs_space_info_add_old_bytes(fs_info, space_info, |
5224 | reclaim_bytes); | ||
5229 | ASSERT(list_empty(&ticket.list)); | 5225 | ASSERT(list_empty(&ticket.list)); |
5230 | return ret; | 5226 | return ret; |
5231 | } | 5227 | } |
@@ -5391,8 +5387,8 @@ void btrfs_migrate_to_delayed_refs_rsv(struct btrfs_fs_info *fs_info, | |||
5391 | trace_btrfs_space_reservation(fs_info, "delayed_refs_rsv", | 5387 | trace_btrfs_space_reservation(fs_info, "delayed_refs_rsv", |
5392 | 0, num_bytes, 1); | 5388 | 0, num_bytes, 1); |
5393 | if (to_free) | 5389 | if (to_free) |
5394 | space_info_add_old_bytes(fs_info, delayed_refs_rsv->space_info, | 5390 | btrfs_space_info_add_old_bytes(fs_info, |
5395 | to_free); | 5391 | delayed_refs_rsv->space_info, to_free); |
5396 | } | 5392 | } |
5397 | 5393 | ||
5398 | /** | 5394 | /** |
@@ -5435,9 +5431,9 @@ int btrfs_delayed_refs_rsv_refill(struct btrfs_fs_info *fs_info, | |||
5435 | * This is for space we already have accounted in space_info->bytes_may_use, so | 5431 | * This is for space we already have accounted in space_info->bytes_may_use, so |
5436 | * basically when we're returning space from block_rsv's. | 5432 | * basically when we're returning space from block_rsv's. |
5437 | */ | 5433 | */ |
5438 | static void space_info_add_old_bytes(struct btrfs_fs_info *fs_info, | 5434 | void btrfs_space_info_add_old_bytes(struct btrfs_fs_info *fs_info, |
5439 | struct btrfs_space_info *space_info, | 5435 | struct btrfs_space_info *space_info, |
5440 | u64 num_bytes) | 5436 | u64 num_bytes) |
5441 | { | 5437 | { |
5442 | struct reserve_ticket *ticket; | 5438 | struct reserve_ticket *ticket; |
5443 | struct list_head *head; | 5439 | struct list_head *head; |
@@ -5495,9 +5491,9 @@ again: | |||
5495 | * space_info->bytes_may_use yet. So if we allocate a chunk or unpin an extent | 5491 | * space_info->bytes_may_use yet. So if we allocate a chunk or unpin an extent |
5496 | * we use this helper. | 5492 | * we use this helper. |
5497 | */ | 5493 | */ |
5498 | static void space_info_add_new_bytes(struct btrfs_fs_info *fs_info, | 5494 | void btrfs_space_info_add_new_bytes(struct btrfs_fs_info *fs_info, |
5499 | struct btrfs_space_info *space_info, | 5495 | struct btrfs_space_info *space_info, |
5500 | u64 num_bytes) | 5496 | u64 num_bytes) |
5501 | { | 5497 | { |
5502 | struct reserve_ticket *ticket; | 5498 | struct reserve_ticket *ticket; |
5503 | struct list_head *head = &space_info->priority_tickets; | 5499 | struct list_head *head = &space_info->priority_tickets; |
@@ -5581,8 +5577,8 @@ static u64 block_rsv_release_bytes(struct btrfs_fs_info *fs_info, | |||
5581 | spin_unlock(&dest->lock); | 5577 | spin_unlock(&dest->lock); |
5582 | } | 5578 | } |
5583 | if (num_bytes) | 5579 | if (num_bytes) |
5584 | space_info_add_old_bytes(fs_info, space_info, | 5580 | btrfs_space_info_add_old_bytes(fs_info, space_info, |
5585 | num_bytes); | 5581 | num_bytes); |
5586 | } | 5582 | } |
5587 | if (qgroup_to_release_ret) | 5583 | if (qgroup_to_release_ret) |
5588 | *qgroup_to_release_ret = qgroup_to_release; | 5584 | *qgroup_to_release_ret = qgroup_to_release; |
@@ -6758,8 +6754,8 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info, | |||
6758 | spin_unlock(&global_rsv->lock); | 6754 | spin_unlock(&global_rsv->lock); |
6759 | /* Add to any tickets we may have */ | 6755 | /* Add to any tickets we may have */ |
6760 | if (len) | 6756 | if (len) |
6761 | space_info_add_new_bytes(fs_info, space_info, | 6757 | btrfs_space_info_add_new_bytes(fs_info, |
6762 | len); | 6758 | space_info, len); |
6763 | } | 6759 | } |
6764 | spin_unlock(&space_info->lock); | 6760 | spin_unlock(&space_info->lock); |
6765 | } | 6761 | } |
diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h index 5f96333c3450..46f15b8c9ffc 100644 --- a/fs/btrfs/space-info.h +++ b/fs/btrfs/space-info.h | |||
@@ -75,4 +75,11 @@ static inline bool btrfs_mixed_space_info(struct btrfs_space_info *space_info) | |||
75 | (space_info->flags & BTRFS_BLOCK_GROUP_DATA)); | 75 | (space_info->flags & BTRFS_BLOCK_GROUP_DATA)); |
76 | } | 76 | } |
77 | 77 | ||
78 | void btrfs_space_info_add_new_bytes(struct btrfs_fs_info *fs_info, | ||
79 | struct btrfs_space_info *space_info, | ||
80 | u64 num_bytes); | ||
81 | void btrfs_space_info_add_old_bytes(struct btrfs_fs_info *fs_info, | ||
82 | struct btrfs_space_info *space_info, | ||
83 | u64 num_bytes); | ||
84 | |||
78 | #endif /* BTRFS_SPACE_INFO_H */ | 85 | #endif /* BTRFS_SPACE_INFO_H */ |