Skip to content

Commit 30704a0

Browse files
naotakdave
authored andcommitted
btrfs: drop unused argument of calcu_metadata_size()
calcu_metadata_size() has a "reserve" argument, but the only caller always set it to "1". The other usage (reserve = 0) is dropped by a commit 0647bf5 ("Btrfs: improve forever loop when doing balance relocation"), which is more than 10 years ago. Drop the argument and simplify the code. Reviewed-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 33a44f3 commit 30704a0

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

fs/btrfs/relocation.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,9 +2280,8 @@ struct btrfs_root *select_one_root(struct btrfs_backref_node *node)
22802280
return fs_root;
22812281
}
22822282

2283-
static noinline_for_stack
2284-
u64 calcu_metadata_size(struct reloc_control *rc,
2285-
struct btrfs_backref_node *node, int reserve)
2283+
static noinline_for_stack u64 calcu_metadata_size(struct reloc_control *rc,
2284+
struct btrfs_backref_node *node)
22862285
{
22872286
struct btrfs_fs_info *fs_info = rc->extent_root->fs_info;
22882287
struct btrfs_backref_node *next = node;
@@ -2291,12 +2290,12 @@ u64 calcu_metadata_size(struct reloc_control *rc,
22912290
u64 num_bytes = 0;
22922291
int index = 0;
22932292

2294-
BUG_ON(reserve && node->processed);
2293+
BUG_ON(node->processed);
22952294

22962295
while (next) {
22972296
cond_resched();
22982297
while (1) {
2299-
if (next->processed && (reserve || next != node))
2298+
if (next->processed)
23002299
break;
23012300

23022301
num_bytes += fs_info->nodesize;
@@ -2324,7 +2323,7 @@ static int reserve_metadata_space(struct btrfs_trans_handle *trans,
23242323
int ret;
23252324
u64 tmp;
23262325

2327-
num_bytes = calcu_metadata_size(rc, node, 1) * 2;
2326+
num_bytes = calcu_metadata_size(rc, node) * 2;
23282327

23292328
trans->block_rsv = rc->block_rsv;
23302329
rc->reserved_bytes += num_bytes;

0 commit comments

Comments
 (0)