[lvm-devel] master - scan: create bcache with minimum number of blocks

David Teigland teigland at sourceware.org
Mon Apr 23 13:51:23 UTC 2018


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=21057676a1f01c6b1f19b2e879d8385d76adb517
Commit:        21057676a1f01c6b1f19b2e879d8385d76adb517
Parent:        e49b114f7e437666caefa04aada31f32820e286e
Author:        David Teigland <teigland at redhat.com>
AuthorDate:    Tue Feb 27 12:35:45 2018 -0600
Committer:     David Teigland <teigland at redhat.com>
CommitterDate: Fri Apr 20 11:22:47 2018 -0500

scan: create bcache with minimum number of blocks

In some odd cases (e.g. tests) there are very few devices
which results in creating too few blocks in bcache, so
create bcache with a minimum number of blocks.
---
 lib/label/label.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/label/label.c b/lib/label/label.c
index 45a3ecf..88001a9 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -560,13 +560,15 @@ static int _scan_list(struct dm_list *devs, int *failed)
 	return 1;
 }
 
+#define MIN_BCACHE_BLOCKS 32
+
 static int _setup_bcache(int cache_blocks)
 {
 	struct io_engine *ioe;
 
 	/* No devices can happen, just create bcache with any small number. */
-	if (!cache_blocks)
-		cache_blocks = 8;
+	if (cache_blocks < MIN_BCACHE_BLOCKS)
+		cache_blocks = MIN_BCACHE_BLOCKS;
 
 	/*
 	 * 100 is arbitrary, it's the max number of concurrent aio's
@@ -831,7 +833,7 @@ int label_read_sector(struct device *dev, struct label **labelp, uint64_t scan_s
 int label_scan_setup_bcache(void)
 {
 	if (!scan_bcache) {
-		if (!_setup_bcache(32))
+		if (!_setup_bcache(0))
 			return 0;
 	}
 




More information about the lvm-devel mailing list