1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
David Teigland 2018-02-27 12:35:45 -06:00
parent e49b114f7e
commit 21057676a1

View File

@ -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;
}