diff options
author | Coly Li <colyli@suse.de> | 2020-05-16 21:57:17 +0800 |
---|---|---|
committer | Coly Li <colyli@suse.de> | 2020-05-16 21:57:17 +0800 |
commit | 4bd87adb36c36c74f2f132a0e71599952dcf91d6 (patch) | |
tree | 3043ca31c688a0db19394afd69a24706941df2a3 | |
parent | 0898a6c8899355b75a13bf490c09e21289d28478 (diff) | |
download | bcache-tools-zonde-device.tar.gz |
bcache-tools: convert writeback to writethrough mode for zoned backing devicezonde-device
Currently bcache does not support writeback cache mode for zoned device
as backing device.
If the backing device is zoned device, and cache mode is explicitly set
to writeback mode, a information will be print to terminal,
"Zoned device <device name> detected: convert to writethrough mode."
Then the cache mode will be automatically converted to writethrough,
which is the default cache mode of bcache-tools.
Signed-off-by: Coly Li <colyli@suse.de>
-rw-r--r-- | make.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -378,6 +378,19 @@ static void write_sb(char *dev, unsigned int block_size, SET_BDEV_CACHE_MODE(&sb, writeback ? CACHE_MODE_WRITEBACK : CACHE_MODE_WRITETHROUGH); + /* + * Currently bcache does not support writeback mode for + * zoned device as backing device. If the cache mode is + * explicitly set to writeback, automatically convert to + * writethough mode. + */ + if (is_zoned_device(dev) && + BDEV_CACHE_MODE(&sb) == CACHE_MODE_WRITEBACK) { + printf("Zoned device %s detected: convert to writethrough mode.\n", + dev); + SET_BDEV_CACHE_MODE(&sb, CACHE_MODE_WRITETHROUGH); + } + if (data_offset != BDEV_DATA_START_DEFAULT) { sb.version = BCACHE_SB_VERSION_BDEV_WITH_OFFSET; sb.data_offset = data_offset; |