mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lin Feng <linf@wangsu.com>
To: Coly Li <colyli@suse.de>
Cc: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org,
	kent.overstreet@gmail.com
Subject: Re: [PATCH] bcache: kill macro MAX_CACHES_PER_SET
Date: Mon, 1 Nov 2021 10:28:17 +0800	[thread overview]
Message-ID: <e33c0951-f882-8b2d-a86f-eb9342334b1b@wangsu.com> (raw)
In-Reply-To: <9516418b-27d0-d84b-d9cb-be72d5e8f9ce@suse.de>

Hi Coly,

OK, I will send another patch but keep MAX_CACHES_PER_SET, thanks :)

linfeng

On 10/30/21 23:19, Coly Li wrote:
> On 10/29/21 8:59 PM, Lin Feng wrote:
>> Commit 697e23495c94f0380c1ed8b11f830b92b64c99ea
>> ("bcache: explicitly make cache_set only have single cache")
>> explicitly makes a cache_set only have single cache and based on the
>> fact that historily only one cache is ever used in the cache set, so
>> macro defination for MAX_CACHES_PER_SET as 8 is misleading now.
>>
>> In fact it should be redefined to 1 and valid number fo sb.nr_in_set
>> should be 1 and sb.nr_this_dev should always be 0.
>>
>> But jset's disk layout replies on MAX_CACHES_PER_SET(8), so replace it
>> with a hardcoded number 8.
>>
>> Signed-off-by: Lin Feng <linf@wangsu.com>
>> ---
>>    drivers/md/bcache/bcache.h  | 2 +-
>>    drivers/md/bcache/super.c   | 4 +---
>>    include/uapi/linux/bcache.h | 4 ++--
>>    3 files changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h
>> index 5fc989a6d452..a4a410a178c0 100644
>> --- a/drivers/md/bcache/bcache.h
>> +++ b/drivers/md/bcache/bcache.h
>> @@ -833,7 +833,7 @@ static inline uint8_t ptr_stale(struct cache_set *c, const struct bkey *k,
>>    static inline bool ptr_available(struct cache_set *c, const struct bkey *k,
>>    				 unsigned int i)
>>    {
>> -	return (PTR_DEV(k, i) < MAX_CACHES_PER_SET) && c->cache;
>> +	return (PTR_DEV(k, i) == 0) && c->cache;
>>    }
>>    
>>    /* Btree key macros */
>> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
>> index f2874c77ff79..2253044c9289 100644
>> --- a/drivers/md/bcache/super.c
>> +++ b/drivers/md/bcache/super.c
>> @@ -140,9 +140,7 @@ static const char *read_super_common(struct cache_sb *sb,  struct block_device *
>>    		goto err;
>>    
>>    	err = "Bad cache device number in set";
>> -	if (!sb->nr_in_set ||
>> -	    sb->nr_in_set <= sb->nr_this_dev ||
>> -	    sb->nr_in_set > MAX_CACHES_PER_SET)
>> +	if (sb->nr_in_set != 1 || sb->nr_this_dev != 0)
>>    		goto err;
>>    
>>    	err = "Journal buckets not sequential";
> 
> Hi Feng,
> 
> The above changes are fine to me. But let's keep the below part as what
> it is at this moment.
> 
> Thanks.
> 
> Coly Li
> 
>> diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
>> index cf7399f03b71..4beb3e7826ca 100644
>> --- a/include/uapi/linux/bcache.h
>> +++ b/include/uapi/linux/bcache.h
>> @@ -155,7 +155,6 @@ static inline struct bkey *bkey_idx(const struct bkey *k, unsigned int nr_keys)
>>    #define SB_LABEL_SIZE			32
>>    #define SB_JOURNAL_BUCKETS		256U
>>    /* SB_JOURNAL_BUCKETS must be divisible by BITS_PER_LONG */
>> -#define MAX_CACHES_PER_SET		8
>>    
>>    #define BDEV_DATA_START_DEFAULT		16	/* sectors */
>>    
>> @@ -356,7 +355,8 @@ struct jset {
>>    	__u16			btree_level;
>>    	__u16			pad[3];
>>    
>> -	__u64			prio_bucket[MAX_CACHES_PER_SET];
>> +	/* only a single cache is available */
>> +	__u64			prio_bucket[8];
>>    
>>    	union {
>>    		struct bkey	start[0];


      reply	other threads:[~2021-11-01  2:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-29 12:59 Lin Feng
2021-10-30 15:19 ` Coly Li
2021-11-01  2:28   ` Lin Feng [this message]

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=e33c0951-f882-8b2d-a86f-eb9342334b1b@wangsu.com \
    --to=linf@wangsu.com \
    --cc=colyli@suse.de \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®