From: Coly Li <colyli@suse.de>
To: linux-bcache@vger.kernel.org
Cc: linux-block@vger.kernel.org, Coly Li <colyli@suse.de>
Subject: [RFC PATCH 1/4] bcache-tools: comments offset for members of struct cache_sb
Date: Mon, 6 Jul 2020 00:04:37 +0800 [thread overview]
Message-ID: <20200705160440.5801-2-colyli@suse.de> (raw)
In-Reply-To: <20200705160440.5801-1-colyli@suse.de>
This patch adds code comments to mark the offset of each member from
struct cache_sb. It is helpful for understand the super block on disk.
Signed-off-by: Coly Li <colyli@suse.de>
---
bcache.h | 64 ++++++++++++++++++++++++++++++--------------------------
1 file changed, 34 insertions(+), 30 deletions(-)
diff --git a/bcache.h b/bcache.h
index c83f838..3fcf187 100644
--- a/bcache.h
+++ b/bcache.h
@@ -41,54 +41,58 @@ static const char bcache_magic[] = {
#define SB_START (SB_SECTOR * 512)
struct cache_sb {
- uint64_t csum;
- uint64_t offset; /* sector where this sb was written */
- uint64_t version;
+/*000*/ uint64_t csum;
+ /* sector where this sb was written */
+/*008*/ uint64_t offset;
+/*010*/ uint64_t version;
- uint8_t magic[16];
+/*018*/ uint8_t magic[16];
- uint8_t uuid[16];
+/*028*/ uint8_t uuid[16];
union {
- uint8_t set_uuid[16];
- uint64_t set_magic;
+/*038*/ uint8_t set_uuid[16];
+/*038*/ uint64_t set_magic;
};
- uint8_t label[SB_LABEL_SIZE];
+/*048*/ uint8_t label[SB_LABEL_SIZE];
- uint64_t flags;
- uint64_t seq;
- uint64_t pad[8];
+/*068*/ uint64_t flags;
+/*070*/ uint64_t seq;
+/*078*/ uint64_t pad[8];
union {
struct {
- /* Cache devices */
- uint64_t nbuckets; /* device size */
+ /* Cache devices */
+/*0b8*/ uint64_t nbuckets; /* device size */
- uint16_t block_size; /* sectors */
- uint16_t bucket_size; /* sectors */
+/*0c0*/ uint16_t block_size; /* sectors */
+/*0c2*/ uint16_t bucket_size; /* sectors */
- uint16_t nr_in_set;
- uint16_t nr_this_dev;
+/*0c4*/ uint16_t nr_in_set;
+/*0c6*/ uint16_t nr_this_dev;
};
struct {
- /* Backing devices */
- uint64_t data_offset;
-
- /*
- * block_size from the cache device section is still used by
- * backing devices, so don't add anything here until we fix
- * things to not need it for backing devices anymore
- */
+ /* Backing devices */
+/*0b8*/ uint64_t data_offset;
+
+ /*
+ * block_size from the cache device section is still
+ * used by backing devices, so don't add anything here
+ * until we fix things to not need it for backing
+ * devices anymore
+ */
};
};
- uint32_t last_mount; /* time_t */
+/*0c8*/ uint32_t last_mount; /* time_t */
- uint16_t first_bucket;
+/*0cc*/ uint16_t first_bucket;
union {
- uint16_t njournal_buckets;
- uint16_t keys;
+/*0ce*/ uint16_t njournal_buckets;
+/*0ce*/ uint16_t keys;
};
- uint64_t d[SB_JOURNAL_BUCKETS]; /* journal buckets */
+ /* journal buckets */
+/*0d0*/ uint64_t d[SB_JOURNAL_BUCKETS];
+/*8d0*/
};
static inline bool SB_IS_BDEV(const struct cache_sb *sb)
--
2.26.2
next prev parent reply other threads:[~2020-07-05 16:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-05 16:04 [RFC PATCH 0/4] bcache-tools: changes for large bucket size Coly Li
2020-07-05 16:04 ` Coly Li
2020-07-05 16:04 ` Coly Li [this message]
2020-07-05 16:04 ` [RFC PATCH 2/4] struct_offset: print offset of each member of the on-disk data structure Coly Li
2020-07-05 16:04 ` [RFC PATCH 3/4] bcache-tools: The new super block version BCACHE_SB_VERSION_BDEV_WITH_FEATURES Coly Li
2020-07-05 16:04 ` [RFC PATCH 4/4] bcache-tools: add large_bucket incompat feature Coly Li
2020-07-05 16:04 ` Coly Li
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=20200705160440.5801-2-colyli@suse.de \
--to=colyli@suse.de \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@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