#include "erofs/workqueue.h"
#endif
+#define Z_EROFS_DESTBUF_SZ (Z_EROFS_PCLUSTER_MAX_SIZE + EROFS_MAX_BLOCK_SIZE * 2)
+
/* compressing configuration specified by users */
struct erofs_compress_cfg {
struct erofs_compress handle;
static int __z_erofs_compress_one(struct z_erofs_compress_sctx *ctx,
struct z_erofs_inmem_extent *e)
{
- static char g_dstbuf[EROFS_CONFIG_COMPR_MAX_SZ + EROFS_MAX_BLOCK_SIZE];
+ static char g_dstbuf[Z_EROFS_DESTBUF_SZ];
char *dstbuf = ctx->destbuf ?: g_dstbuf;
struct z_erofs_compress_ictx *ictx = ctx->ictx;
struct erofs_inode *inode = ictx->inode;
if (!tls->queue)
goto err_free_priv;
- tls->destbuf = calloc(1, EROFS_CONFIG_COMPR_MAX_SZ +
- EROFS_MAX_BLOCK_SIZE);
+ tls->destbuf = calloc(1, Z_EROFS_DESTBUF_SZ);
if (!tls->destbuf)
goto err_free_queue;
goto out;
sctx->pclustersize = z_erofs_get_max_pclustersize(inode);
+ DBG_BUGON(sctx->pclustersize > Z_EROFS_PCLUSTER_MAX_SIZE);
sctx->queue = tls->queue;
sctx->destbuf = tls->destbuf;
sctx->chandle = &tls->ccfg[cwork->alg_id].handle;