[PATCH] bcache: fix nbuckets lower limit checking in read_super_common

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In fact due to this check in cache_alloc:
    free = roundup_pow_of_two(ca->sb.nbuckets) >> 10;
    if (!free) {
        ret = -EPERM;
        err = "ca->sb.nbuckets is too small";
        goto err_free;
    }
we can only create bcache device with nbuckets greater than 512,
so this patch is to make the codes logic consistent.

Signed-off-by: Lin Feng <linf@xxxxxxxxxx>
---
 drivers/md/bcache/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 7e9d19fd21dd..681a7ea442b9 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -110,7 +110,7 @@ static const char *read_super_common(struct cache_sb *sb,  struct block_device *
 		goto err;
 
 	err = "Not enough buckets";
-	if (sb->nbuckets < 1 << 7)
+	if (sb->nbuckets <= 1 << 9)
 		goto err;
 
 	err = "Bad block size (not power of 2)";
-- 
2.40.1




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux