btrfs: open code trivial helper btrfs_header_fsid
authorDavid Sterba <dsterba@suse.com>
Wed, 20 Mar 2019 12:15:57 +0000 (13:15 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 23 Mar 2020 16:01:44 +0000 (17:01 +0100)
The helper btrfs_header_fsid follows naming convention of other struct
accessors but does something compeletly different. As the offsetof
calculation is clear in the context of extent buffer operations we can
remove it.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/disk-io.c

index db9e872bcc79591886585814657fb6f2bacfa2cd..f66c4ea7491d58dceb8c7bba3c3eefc64398fee1 100644 (file)
@@ -1973,11 +1973,6 @@ static inline void btrfs_set_header_backref_rev(struct extent_buffer *eb,
        btrfs_set_header_flags(eb, flags);
 }
 
-static inline unsigned long btrfs_header_fsid(void)
-{
-       return offsetof(struct btrfs_header, fsid);
-}
-
 static inline unsigned long btrfs_header_chunk_tree_uuid(const struct extent_buffer *eb)
 {
        return offsetof(struct btrfs_header, chunk_tree_uuid);
index 06819c41e4f4712b59f383694aa13803c481ac42..2e482657a1b4a6aa5d2ebcda6f39498baa28f734 100644 (file)
@@ -541,7 +541,8 @@ static int csum_dirty_buffer(struct btrfs_fs_info *fs_info, struct page *page)
                return -EUCLEAN;
 
        ASSERT(memcmp_extent_buffer(eb, fs_info->fs_devices->metadata_uuid,
-                       btrfs_header_fsid(), BTRFS_FSID_SIZE) == 0);
+                                   offsetof(struct btrfs_header, fsid),
+                                   BTRFS_FSID_SIZE) == 0);
 
        if (csum_tree_block(eb, result))
                return -EINVAL;
@@ -571,7 +572,8 @@ static int check_tree_block_fsid(struct extent_buffer *eb)
        u8 fsid[BTRFS_FSID_SIZE];
        int ret = 1;
 
-       read_extent_buffer(eb, fsid, btrfs_header_fsid(), BTRFS_FSID_SIZE);
+       read_extent_buffer(eb, fsid, offsetof(struct btrfs_header, fsid),
+                          BTRFS_FSID_SIZE);
        while (fs_devices) {
                u8 *metadata_uuid;