diff mbox series

[10/14] bcache: don't check seq numbers in register_cache_set()

Message ID 20200815041043.45116-11-colyli@suse.de (mailing list archive)
State New, archived
Headers show
Series bcache: remove multiple caches code framework | expand

Commit Message

Coly Li Aug. 15, 2020, 4:10 a.m. UTC
In order to update the partial super block of cache set, the seq numbers
of cache and cache set are checked in register_cache_set(). If cache's
seq number is larger than cache set's seq number, cache set must update
its partial super block from cache's super block. It is unncessary when
the embedded struct cache_sb is removed from struct cache set.

This patch removed the seq numbers checking from register_cache_set(),
because later there will be no such partial super block in struct cache
set, the cache set will directly reference in-memory super block from
struct cache. This is a preparation patch for removing embedded struct
cache_sb from struct cache_set.

Signed-off-by: Coly Li <colyli@suse.de>
---
 drivers/md/bcache/super.c | 15 ---------------
 1 file changed, 15 deletions(-)

Comments

Hannes Reinecke Aug. 17, 2020, 6:23 a.m. UTC | #1
On 8/15/20 6:10 AM, Coly Li wrote:
> In order to update the partial super block of cache set, the seq numbers
> of cache and cache set are checked in register_cache_set(). If cache's
> seq number is larger than cache set's seq number, cache set must update
> its partial super block from cache's super block. It is unncessary when
> the embedded struct cache_sb is removed from struct cache set.
> 
> This patch removed the seq numbers checking from register_cache_set(),
> because later there will be no such partial super block in struct cache
> set, the cache set will directly reference in-memory super block from
> struct cache. This is a preparation patch for removing embedded struct
> cache_sb from struct cache_set.
> 
> Signed-off-by: Coly Li <colyli@suse.de>
> ---
>   drivers/md/bcache/super.c | 15 ---------------
>   1 file changed, 15 deletions(-)
> 
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index 05c5a7e867bb..4ba713d0d9b0 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -2160,21 +2160,6 @@ static const char *register_cache_set(struct cache *ca)
>   	    sysfs_create_link(&c->kobj, &ca->kobj, buf))
>   		goto err;
>   
> -	/*
> -	 * A special case is both ca->sb.seq and c->sb.seq are 0,
> -	 * such condition happens on a new created cache device whose
> -	 * super block is never flushed yet. In this case c->sb.version
> -	 * and other members should be updated too, otherwise we will
> -	 * have a mistaken super block version in cache set.
> -	 */
> -	if (ca->sb.seq > c->sb.seq || c->sb.seq == 0) {
> -		c->sb.version		= ca->sb.version;
> -		memcpy(c->set_uuid, ca->sb.set_uuid, 16);
> -		c->sb.flags             = ca->sb.flags;
> -		c->sb.seq		= ca->sb.seq;
> -		pr_debug("set version = %llu\n", c->sb.version);
> -	}
> -
>   	kobject_get(&ca->kobj);
>   	ca->set = c;
>   	ca->set->cache = ca;
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 05c5a7e867bb..4ba713d0d9b0 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -2160,21 +2160,6 @@  static const char *register_cache_set(struct cache *ca)
 	    sysfs_create_link(&c->kobj, &ca->kobj, buf))
 		goto err;
 
-	/*
-	 * A special case is both ca->sb.seq and c->sb.seq are 0,
-	 * such condition happens on a new created cache device whose
-	 * super block is never flushed yet. In this case c->sb.version
-	 * and other members should be updated too, otherwise we will
-	 * have a mistaken super block version in cache set.
-	 */
-	if (ca->sb.seq > c->sb.seq || c->sb.seq == 0) {
-		c->sb.version		= ca->sb.version;
-		memcpy(c->set_uuid, ca->sb.set_uuid, 16);
-		c->sb.flags             = ca->sb.flags;
-		c->sb.seq		= ca->sb.seq;
-		pr_debug("set version = %llu\n", c->sb.version);
-	}
-
 	kobject_get(&ca->kobj);
 	ca->set = c;
 	ca->set->cache = ca;