Skip to content
Commit 3cce39a8 authored by Junchao Sun's avatar Junchao Sun Committed by David Sterba
Browse files

btrfs: qgroup: use xarray to track dirty extents in transaction



Use xarray to track dirty extents to reduce the size of the struct
btrfs_qgroup_extent_record from 64 bytes to 40 bytes.  The xarray is
more cache line friendly, it also reduces the complexity of insertion
and search code compared to rb tree.

Another change introduced is about error handling.  Before this patch,
the result of btrfs_qgroup_trace_extent_nolock() is always a success. In
this patch, because of this function calls the function xa_store() which
has the possibility to fail, so mark qgroup as inconsistent if error
happened and then free preallocated memory. Also we preallocate memory
before spin_lock(), if memory preallcation failed, error handling is the
same the existing code.

Suggested-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarJunchao Sun <sunjunchao2870@gmail.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 14ed830d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment