SHA256
1
0
forked from pool/bcache-tools
bcache-tools/0003-bcache-tools-convert-writeback-to-writethrough-mode-.patch

51 lines
1.7 KiB
Diff
Raw Normal View History

Accepting request 841483 from home:colyli:branches:filesystems - Remove dependence of smartcols bcache-tools.spec, bcache-tools code doesn't need it now. (jsc#SLE-9807) - Remove 1001-udev-do-not-rely-on-DRIVER-variable.patch because we have 0013-bcache-tools-Export-CACHED_UUID-and-CACHED_LABEL.patch to provide static UUIDs. (jsc#SLE-9807) - bcache-tools: add man page bcache-status.8 (jsc#SLE-9807) 0017-bcache-tools-add-man-page-bcache-status.8.patch - bcache-tools: add bcache-status (jsc#SLE-9807) 0016-bcache-tools-add-bcache-status.patch - bcache-tools: make: permit only one cache device to be specified (jsc#SLE-9807) 0015-bcache-tools-make-permit-only-one-cache-device-to-be.patch - bcache-tools: Remove the dependency on libsmartcols (jsc#SLE-9807) 0014-bcache-tools-Remove-the-dependency-on-libsmartcols.patch - bcache-tools: Export CACHED_UUID and CACHED_LABEL (jsc#SLE-9807) 0013-bcache-tools-Export-CACHED_UUID-and-CACHED_LABEL.patch - bcache-tools: Fix potential coredump issues (jsc#SLE-9807) 0012-bcache-tools-Fix-potential-coredump-issues.patch - bcache-tools: add print_cache_set_supported_feature_sets() in lib.c (jsc#SLE-9807) 0011-bcache-tools-add-print_cache_set_supported_feature_s.patch - bcache-tools: add large_bucket incompat feature (jsc#SLE-9807) 0010-bcache-tools-add-large_bucket-incompat-feature.patch - bcache-tools: upgrade super block versions for feature sets (jsc#SLE-9807) 0009-bcache-tools-upgrade-super-block-versions-for-featur.patch - bcache-tools: define separated super block for in-memory and on-disk format (jsc#SLE-9807) OBS-URL: https://build.opensuse.org/request/show/841483 OBS-URL: https://build.opensuse.org/package/show/filesystems/bcache-tools?expand=0&rev=27
2020-10-30 15:10:22 +01:00
From 33b90323056f65225c5b557d7f578b7f37abee3c Mon Sep 17 00:00:00 2001
From: Coly Li <colyli@suse.de>
Date: Sat, 16 May 2020 21:57:17 +0800
Subject: [PATCH 03/17] bcache-tools: convert writeback to writethrough mode
for zoned backing device
Git-commit: 33b90323056f65225c5b557d7f578b7f37abee3c
Patch-mainline: bcache-tools-1.1
References: jsc#SLE-9807
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>
---
make.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/make.c b/make.c
index c1090a6..cc76863 100644
--- a/make.c
+++ b/make.c
@@ -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\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;
--
2.26.2