On Tue, 11 Aug 2020 15:29:51 +0200 Thomas Petazzoni <thomas.petazz...@bootlin.com> wrote:
> On Tue, 11 Aug 2020 15:17:55 +0200 > Joao Marcos Costa <joaomarcos.co...@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 ? Yes, 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. Sure, it can be done. I will prepare a v2 addressing your suggestion. Thanks! > Best regards, > > Thomas Best regards, Joao