[PATCH 2/2] fs/squashfs: add support for ZSTD decompression

Thomas Petazzoni thomas.petazzoni at bootlin.com
Tue Aug 11 15:29:51 CEST 2020

On Tue, 11 Aug 2020 15:17:55 +0200
Joao Marcos Costa <joaomarcos.costa at bootlin.com> wrote:

> +static int sqfs_zstd_decompress(void *dest, unsigned long dest_len,
> +				void *source, u32 src_len)
> +{
> +	void *workspace;
> +	ZSTD_DCtx *ctx;
> +	size_t wsize;
> +	int ret;
> +
> +	wsize = ZSTD_DCtxWorkspaceBound();

So apparently this "workspace" has a constant size, which does not
depend on the size of the input buffer. Correct ?

If that's the case, can we instead allocate it once for all in
sqfs_probe() if the filesystem is zstd-compressed ? I.e perhaps
sqfs_probe() could call a sqfs_decompressor_init() function,
implemented in sqfs_decompressor.c, which will do this sort of
initialization. And of course this memory area would be freed up in
sqfs_close(), calling a sqfs_decompressor_{deinit,cleanup,close}

Best regards,

Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering

More information about the U-Boot mailing list