From: Gao Xiang Date: Tue, 18 Sep 2018 14:27:26 +0000 (+0800) Subject: staging: erofs: avoid magic constants when initializing clusterbits X-Git-Tag: microblaze-v5.0-rc1~82^2~340 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=6bec52047f56d44d26d076a408a1bf60b58c91fa;p=linux-2.6-microblaze.git staging: erofs: avoid magic constants when initializing clusterbits Currently erofs only supports clustersize == blocksize. and clustersize == 2^n * blocksize will be supported in the future. Reviewed-by: Chao Yu Signed-off-by: Gao Xiang Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c index 1ed846f38957..802202ca7213 100644 --- a/drivers/staging/erofs/super.c +++ b/drivers/staging/erofs/super.c @@ -116,9 +116,10 @@ static int superblock_read(struct super_block *sb) #endif sbi->islotbits = ffs(sizeof(struct erofs_inode_v1)) - 1; #ifdef CONFIG_EROFS_FS_ZIP - sbi->clusterbits = 12; + /* TODO: clusterbits should be related to inode */ + sbi->clusterbits = blkszbits; - if (1 << (sbi->clusterbits - 12) > Z_EROFS_CLUSTER_MAX_PAGES) + if (1 << (sbi->clusterbits - PAGE_SHIFT) > Z_EROFS_CLUSTER_MAX_PAGES) errln("clusterbits %u is not supported on this kernel", sbi->clusterbits); #endif