
11 Aug
2020
11 Aug
'20
3:29 p.m.
On Tue, 11 Aug 2020 15:17:55 +0200 Joao Marcos Costa joaomarcos.costa@bootlin.com wrote:
+#if IS_ENABLED(CONFIG_ZSTD) +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} function.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com