diff mbox series

[RFC,v4,3/3] bcache: reject writeback cache mode for zoned backing device

Message ID 20200522121837.109651-4-colyli@suse.de (mailing list archive)
State New, archived
Headers show
Series bcache: support zoned device as bcache backing device | expand

Commit Message

Coly Li May 22, 2020, 12:18 p.m. UTC
Currently we don't support writeback mode for zoned device as backing
device. So reject it by sysfs interface.

This rejection will be removed after the writeback cache mode support
for zoned device gets done.

Signed-off-by: Coly Li <colyli@suse.de>
Cc: Damien Le Moal <damien.lemoal@wdc.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 drivers/md/bcache/sysfs.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Damien Le Moal May 25, 2020, 1:26 a.m. UTC | #1
On 2020/05/22 21:19, Coly Li wrote:
> Currently we don't support writeback mode for zoned device as backing
> device. So reject it by sysfs interface.
> 
> This rejection will be removed after the writeback cache mode support
> for zoned device gets done.
> 
> Signed-off-by: Coly Li <colyli@suse.de>
> Cc: Damien Le Moal <damien.lemoal@wdc.com>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
>  drivers/md/bcache/sysfs.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
> index 323276994aab..41bdbc42a17d 100644
> --- a/drivers/md/bcache/sysfs.c
> +++ b/drivers/md/bcache/sysfs.c
> @@ -359,6 +359,11 @@ STORE(__cached_dev)
>  		if (v < 0)
>  			return v;
>  
> +		if ((unsigned int) v == CACHE_MODE_WRITEBACK) {
> +			pr_err("writeback mode is not supported for zoned backing device.\n");
> +			return -ENOTSUPP;
> +		}
> +
>  		if ((unsigned int) v != BDEV_CACHE_MODE(&dc->sb)) {
>  			SET_BDEV_CACHE_MODE(&dc->sb, v);
>  			bch_write_bdev_super(dc, NULL);
> 

Do you have a similar check in bcache user tools at format time ? Or is the
cache mode specified only when the bcache device is started ?

Looks good.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Coly Li June 1, 2020, 4:09 p.m. UTC | #2
On 2020/5/25 09:26, Damien Le Moal wrote:
> On 2020/05/22 21:19, Coly Li wrote:
>> Currently we don't support writeback mode for zoned device as backing
>> device. So reject it by sysfs interface.
>>
>> This rejection will be removed after the writeback cache mode support
>> for zoned device gets done.
>>
>> Signed-off-by: Coly Li <colyli@suse.de>
>> Cc: Damien Le Moal <damien.lemoal@wdc.com>
>> Cc: Hannes Reinecke <hare@suse.com>
>> Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>> ---
>>  drivers/md/bcache/sysfs.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
>> index 323276994aab..41bdbc42a17d 100644
>> --- a/drivers/md/bcache/sysfs.c
>> +++ b/drivers/md/bcache/sysfs.c
>> @@ -359,6 +359,11 @@ STORE(__cached_dev)
>>  		if (v < 0)
>>  			return v;
>>  
>> +		if ((unsigned int) v == CACHE_MODE_WRITEBACK) {
>> +			pr_err("writeback mode is not supported for zoned backing device.\n");
>> +			return -ENOTSUPP;
>> +		}
>> +
>>  		if ((unsigned int) v != BDEV_CACHE_MODE(&dc->sb)) {
>>  			SET_BDEV_CACHE_MODE(&dc->sb, v);
>>  			bch_write_bdev_super(dc, NULL);
>>
> 
> Do you have a similar check in bcache user tools at format time ? Or is the
> cache mode specified only when the bcache device is started ?

Yes I do the cache mode check in bcache-tools, and if user sets
writeback mode, bcache-tools will inform user and switch it to
writethrough mode explicitly.

> 
> Looks good.
> 
> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
> 

Thank you for the review!

Coly Li
diff mbox series

Patch

diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
index 323276994aab..41bdbc42a17d 100644
--- a/drivers/md/bcache/sysfs.c
+++ b/drivers/md/bcache/sysfs.c
@@ -359,6 +359,11 @@  STORE(__cached_dev)
 		if (v < 0)
 			return v;
 
+		if ((unsigned int) v == CACHE_MODE_WRITEBACK) {
+			pr_err("writeback mode is not supported for zoned backing device.\n");
+			return -ENOTSUPP;
+		}
+
 		if ((unsigned int) v != BDEV_CACHE_MODE(&dc->sb)) {
 			SET_BDEV_CACHE_MODE(&dc->sb, v);
 			bch_write_bdev_super(dc, NULL);