mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-28 17:12:17 +00:00
btrfs-progs: kernel-shared: use write_extent_buffer_fsid where possible
We already have the helper but don't use it everywhere. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
f094e35d63
commit
339de9b2d7
@ -332,8 +332,7 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
|
||||
else
|
||||
btrfs_set_header_owner(cow, new_root_objectid);
|
||||
|
||||
write_extent_buffer(cow, root->fs_info->fs_devices->metadata_uuid,
|
||||
btrfs_header_fsid(), BTRFS_FSID_SIZE);
|
||||
write_extent_buffer_fsid(cow, root->fs_info->fs_devices->metadata_uuid);
|
||||
|
||||
WARN_ON(btrfs_header_generation(buf) > trans->transid);
|
||||
ret = btrfs_inc_ref(trans, new_root, cow, 0);
|
||||
@ -392,8 +391,7 @@ int btrfs_create_root(struct btrfs_trans_handle *trans,
|
||||
btrfs_set_header_generation(node, trans->transid);
|
||||
btrfs_set_header_backref_rev(node, BTRFS_MIXED_BACKREF_REV);
|
||||
btrfs_set_header_owner(node, objectid);
|
||||
write_extent_buffer(node, fs_info->fs_devices->metadata_uuid,
|
||||
btrfs_header_fsid(), BTRFS_FSID_SIZE);
|
||||
write_extent_buffer_fsid(node, fs_info->fs_devices->metadata_uuid);
|
||||
write_extent_buffer(node, fs_info->chunk_tree_uuid,
|
||||
btrfs_header_chunk_tree_uuid(node),
|
||||
BTRFS_UUID_SIZE);
|
||||
@ -633,8 +631,7 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
|
||||
else
|
||||
btrfs_set_header_owner(cow, root->root_key.objectid);
|
||||
|
||||
write_extent_buffer(cow, root->fs_info->fs_devices->metadata_uuid,
|
||||
btrfs_header_fsid(), BTRFS_FSID_SIZE);
|
||||
write_extent_buffer_fsid(cow, root->fs_info->fs_devices->metadata_uuid);
|
||||
|
||||
WARN_ON(!(buf->flags & EXTENT_BUFFER_BAD_TRANSID) &&
|
||||
btrfs_header_generation(buf) > trans->transid);
|
||||
@ -1738,9 +1735,7 @@ static int noinline insert_new_root(struct btrfs_trans_handle *trans,
|
||||
|
||||
root_add_used(root, root->fs_info->nodesize);
|
||||
|
||||
write_extent_buffer(c, root->fs_info->fs_devices->metadata_uuid,
|
||||
btrfs_header_fsid(), BTRFS_FSID_SIZE);
|
||||
|
||||
write_extent_buffer_fsid(c, root->fs_info->fs_devices->metadata_uuid);
|
||||
write_extent_buffer(c, root->fs_info->chunk_tree_uuid,
|
||||
btrfs_header_chunk_tree_uuid(c),
|
||||
BTRFS_UUID_SIZE);
|
||||
@ -1860,8 +1855,7 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root
|
||||
btrfs_set_header_generation(split, trans->transid);
|
||||
btrfs_set_header_backref_rev(split, BTRFS_MIXED_BACKREF_REV);
|
||||
btrfs_set_header_owner(split, root->root_key.objectid);
|
||||
write_extent_buffer(split, root->fs_info->fs_devices->metadata_uuid,
|
||||
btrfs_header_fsid(), BTRFS_FSID_SIZE);
|
||||
write_extent_buffer_fsid(split, root->fs_info->fs_devices->metadata_uuid);
|
||||
write_extent_buffer(split, root->fs_info->chunk_tree_uuid,
|
||||
btrfs_header_chunk_tree_uuid(split),
|
||||
BTRFS_UUID_SIZE);
|
||||
@ -2430,9 +2424,7 @@ again:
|
||||
btrfs_set_header_backref_rev(right, BTRFS_MIXED_BACKREF_REV);
|
||||
btrfs_set_header_owner(right, root->root_key.objectid);
|
||||
btrfs_set_header_level(right, 0);
|
||||
write_extent_buffer(right, root->fs_info->fs_devices->metadata_uuid,
|
||||
btrfs_header_fsid(), BTRFS_FSID_SIZE);
|
||||
|
||||
write_extent_buffer_fsid(right, root->fs_info->fs_devices->metadata_uuid);
|
||||
write_extent_buffer(right, root->fs_info->chunk_tree_uuid,
|
||||
btrfs_header_chunk_tree_uuid(right),
|
||||
BTRFS_UUID_SIZE);
|
||||
|
@ -2334,8 +2334,7 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
|
||||
btrfs_set_header_backref_rev(leaf, BTRFS_MIXED_BACKREF_REV);
|
||||
btrfs_set_header_owner(leaf, root->root_key.objectid);
|
||||
root->node = leaf;
|
||||
write_extent_buffer(leaf, fs_info->fs_devices->metadata_uuid,
|
||||
btrfs_header_fsid(), BTRFS_FSID_SIZE);
|
||||
write_extent_buffer_fsid(leaf, fs_info->fs_devices->metadata_uuid);
|
||||
write_extent_buffer(leaf, fs_info->chunk_tree_uuid,
|
||||
btrfs_header_chunk_tree_uuid(leaf),
|
||||
BTRFS_UUID_SIZE);
|
||||
|
@ -609,6 +609,11 @@ void read_extent_buffer(const struct extent_buffer *eb, void *dst,
|
||||
memcpy(dst, eb->data + start, len);
|
||||
}
|
||||
|
||||
void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *src)
|
||||
{
|
||||
write_extent_buffer(eb, src, btrfs_header_fsid(), BTRFS_FSID_SIZE);
|
||||
}
|
||||
|
||||
void write_extent_buffer(const struct extent_buffer *eb, const void *src,
|
||||
unsigned long start, unsigned long len)
|
||||
{
|
||||
@ -647,11 +652,6 @@ int extent_buffer_test_bit(const struct extent_buffer *eb, unsigned long start,
|
||||
return le_test_bit(nr, (u8 *)eb->data + start);
|
||||
}
|
||||
|
||||
void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *srcv)
|
||||
{
|
||||
write_extent_buffer(eb, srcv, btrfs_header_fsid(), BTRFS_FSID_SIZE);
|
||||
}
|
||||
|
||||
/*
|
||||
* btrfs_readahead_node_child - readahead a node's child block
|
||||
* @node: parent node we're reading from
|
||||
|
@ -109,6 +109,7 @@ int memcmp_extent_buffer(const struct extent_buffer *eb, const void *ptrv,
|
||||
unsigned long start, unsigned long len);
|
||||
void read_extent_buffer(const struct extent_buffer *eb, void *dst,
|
||||
unsigned long start, unsigned long len);
|
||||
void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *src);
|
||||
void write_extent_buffer(const struct extent_buffer *eb, const void *src,
|
||||
unsigned long start, unsigned long len);
|
||||
void copy_extent_buffer_full(const struct extent_buffer *dst,
|
||||
@ -136,7 +137,6 @@ void extent_buffer_bitmap_set(struct extent_buffer *eb, unsigned long start,
|
||||
unsigned long pos, unsigned long len);
|
||||
void extent_buffer_init_cache(struct btrfs_fs_info *fs_info);
|
||||
void extent_buffer_free_cache(struct btrfs_fs_info *fs_info);
|
||||
void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *srcv);
|
||||
void btrfs_readahead_node_child(struct extent_buffer *node, int slot);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user