[v3,07/16] bcache: struct cache_sb is only for in-memory super block now
diff mbox series

Message ID 20200715143015.14957-8-colyli@suse.de
State New
Headers show
Series
  • bcache: extend bucket size to 32bit width
Related show

Commit Message

Coly Li July 15, 2020, 2:30 p.m. UTC
From: Coly Li <colyli@suse.de>

We have struct cache_sb_disk for on-disk super block already, it is
unnecessary to keep the in-memory super block format exactly mapping
to the on-disk struct layout.

This patch adds code comments to notice that struct cache_sb is not
exactly mapping to cache_sb_disk, and removes the useless member csum
and pad[5].

Although struct cache_sb does not belong to uapi, but there are still
some on-disk format related macros reference it and it is unncessary to
get rid of such dependency now. So struct cache_sb will continue to stay
in include/uapi/linux/bache.h for now.

Signed-off-by: Coly Li <colyli@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
 include/uapi/linux/bcache.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Christoph Hellwig July 15, 2020, 6:21 p.m. UTC | #1
On Wed, Jul 15, 2020 at 10:30:06PM +0800, colyli@suse.de wrote:
> From: Coly Li <colyli@suse.de>
> 
> We have struct cache_sb_disk for on-disk super block already, it is
> unnecessary to keep the in-memory super block format exactly mapping
> to the on-disk struct layout.
> 
> This patch adds code comments to notice that struct cache_sb is not
> exactly mapping to cache_sb_disk, and removes the useless member csum
> and pad[5].
> 
> Although struct cache_sb does not belong to uapi, but there are still
> some on-disk format related macros reference it and it is unncessary to
> get rid of such dependency now. So struct cache_sb will continue to stay
> in include/uapi/linux/bache.h for now.
> 
> Signed-off-by: Coly Li <colyli@suse.de>
> Reviewed-by: Hannes Reinecke <hare@suse.de>

If you change this it really needs to move out of the uapi header.
Coly Li July 16, 2020, 3:31 a.m. UTC | #2
On 2020/7/16 02:21, Christoph Hellwig wrote:
> On Wed, Jul 15, 2020 at 10:30:06PM +0800, colyli@suse.de wrote:
>> From: Coly Li <colyli@suse.de>
>>
>> We have struct cache_sb_disk for on-disk super block already, it is
>> unnecessary to keep the in-memory super block format exactly mapping
>> to the on-disk struct layout.
>>
>> This patch adds code comments to notice that struct cache_sb is not
>> exactly mapping to cache_sb_disk, and removes the useless member csum
>> and pad[5].
>>
>> Although struct cache_sb does not belong to uapi, but there are still
>> some on-disk format related macros reference it and it is unncessary to
>> get rid of such dependency now. So struct cache_sb will continue to stay
>> in include/uapi/linux/bache.h for now.
>>
>> Signed-off-by: Coly Li <colyli@suse.de>
>> Reviewed-by: Hannes Reinecke <hare@suse.de>
> 
> If you change this it really needs to move out of the uapi header.
> 
I see and I tried. It needs more work to cleanup the dependence, it will
be finished later.

Thanks.

Coly Li

Patch
diff mbox series

diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
index 47df2db2e727..0ef984ea515a 100644
--- a/include/uapi/linux/bcache.h
+++ b/include/uapi/linux/bcache.h
@@ -215,8 +215,13 @@  struct cache_sb_disk {
 	__le64			d[SB_JOURNAL_BUCKETS];	/* journal buckets */
 };
 
+/*
+ * This is for in-memory bcache super block.
+ * NOTE: cache_sb is NOT exactly mapping to cache_sb_disk, the member
+ *       size, ordering and even whole struct size may be different
+ *       from cache_sb_disk.
+ */
 struct cache_sb {
-	__u64			csum;
 	__u64			offset;	/* sector where this sb was written */
 	__u64			version;
 
@@ -236,8 +241,6 @@  struct cache_sb {
 	__u64			feature_incompat;
 	__u64			feature_ro_compat;
 
-	__u64			pad[5];
-
 	union {
 	struct {
 		/* Cache devices */
@@ -245,7 +248,6 @@  struct cache_sb {
 
 		__u16		block_size;	/* sectors */
 		__u16		bucket_size;	/* sectors */
-
 		__u16		nr_in_set;
 		__u16		nr_this_dev;
 	};