erofs-utils: Relax the hardchecks on the blocksize
authorSandeep Dhavale <dhavale@google.com>
Wed, 30 Aug 2023 23:16:05 +0000 (16:16 -0700)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 31 Aug 2023 14:46:00 +0000 (22:46 +0800)
As erofs-utils supports different block sizes upto
EROFS_MAX_BLOCK_SIZE, relax the checks so same tools
can be used to create images for platforms where
page size can be greater than 4096.

Signed-off-by: Sandeep Dhavale <dhavale@google.com>
Link: https://lore.kernel.org/r/20230830231606.3783734-1-dhavale@google.com
[ Gao Xiang: refine the warning message. ]
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
lib/namei.c
mkfs/main.c

index 2bb1d4c764a5a1d1122b22f8f2bb24a34b162619..45dbcd35b3462e6eaf19a01741a670d9dbecbd0b 100644 (file)
@@ -144,8 +144,6 @@ int erofs_read_inode_from_disk(struct erofs_inode *vi)
                vi->u.chunkbits = sbi->blkszbits +
                        (vi->u.chunkformat & EROFS_CHUNK_FORMAT_BLKBITS_MASK);
        } else if (erofs_inode_is_data_compressed(vi->datalayout)) {
-               if (erofs_blksiz(vi->sbi) != EROFS_MAX_BLOCK_SIZE)
-                       return -EOPNOTSUPP;
                return z_erofs_fill_inode(vi);
        }
        return 0;
index 843a658d97797df9a7c518de43c4aaf03d6f53a3..7225c400f4889710b595d1df3e84692a5e17748b 100644 (file)
@@ -565,11 +565,12 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
                cfg.c_dbg_lvl = EROFS_ERR;
                cfg.c_showprogress = false;
        }
-       if (cfg.c_compr_alg[0] && erofs_blksiz(&sbi) != EROFS_MAX_BLOCK_SIZE) {
-               erofs_err("compression is unsupported for now with block size %u",
-                         erofs_blksiz(&sbi));
-               return -EINVAL;
-       }
+
+       if (cfg.c_compr_alg[0] && erofs_blksiz(&sbi) != getpagesize())
+               erofs_warn("Please note that subpage blocksize with compression isn't yet supported in kernel. "
+                          "This compressed image will only work with bs = ps = %u bytes",
+                          erofs_blksiz(&sbi));
+
        if (pclustersize_max) {
                if (pclustersize_max < erofs_blksiz(&sbi) ||
                    pclustersize_max % erofs_blksiz(&sbi)) {