[PATCH 2/2] erofs: replace global decompressors[] with stack memory
Yue Hu
zbestahu at gmail.com
Wed Apr 26 14:10:27 AEST 2023
From: Yue Hu <huyue2 at coolpad.com>
Note that only z_erofs_decompress() is using the decompressors[], so no
need to keep it as global resource, just use local one instead.
Signed-off-by: Yue Hu <huyue2 at coolpad.com>
---
fs/erofs/decompressor.c | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c
index f416ebd6f0dc..91d91bdd068f 100644
--- a/fs/erofs/decompressor.c
+++ b/fs/erofs/decompressor.c
@@ -368,25 +368,24 @@ struct z_erofs_decompressor {
struct page **pagepool);
};
-static struct z_erofs_decompressor decompressors[] = {
- [Z_EROFS_COMPRESSION_SHIFTED] = {
- .decompress = z_erofs_transform_plain,
- },
- [Z_EROFS_COMPRESSION_INTERLACED] = {
- .decompress = z_erofs_transform_plain,
- },
- [Z_EROFS_COMPRESSION_LZ4] = {
- .decompress = z_erofs_lz4_decompress,
- },
-#ifdef CONFIG_EROFS_FS_ZIP_LZMA
- [Z_EROFS_COMPRESSION_LZMA] = {
- .decompress = z_erofs_lzma_decompress,
- },
-#endif
-};
-
int z_erofs_decompress(struct z_erofs_decompress_req *rq,
struct page **pagepool)
{
+ struct z_erofs_decompressor decompressors[] = {
+ [Z_EROFS_COMPRESSION_SHIFTED] = {
+ .decompress = z_erofs_transform_plain,
+ },
+ [Z_EROFS_COMPRESSION_INTERLACED] = {
+ .decompress = z_erofs_transform_plain,
+ },
+ [Z_EROFS_COMPRESSION_LZ4] = {
+ .decompress = z_erofs_lz4_decompress,
+ },
+#ifdef CONFIG_EROFS_FS_ZIP_LZMA
+ [Z_EROFS_COMPRESSION_LZMA] = {
+ .decompress = z_erofs_lzma_decompress,
+ },
+#endif
+ };
return decompressors[rq->alg].decompress(rq, pagepool);
}
--
2.17.1
More information about the Linux-erofs
mailing list