diff mbox series

[v2,08/17] bcache: struct cache_sb is only for in-memory super block now

Message ID 20200715054612.6349-9-colyli@suse.de (mailing list archive)
State New, archived
Headers show
Series bcache: extend bucket size to 32bit width | expand

Commit Message

Coly Li July 15, 2020, 5:46 a.m. UTC
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 anymore, and removes the useless member
csum and pad[5].

Although struct cache_sb does not belong to uapi anymore, 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>
---
 include/uapi/linux/bcache.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Hannes Reinecke July 15, 2020, 6:45 a.m. UTC | #1
On 7/15/20 7:46 AM, Coly Li wrote:
> 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 anymore, and removes the useless member
> csum and pad[5].
> 
> Although struct cache_sb does not belong to uapi anymore, 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>
> ---
>  include/uapi/linux/bcache.h | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
> index 3c0aebb4a878..f5106c5939b0 100644
> --- a/include/uapi/linux/bcache.h
> +++ b/include/uapi/linux/bcache.h
> @@ -216,8 +216,13 @@ struct cache_sb_disk {
>  /*8d0*/
>  };
>  
> +/*
> + * This is for in-memory bcache super block.
> + * NOTE: cache_sb is NOT exactly mapping to cache_sb_disk anymore,
> + *       the member size, ordering and even whole struct size may be
> + *       different from cache_sb_disk now.
> + */
>  struct cache_sb {
> -	__u64			csum;
>  	__u64			offset;	/* sector where this sb was written */
>  	__u64			version;
>  
> @@ -237,8 +242,6 @@ struct cache_sb {
>  	__u64			feature_incompat;
>  	__u64			feature_ro_compat;
>  
> -	__u64			pad[5];
> -
>  	union {
>  	struct {
>  		/* Cache devices */
> @@ -246,7 +249,6 @@ struct cache_sb {
>  
>  		__u16		block_size;	/* sectors */
>  		__u16		bucket_size;	/* sectors */
> -
>  		__u16		nr_in_set;
>  		__u16		nr_this_dev;
>  	};
> 
I would drop the 'anymore' from the description, as this implies it
changed recently. But otherwise:

Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
diff mbox series

Patch

diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
index 3c0aebb4a878..f5106c5939b0 100644
--- a/include/uapi/linux/bcache.h
+++ b/include/uapi/linux/bcache.h
@@ -216,8 +216,13 @@  struct cache_sb_disk {
 /*8d0*/
 };
 
+/*
+ * This is for in-memory bcache super block.
+ * NOTE: cache_sb is NOT exactly mapping to cache_sb_disk anymore,
+ *       the member size, ordering and even whole struct size may be
+ *       different from cache_sb_disk now.
+ */
 struct cache_sb {
-	__u64			csum;
 	__u64			offset;	/* sector where this sb was written */
 	__u64			version;
 
@@ -237,8 +242,6 @@  struct cache_sb {
 	__u64			feature_incompat;
 	__u64			feature_ro_compat;
 
-	__u64			pad[5];
-
 	union {
 	struct {
 		/* Cache devices */
@@ -246,7 +249,6 @@  struct cache_sb {
 
 		__u16		block_size;	/* sectors */
 		__u16		bucket_size;	/* sectors */
-
 		__u16		nr_in_set;
 		__u16		nr_this_dev;
 	};