mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
btrfs: make buffer_radix take sector size units
For subpage sector size support, one page can contain multiple tree blocks. The entries cannot be based on page size and index must be derived from the sectorsize. No change for page size == sector size. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
0d01e247a0
commit
478ef8868f
@ -912,6 +912,7 @@ struct btrfs_fs_info {
|
||||
|
||||
/* Extent buffer radix tree */
|
||||
spinlock_t buffer_lock;
|
||||
/* Entries are eb->start / sectorsize */
|
||||
struct radix_tree_root buffer_radix;
|
||||
|
||||
/* next backup root to be overwritten */
|
||||
|
@ -5107,7 +5107,7 @@ struct extent_buffer *find_extent_buffer(struct btrfs_fs_info *fs_info,
|
||||
|
||||
rcu_read_lock();
|
||||
eb = radix_tree_lookup(&fs_info->buffer_radix,
|
||||
start >> PAGE_SHIFT);
|
||||
start >> fs_info->sectorsize_bits);
|
||||
if (eb && atomic_inc_not_zero(&eb->refs)) {
|
||||
rcu_read_unlock();
|
||||
/*
|
||||
@ -5159,7 +5159,7 @@ again:
|
||||
}
|
||||
spin_lock(&fs_info->buffer_lock);
|
||||
ret = radix_tree_insert(&fs_info->buffer_radix,
|
||||
start >> PAGE_SHIFT, eb);
|
||||
start >> fs_info->sectorsize_bits, eb);
|
||||
spin_unlock(&fs_info->buffer_lock);
|
||||
radix_tree_preload_end();
|
||||
if (ret == -EEXIST) {
|
||||
@ -5267,7 +5267,7 @@ again:
|
||||
|
||||
spin_lock(&fs_info->buffer_lock);
|
||||
ret = radix_tree_insert(&fs_info->buffer_radix,
|
||||
start >> PAGE_SHIFT, eb);
|
||||
start >> fs_info->sectorsize_bits, eb);
|
||||
spin_unlock(&fs_info->buffer_lock);
|
||||
radix_tree_preload_end();
|
||||
if (ret == -EEXIST) {
|
||||
@ -5323,7 +5323,7 @@ static int release_extent_buffer(struct extent_buffer *eb)
|
||||
|
||||
spin_lock(&fs_info->buffer_lock);
|
||||
radix_tree_delete(&fs_info->buffer_radix,
|
||||
eb->start >> PAGE_SHIFT);
|
||||
eb->start >> fs_info->sectorsize_bits);
|
||||
spin_unlock(&fs_info->buffer_lock);
|
||||
} else {
|
||||
spin_unlock(&eb->refs_lock);
|
||||
|
Loading…
Reference in New Issue
Block a user