From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 9/9] btrfs: clean up header members offsets in write helpers
Date: Tue, 25 May 2021 19:08:43 +0200 [thread overview]
Message-ID: <3a6ce6b310ecb2021a1ffea01fb08f48663d1a00.1621961965.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1621961965.git.dsterba@suse.com>
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.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/extent_io.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 2b250c610562..2e924f60ea6f 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -6519,9 +6519,10 @@ void write_extent_buffer_chunk_tree_uuid(const struct extent_buffer *eb,
char *kaddr;
assert_eb_page_uptodate(eb, eb->pages[0]);
- kaddr = page_address(eb->pages[0]) + get_eb_offset_in_page(eb, 0);
- memcpy(kaddr + offsetof(struct btrfs_header, chunk_tree_uuid), srcv,
- BTRFS_FSID_SIZE);
+ kaddr = page_address(eb->pages[0]) +
+ get_eb_offset_in_page(eb, offsetof(struct btrfs_header,
+ chunk_tree_uuid));
+ memcpy(kaddr, srcv, BTRFS_FSID_SIZE);
}
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;
assert_eb_page_uptodate(eb, eb->pages[0]);
- kaddr = page_address(eb->pages[0]) + get_eb_offset_in_page(eb, 0);
- memcpy(kaddr + offsetof(struct btrfs_header, fsid), srcv,
- BTRFS_FSID_SIZE);
+ kaddr = page_address(eb->pages[0]) +
+ get_eb_offset_in_page(eb, offsetof(struct btrfs_header, fsid));
+ memcpy(kaddr, srcv, BTRFS_FSID_SIZE);
}
void write_extent_buffer(const struct extent_buffer *eb, const void *srcv,
--
2.29.2
next prev parent reply other threads:[~2021-05-25 17:11 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-25 17:08 [PATCH 0/9] Misc fixups and cleanups David Sterba
2021-05-25 17:08 ` [PATCH 1/9] btrfs: sysfs: fix format string for some discard stats David Sterba
2021-05-25 23:47 ` Qu Wenruo
2021-05-26 6:01 ` Anand Jain
2021-05-25 17:08 ` [PATCH 2/9] btrfs: clear defrag status of a root if starting transaction fails David Sterba
2021-05-25 23:49 ` Qu Wenruo
2021-05-26 6:05 ` Anand Jain
2021-05-25 17:08 ` [PATCH 3/9] btrfs: clear log tree recovering status " David Sterba
2021-05-25 23:50 ` Qu Wenruo
2021-05-26 6:57 ` Anand Jain
2021-05-25 17:08 ` [PATCH 4/9] btrfs: scrub: factor out common scrub_stripe constraints David Sterba
2021-05-25 23:51 ` Qu Wenruo
2021-05-26 7:16 ` Anand Jain
2021-05-25 17:08 ` [PATCH 5/9] btrfs: document byte swap optimization of root_item::flags accessors David Sterba
2021-05-26 7:28 ` Anand Jain
2021-05-25 17:08 ` [PATCH 6/9] btrfs: reduce compressed_bio members' types David Sterba
2021-05-26 8:40 ` [PATCH] btrfs: optimize users of members of the struct compressed_bio Anand Jain
2021-05-26 16:34 ` David Sterba
2021-05-26 8:41 ` [PATCH 6/9] btrfs: reduce compressed_bio members' types Anand Jain
2021-05-25 17:08 ` [PATCH 7/9] btrfs: remove extra sb::s_id from message in btrfs_validate_metadata_buffer David Sterba
2021-05-25 23:59 ` Qu Wenruo
2021-05-26 12:54 ` Anand Jain
2021-05-25 17:08 ` [PATCH 8/9] btrfs: simplify eb checksum verification " David Sterba
2021-05-26 0:05 ` Qu Wenruo
2021-05-26 16:31 ` David Sterba
2021-05-26 16:58 ` David Sterba
2021-05-26 23:13 ` Qu Wenruo
2021-05-26 23:13 ` David Sterba
2021-05-25 17:08 ` David Sterba [this message]
2021-05-26 0:07 ` [PATCH 9/9] btrfs: clean up header members offsets in write helpers Qu Wenruo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3a6ce6b310ecb2021a1ffea01fb08f48663d1a00.1621961965.git.dsterba@suse.com \
--to=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).