bcache-tools/0025-bcache-tools-recover-the-missing-sb.csum-for-showing.patch
Jan Engelhardt 78695432ff Accepting request 860492 from home:colyli:branches:filesystems
- bcache.h: fix typo from SUUP to SUPP (jsc#SLE-9807)
  0019-bcache.h-fix-typo-from-SUUP-to-SUPP.patch
- bcache-tools: only call set_bucket_size() for cache device
  (jsc#SLE-9807)
  0020-bcache-tools-only-call-set_bucket_size-for-cache-dev.patch
- bcache.h: add BCH_FEATURE_INCOMPAT_LARGE_BUCKET to
  BCH_FEATURE_INCOMPAT_SUPP (jsc#SLE-9807)
  0021-bcache.h-add-BCH_FEATURE_INCOMPAT_LARGE_BUCKET-to-BC.patch
- bcache-tools: check incompatible feature set (jsc#SLE-9807)
  0022-bcache-tools-check-incompatible-feature-set.patch
- bcache-tools: introduce BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE
  for large bucket (jsc#SLE-9807)
  0023-bcache-tools-introduce-BCH_FEATURE_INCOMPAT_LOG_LARG.patch
- bcache-tools: display obsoleted bucket size configuration
  (jsc#SLE-9807)
  0024-bcache-tools-display-obsoleted-bucket-size-configura.patch
- bcache-tools: recover the missing sb.csum for showing bcache device
  super block (jsc#SLE-9807)
  0025-bcache-tools-recover-the-missing-sb.csum-for-showing.patch
- bcache-tools: only call to_cache_sb() for bcache device
  in may_add_item() (jsc#SLE-9807)
  0026-bcache-tools-only-call-to_cache_sb-for-bcache-device.patch
- bcache-tools: improve column alignment for "bcache show
  -m" output (jsc#SLE-9807)
  0027-bcache-tools-improve-column-alignment-for-bcache-sho.patch

OBS-URL: https://build.opensuse.org/request/show/860492
OBS-URL: https://build.opensuse.org/package/show/filesystems/bcache-tools?expand=0&rev=31
2021-01-05 15:18:42 +00:00

53 lines
2.0 KiB
Diff

From 0c6e42ef568cece1c041fea5dcd0178d403b517b Mon Sep 17 00:00:00 2001
From: Coly Li <colyli@suse.de>
Date: Sun, 3 Jan 2021 23:35:50 +0800
Subject: [PATCH 7/9] bcache-tools: recover the missing sb.csum for showing
bcache device super block
Git-commit: 0c6e42ef568cece1c041fea5dcd0178d403b517b
References: jsc#SLE-9807
Commit 2891723d7075 ("bcache-tools: define separated super block for
in-memory and on-disk format") does following change in detail_base(),
strcpy(base->name, devname);
base->magic = "ok";
base->first_sector = SB_SECTOR;
- base->csum = sb.csum;
base->version = sb.version;
because sb (in type struct cache_sb) doesn't have csum of the on-disk
super block anymore. The aftermath is base.csum was missing, and the
"show" command always display sb.csum as 0.
This patch recovers the csum value setting for base.csum, then command
"bcache show -d" may display the correct super block check sum.
Fixes: 2891723d7075 ("bcache-tools: define separated super block for in-memory and on-disk format")
Signed-off-by: Coly Li <colyli@suse.de>
---
lib.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib.c b/lib.c
index b005eb5..340ddf3 100644
--- a/lib.c
+++ b/lib.c
@@ -487,6 +487,7 @@ int detail_dev(char *devname, struct bdev *bd, struct cdev *cd, int *type)
sb.version == BCACHE_SB_VERSION_BDEV_WITH_OFFSET ||
sb.version == BCACHE_SB_VERSION_BDEV_WITH_FEATURES) {
detail_base(devname, sb, &bd->base);
+ bd->base.csum = expected_csum;
bd->first_sector = BDEV_DATA_START_DEFAULT;
bd->cache_mode = BDEV_CACHE_MODE(&sb);
bd->cache_state = BDEV_STATE(&sb);
@@ -494,6 +495,7 @@ int detail_dev(char *devname, struct bdev *bd, struct cdev *cd, int *type)
sb.version == BCACHE_SB_VERSION_CDEV_WITH_UUID ||
sb.version == BCACHE_SB_VERSION_CDEV_WITH_FEATURES) {
detail_base(devname, sb, &cd->base);
+ cd->base.csum = expected_csum;
cd->first_sector = sb.bucket_size * sb.first_bucket;
cd->cache_sectors =
sb.bucket_size * (sb.nbuckets - sb.first_bucket);
--
2.26.2