diff options
author | Filipe Manana <fdmanana@suse.com> | 2024-09-24 17:43:56 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2024-11-11 14:34:13 +0100 |
commit | db58e152a2bef43fa928fb714ef9e708dd2f8835 (patch) | |
tree | f7d577a4921ad72314cf01de8b523a71aa194e88 | |
parent | c5e268022465c6a6fa8dac88e6b6fd17e2386b35 (diff) | |
download | lwn-db58e152a2bef43fa928fb714ef9e708dd2f8835.tar.gz lwn-db58e152a2bef43fa928fb714ef9e708dd2f8835.zip |
btrfs: always use delayed_refs local variable at btrfs_qgroup_trace_extent()
Instead of dereferencing the delayed refs from the transaction multiple
times, store it early in the local variable and then always use the
variable.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/qgroup.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 316a12f8b51d..f7b05c7ee428 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -2140,7 +2140,7 @@ int btrfs_qgroup_trace_extent(struct btrfs_trans_handle *trans, u64 bytenr, { struct btrfs_fs_info *fs_info = trans->fs_info; struct btrfs_qgroup_extent_record *record; - struct btrfs_delayed_ref_root *delayed_refs; + struct btrfs_delayed_ref_root *delayed_refs = &trans->transaction->delayed_refs; const unsigned long index = (bytenr >> fs_info->sectorsize_bits); int ret; @@ -2150,12 +2150,11 @@ int btrfs_qgroup_trace_extent(struct btrfs_trans_handle *trans, u64 bytenr, if (!record) return -ENOMEM; - if (xa_reserve(&trans->transaction->delayed_refs.dirty_extents, index, GFP_NOFS)) { + if (xa_reserve(&delayed_refs->dirty_extents, index, GFP_NOFS)) { kfree(record); return -ENOMEM; } - delayed_refs = &trans->transaction->delayed_refs; record->num_bytes = num_bytes; record->old_roots = NULL; |