btrfs: qgroup: make btrfs_record_squota_delta() return void

The function never returns any error, so simplify it and its callers by
making it return void.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Filipe Manana 2026-10-05 13:03:53 +01:00 committed by David Sterba
parent 784cd5a834
commit c97b139c6c
3 changed files with 10 additions and 18 deletions

View File

@ -1658,7 +1658,7 @@ static int run_delayed_data_ref(struct btrfs_trans_handle *trans,
href->owning_root);
free_head_ref_squota_rsv(trans->fs_info, href);
if (!ret)
ret = btrfs_record_squota_delta(trans->fs_info, &delta);
btrfs_record_squota_delta(trans->fs_info, &delta);
} else if (node->action == BTRFS_ADD_DELAYED_REF) {
ret = __btrfs_inc_extent_ref(trans, node, extent_op);
} else if (node->action == BTRFS_DROP_DELAYED_REF) {
@ -3180,11 +3180,7 @@ static int do_free_extent_accounting(struct btrfs_trans_handle *trans,
}
}
ret = btrfs_record_squota_delta(trans->fs_info, delta);
if (unlikely(ret)) {
btrfs_abort_transaction(trans, ret);
return ret;
}
btrfs_record_squota_delta(trans->fs_info, delta);
/* If remapped, FST has already been taken care of in remove_range_from_remap_tree(). */
if (!remapped) {
@ -5228,7 +5224,7 @@ int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans,
if (ret)
btrfs_pin_extent(trans, ins->objectid, ins->offset);
else
ret = btrfs_record_squota_delta(fs_info, &delta);
btrfs_record_squota_delta(fs_info, &delta);
btrfs_put_block_group(block_group);
return ret;
}

View File

@ -4966,10 +4966,9 @@ void btrfs_qgroup_destroy_extent_records(struct btrfs_transaction *trans)
xa_destroy(&trans->delayed_refs.dirty_extents);
}
int btrfs_record_squota_delta(struct btrfs_fs_info *fs_info,
const struct btrfs_squota_delta *delta)
void btrfs_record_squota_delta(struct btrfs_fs_info *fs_info,
const struct btrfs_squota_delta *delta)
{
int ret;
struct btrfs_qgroup *qgroup;
struct btrfs_qgroup *qg;
LIST_HEAD(qgroup_list);
@ -4979,24 +4978,22 @@ int btrfs_record_squota_delta(struct btrfs_fs_info *fs_info,
if (btrfs_qgroup_mode(fs_info) != BTRFS_QGROUP_MODE_SIMPLE &&
!test_bit(BTRFS_FS_SQUOTA_ENABLING, &fs_info->flags))
return 0;
return;
if (!btrfs_is_fstree(root))
return 0;
return;
/* If the extent predates enabling quotas, don't count it. */
if (delta->generation < fs_info->qgroup_enable_gen)
return 0;
return;
spin_lock(&fs_info->qgroup_lock);
qgroup = find_qgroup_rb(fs_info, root);
if (WARN_ON_ONCE(!qgroup)) {
btrfs_warn(fs_info, "squota failed to find qgroup for root %llu", root);
ret = 0;
goto out;
}
ret = 0;
qgroup_iterator_add(&qgroup_list, qgroup);
list_for_each_entry(qg, &qgroup_list, iterator) {
struct btrfs_qgroup_list *glist;
@ -5022,5 +5019,4 @@ int btrfs_record_squota_delta(struct btrfs_fs_info *fs_info,
out:
spin_unlock(&fs_info->qgroup_lock);
return ret;
}

View File

@ -427,7 +427,7 @@ int btrfs_qgroup_trace_subtree_after_cow(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct extent_buffer *eb);
void btrfs_qgroup_destroy_extent_records(struct btrfs_transaction *trans);
bool btrfs_check_quota_leak(const struct btrfs_fs_info *fs_info);
int btrfs_record_squota_delta(struct btrfs_fs_info *fs_info,
const struct btrfs_squota_delta *delta);
void btrfs_record_squota_delta(struct btrfs_fs_info *fs_info,
const struct btrfs_squota_delta *delta);
#endif