diff mbox series

[11/14] bcache: remove can_attach_cache()

Message ID 20200815041043.45116-12-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
After removing the embedded struct cache_sb from struct cache_set, cache
set will directly reference the in-memory super block of struct cache.
It is unnecessary to compare block_size, bucket_size and nr_in_set from
the identical in-memory super block in can_attach_cache().

This is a preparation patch for latter removing cache_set->sb from
struct cache_set.

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

Comments

Hannes Reinecke Aug. 17, 2020, 6:24 a.m. UTC | #1
On 8/15/20 6:10 AM, Coly Li wrote:
> After removing the embedded struct cache_sb from struct cache_set, cache
> set will directly reference the in-memory super block of struct cache.
> It is unnecessary to compare block_size, bucket_size and nr_in_set from
> the identical in-memory super block in can_attach_cache().
> 
> This is a preparation patch for latter removing cache_set->sb from
> struct cache_set.
> 
> Signed-off-by: Coly Li <colyli@suse.de>
> ---
>   drivers/md/bcache/super.c | 10 ----------
>   1 file changed, 10 deletions(-)
> 
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index 4ba713d0d9b0..a2bba78d78e6 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -2112,13 +2112,6 @@ static int run_cache_set(struct cache_set *c)
>   	return -EIO;
>   }
>   
> -static bool can_attach_cache(struct cache *ca, struct cache_set *c)
> -{
> -	return ca->sb.block_size	== c->sb.block_size &&
> -		ca->sb.bucket_size	== c->sb.bucket_size &&
> -		ca->sb.nr_in_set	== c->sb.nr_in_set;
> -}
> -
>   static const char *register_cache_set(struct cache *ca)
>   {
>   	char buf[12];
> @@ -2130,9 +2123,6 @@ static const char *register_cache_set(struct cache *ca)
>   			if (c->cache)
>   				return "duplicate cache set member";
>   
> -			if (!can_attach_cache(ca, c))
> -				return "cache sb does not match set";
> -
>   			if (!CACHE_SYNC(&ca->sb))
>   				SET_CACHE_SYNC(&c->sb, false);
>   
> 
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 4ba713d0d9b0..a2bba78d78e6 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -2112,13 +2112,6 @@  static int run_cache_set(struct cache_set *c)
 	return -EIO;
 }
 
-static bool can_attach_cache(struct cache *ca, struct cache_set *c)
-{
-	return ca->sb.block_size	== c->sb.block_size &&
-		ca->sb.bucket_size	== c->sb.bucket_size &&
-		ca->sb.nr_in_set	== c->sb.nr_in_set;
-}
-
 static const char *register_cache_set(struct cache *ca)
 {
 	char buf[12];
@@ -2130,9 +2123,6 @@  static const char *register_cache_set(struct cache *ca)
 			if (c->cache)
 				return "duplicate cache set member";
 
-			if (!can_attach_cache(ca, c))
-				return "cache sb does not match set";
-
 			if (!CACHE_SYNC(&ca->sb))
 				SET_CACHE_SYNC(&c->sb, false);