From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 1/3] btrfs-progs: unify sizeof(struct btrfs_super_block) and BTRFS_SUPER_INFO_SIZE
Date: Thu, 21 Oct 2021 09:40:18 +0800 [thread overview]
Message-ID: <20211021014020.482242-2-wqu@suse.com> (raw)
In-Reply-To: <20211021014020.482242-1-wqu@suse.com>
Just like kernel change, pad struct btrfs_super_block to 4096 bytes.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
kernel-shared/ctree.h | 7 +++++++
kernel-shared/disk-io.h | 3 ---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
index 563ea50b3587..6451690ce4fa 100644
--- a/kernel-shared/ctree.h
+++ b/kernel-shared/ctree.h
@@ -406,6 +406,9 @@ struct btrfs_root_backup {
u8 unused_8[10];
} __attribute__ ((__packed__));
+#define BTRFS_SUPER_INFO_OFFSET SZ_64K
+#define BTRFS_SUPER_INFO_SIZE 4096
+
/*
* the super block basically lists the main trees of the FS
* it currently lacks any block count etc etc
@@ -456,8 +459,12 @@ struct btrfs_super_block {
__le64 reserved[28];
u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
struct btrfs_root_backup super_roots[BTRFS_NUM_BACKUP_ROOTS];
+ /* Padded to 4096 bytes */
+ u8 padding[565];
} __attribute__ ((__packed__));
+static_assert(sizeof(struct btrfs_super_block) == BTRFS_SUPER_INFO_SIZE);
+
/*
* Compat flags that we support. If any incompat flags are set other than the
* ones specified below then we will fail to mount
diff --git a/kernel-shared/disk-io.h b/kernel-shared/disk-io.h
index e113d842c906..823e5af37e75 100644
--- a/kernel-shared/disk-io.h
+++ b/kernel-shared/disk-io.h
@@ -23,9 +23,6 @@
#include "kernel-shared/ctree.h"
#include "kernel-lib/sizes.h"
-#define BTRFS_SUPER_INFO_OFFSET SZ_64K
-#define BTRFS_SUPER_INFO_SIZE 4096
-
#define BTRFS_SUPER_MIRROR_MAX 3
#define BTRFS_SUPER_MIRROR_SHIFT 12
--
2.33.0
next prev parent reply other threads:[~2021-10-21 1:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-21 1:40 [PATCH 0/3] btrfs-progs: cleanup related to btrfs super block Qu Wenruo
2021-10-21 1:40 ` Qu Wenruo [this message]
2021-10-21 12:40 ` [PATCH 1/3] btrfs-progs: unify sizeof(struct btrfs_super_block) and BTRFS_SUPER_INFO_SIZE David Sterba
2021-10-21 12:49 ` Qu Wenruo
2021-10-21 1:40 ` [PATCH 2/3] btrfs-progs: remove temporary buffer for super block Qu Wenruo
2021-10-21 1:40 ` [PATCH 3/3] btrfs-progs: cache csum_size and csum_type in btrfs_fs_info Qu Wenruo
2021-11-04 19:10 ` [PATCH 0/3] btrfs-progs: cleanup related to btrfs super block David Sterba
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=20211021014020.482242-2-wqu@suse.com \
--to=wqu@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