aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColy Li <colyli@suse.de>2020-12-29 22:29:41 +0800
committerColy Li <colyli@suse.de>2021-01-02 00:21:22 +0800
commit287e2a743ccded3916a97a631855b1368427d6ab (patch)
tree585e08fabb9844719f7f2cd7600ff428b6c62e66
parentd5503bda96efdca8e2ebaa7b3d43845fda4b404d (diff)
downloadbcache-tools-287e2a743ccded3916a97a631855b1368427d6ab.tar.gz
bcache-tools: only call set_bucket_size() for cache device
It doesn't make sense to set bucket size for backing device, this patch moves set_bucket_size() into the code block for cache device only. Signed-off-by: Coly Li <colyli@suse.de>
-rw-r--r--make.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/make.c b/make.c
index ad893773..a3f97f6e 100644
--- a/make.c
+++ b/make.c
@@ -340,7 +340,6 @@ static void write_sb(char *dev, unsigned int block_size,
uuid_generate(sb.uuid);
memcpy(sb.set_uuid, set_uuid, sizeof(sb.set_uuid));
- set_bucket_size(&sb, bucket_size);
sb.block_size = block_size;
uuid_unparse(sb.uuid, uuid_str);
@@ -383,6 +382,8 @@ static void write_sb(char *dev, unsigned int block_size,
data_offset);
putchar('\n');
} else {
+ set_bucket_size(&sb, bucket_size);
+
sb.nbuckets = getblocks(fd) / sb.bucket_size;
sb.nr_in_set = 1;
/* 23 is (SB_SECTOR + SB_SIZE) - 1 sectors */