From: Thomas Petazzoni Date: Tue, 11 Aug 2020 15:29:51 +0200 Subject: [PATCH 2/2] fs/squashfs: add support for ZSTD decompression In-Reply-To: <20200811131755.22396-3-joaomarcos.costa@bootlin.com> References: <20200811131755.22396-1-joaomarcos.costa@bootlin.com> <20200811131755.22396-3-joaomarcos.costa@bootlin.com> Message-ID: <20200811152951.29780dc1@windsurf.home> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, 11 Aug 2020 15:17:55 +0200 Joao Marcos Costa 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