From: Lin Feng <linf@wangsu.com>
To: Coly Li <colyli@suse.de>
Cc: axboe@kernel.dk, linux-kernel@vger.kernel.org,
linux-bcache@vger.kernel.org
Subject: Re: [PATCH] bcache: fix wrong BITMASK offset value for BDEV_CACHE_MODE
Date: Mon, 16 May 2022 09:50:22 +0800 [thread overview]
Message-ID: <0010ee74-0aac-e998-c74b-84bf7de23335@wangsu.com> (raw)
In-Reply-To: <f80cefa2-e238-9939-5f48-9d84bcc248f3@suse.de>
On 5/13/22 23:20, Coly Li wrote:
> On 7/20/21 6:32 PM, Lin Feng wrote:
>> Original codes:
>> BITMASK(CACHE_SYNC, struct cache_sb, flags, 0, 1);
>> BITMASK(CACHE_DISCARD, struct cache_sb, flags, 1, 1);
>> BITMASK(CACHE_REPLACEMENT, struct cache_sb, flags, 2, 3);
>> ...
>> BITMASK(BDEV_CACHE_MODE, struct cache_sb, flags, 0, 4);
>>
>> Should BDEV_CACHE_MODE bits start from bit-nr 5(2+3) else it overlaps
>> with previous defined bit chunks, since we have 4 types of cache modes,
>> BDEV_CACHE_MODE will overwrite CACHE_SYNC and CACHE_DISCARD bits.
>
> The overlap won't happen, previous lines are for cache device, and what
> you modified is for backing device.
>
> And your patch changes the on-disk format, which is unacceptable anyway.
>
Yes, you are right, this patch happened as I started reading bcache codes,
I did not get a whole picture of bcache at that time, I'm sorry for making
noise.
Thank you, Coly!
linfeng
>
> Coly Li
>
>>
>> This bug stays there since first upstream version of bcache, don't know
>> why it lives so long, or am i missing something, please point me out
>> if I'm wrong, thanks!
>>
>> Signed-off-by: Lin Feng <linf@wangsu.com>
>> ---
>> include/uapi/linux/bcache.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h
>> index cf7399f03b71..dccd89756451 100644
>> --- a/include/uapi/linux/bcache.h
>> +++ b/include/uapi/linux/bcache.h
>> @@ -288,7 +288,7 @@ BITMASK(CACHE_REPLACEMENT, struct cache_sb, flags, 2, 3);
>> #define CACHE_REPLACEMENT_FIFO 1U
>> #define CACHE_REPLACEMENT_RANDOM 2U
>>
>> -BITMASK(BDEV_CACHE_MODE, struct cache_sb, flags, 0, 4);
>> +BITMASK(BDEV_CACHE_MODE, struct cache_sb, flags, 5, 4);
>> #define CACHE_MODE_WRITETHROUGH 0U
>> #define CACHE_MODE_WRITEBACK 1U
>> #define CACHE_MODE_WRITEAROUND 2U
>
prev parent reply other threads:[~2022-05-16 1:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-20 10:32 [PATCH] bcache: fix wrong BITMASK offset value for BDEV_CACHE_MODE Lin Feng
2022-05-13 15:20 ` Coly Li
2022-05-16 1:50 ` 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=0010ee74-0aac-e998-c74b-84bf7de23335@wangsu.com \
--to=linf@wangsu.com \
--cc=axboe@kernel.dk \
--cc=colyli@suse.de \
--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;
as well as URLs for NNTP newsgroup(s).