Commit 24880be5 authored by David Sterba's avatar David Sterba

btrfs: clean up header members offsets in write helpers

Move header offsetof() to the expression that calculates the address so
it's part of get_eb_offset_in_page where the 2nd parameter is the member
offset.
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent dfd29eed
...@@ -6519,9 +6519,10 @@ void write_extent_buffer_chunk_tree_uuid(const struct extent_buffer *eb, ...@@ -6519,9 +6519,10 @@ void write_extent_buffer_chunk_tree_uuid(const struct extent_buffer *eb,
char *kaddr; char *kaddr;
assert_eb_page_uptodate(eb, eb->pages[0]); assert_eb_page_uptodate(eb, eb->pages[0]);
kaddr = page_address(eb->pages[0]) + get_eb_offset_in_page(eb, 0); kaddr = page_address(eb->pages[0]) +
memcpy(kaddr + offsetof(struct btrfs_header, chunk_tree_uuid), srcv, get_eb_offset_in_page(eb, offsetof(struct btrfs_header,
BTRFS_FSID_SIZE); chunk_tree_uuid));
memcpy(kaddr, srcv, BTRFS_FSID_SIZE);
} }
void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *srcv) void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *srcv)
...@@ -6529,9 +6530,9 @@ void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *srcv) ...@@ -6529,9 +6530,9 @@ void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *srcv)
char *kaddr; char *kaddr;
assert_eb_page_uptodate(eb, eb->pages[0]); assert_eb_page_uptodate(eb, eb->pages[0]);
kaddr = page_address(eb->pages[0]) + get_eb_offset_in_page(eb, 0); kaddr = page_address(eb->pages[0]) +
memcpy(kaddr + offsetof(struct btrfs_header, fsid), srcv, get_eb_offset_in_page(eb, offsetof(struct btrfs_header, fsid));
BTRFS_FSID_SIZE); memcpy(kaddr, srcv, BTRFS_FSID_SIZE);
} }
void write_extent_buffer(const struct extent_buffer *eb, const void *srcv, void write_extent_buffer(const struct extent_buffer *eb, const void *srcv,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment