staging: erofs: avoid magic constants when initializing clusterbits
authorGao Xiang <gaoxiang25@huawei.com>
Tue, 18 Sep 2018 14:27:26 +0000 (22:27 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Sep 2018 14:35:03 +0000 (16:35 +0200)
Currently erofs only supports clustersize == blocksize.
and clustersize == 2^n * blocksize will be supported in the future.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/erofs/super.c

index 1ed846f..802202c 100644 (file)
@@ -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