[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <e9d0a320fb45d74f1f602dd77f685d1bae59325c.1682481589.git.huyue2@coolpad.com>
Date: Wed, 26 Apr 2023 12:10:27 +0800
From: Yue Hu <zbestahu@...il.com>
To: xiang@...nel.org, chao@...nel.org, linux-erofs@...ts.ozlabs.org
Cc: jefflexu@...ux.alibaba.com, huyue2@...lpad.com,
linux-kernel@...r.kernel.org, zhangwen@...lpad.com
Subject: [PATCH 2/2] erofs: replace global decompressors[] with stack memory
From: Yue Hu <huyue2@...lpad.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@...lpad.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
Powered by blists - more mailing lists