mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-11 16:29:42 +00:00
btrfs-progs: remove extent_buffer::tree member
This member can be fetched from eb::fs_info, and no caller really depends on that member to determine if an eb is dummy. We have eb::flags to determine that. Kernel doesn't have such member either. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
b8143d0cda
commit
91a925a01a
@ -371,8 +371,8 @@ struct extent_buffer* read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
|
||||
ret = read_whole_eb(fs_info, eb, mirror_num);
|
||||
if (ret == 0 && csum_tree_block(fs_info, eb, 1) == 0 &&
|
||||
check_tree_block(fs_info, eb) == 0 &&
|
||||
verify_parent_transid(eb->tree, eb, parent_transid, ignore)
|
||||
== 0) {
|
||||
verify_parent_transid(&fs_info->extent_cache, eb,
|
||||
parent_transid, ignore) == 0) {
|
||||
if (eb->flags & EXTENT_BAD_TRANSID &&
|
||||
list_empty(&eb->recow)) {
|
||||
list_add_tail(&eb->recow,
|
||||
@ -1950,7 +1950,8 @@ int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid)
|
||||
if (!ret)
|
||||
return ret;
|
||||
|
||||
ret = verify_parent_transid(buf->tree, buf, parent_transid, 1);
|
||||
ret = verify_parent_transid(&buf->fs_info->extent_cache, buf,
|
||||
parent_transid, 1);
|
||||
return !ret;
|
||||
}
|
||||
|
||||
|
14
extent_io.c
14
extent_io.c
@ -619,7 +619,6 @@ static struct extent_buffer *__alloc_extent_buffer(struct btrfs_fs_info *info,
|
||||
eb->cache_node.start = bytenr;
|
||||
eb->cache_node.size = blocksize;
|
||||
eb->fs_info = info;
|
||||
eb->tree = &info->extent_cache;
|
||||
INIT_LIST_HEAD(&eb->recow);
|
||||
INIT_LIST_HEAD(&eb->lru);
|
||||
memset_extent_buffer(eb, 0, 0, blocksize);
|
||||
@ -634,8 +633,6 @@ struct extent_buffer *btrfs_clone_extent_buffer(struct extent_buffer *src)
|
||||
new = __alloc_extent_buffer(src->fs_info, src->start, src->len);
|
||||
if (!new)
|
||||
return NULL;
|
||||
/* cloned eb is not linked into fs_info->extent_cache */
|
||||
new->tree = NULL;
|
||||
|
||||
copy_extent_buffer(new, src, 0, 0, src->len);
|
||||
new->flags |= EXTENT_BUFFER_DUMMY;
|
||||
@ -645,13 +642,13 @@ struct extent_buffer *btrfs_clone_extent_buffer(struct extent_buffer *src)
|
||||
|
||||
static void free_extent_buffer_final(struct extent_buffer *eb)
|
||||
{
|
||||
struct extent_io_tree *tree = eb->tree;
|
||||
|
||||
BUG_ON(eb->refs);
|
||||
BUG_ON(tree && tree->cache_size < eb->len);
|
||||
list_del_init(&eb->lru);
|
||||
if (!(eb->flags & EXTENT_BUFFER_DUMMY)) {
|
||||
struct extent_io_tree *tree = &eb->fs_info->extent_cache;
|
||||
|
||||
remove_cache_extent(&tree->cache, &eb->cache_node);
|
||||
BUG_ON(tree->cache_size < eb->len);
|
||||
tree->cache_size -= eb->len;
|
||||
}
|
||||
free(eb);
|
||||
@ -786,7 +783,6 @@ struct extent_buffer *alloc_dummy_extent_buffer(struct btrfs_fs_info *fs_info,
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->tree = NULL;
|
||||
ret->flags |= EXTENT_BUFFER_DUMMY;
|
||||
|
||||
return ret;
|
||||
@ -970,7 +966,7 @@ out:
|
||||
|
||||
int set_extent_buffer_dirty(struct extent_buffer *eb)
|
||||
{
|
||||
struct extent_io_tree *tree = eb->tree;
|
||||
struct extent_io_tree *tree = &eb->fs_info->extent_cache;
|
||||
if (!(eb->flags & EXTENT_DIRTY)) {
|
||||
eb->flags |= EXTENT_DIRTY;
|
||||
set_extent_dirty(tree, eb->start, eb->start + eb->len - 1);
|
||||
@ -981,7 +977,7 @@ int set_extent_buffer_dirty(struct extent_buffer *eb)
|
||||
|
||||
int clear_extent_buffer_dirty(struct extent_buffer *eb)
|
||||
{
|
||||
struct extent_io_tree *tree = eb->tree;
|
||||
struct extent_io_tree *tree = &eb->fs_info->extent_cache;
|
||||
if (eb->flags & EXTENT_DIRTY) {
|
||||
eb->flags &= ~EXTENT_DIRTY;
|
||||
clear_extent_dirty(tree, eb->start, eb->start + eb->len - 1);
|
||||
|
@ -89,7 +89,6 @@ struct extent_buffer {
|
||||
struct cache_extent cache_node;
|
||||
u64 start;
|
||||
u64 dev_bytenr;
|
||||
struct extent_io_tree *tree;
|
||||
struct list_head lru;
|
||||
struct list_head recow;
|
||||
u32 len;
|
||||
|
Loading…
Reference in New Issue
Block a user