From: Yue Hu <zbestahu@gmail.com>
To: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org
Cc: jefflexu@linux.alibaba.com, huyue2@coolpad.com,
linux-kernel@vger.kernel.org, zhangwen@coolpad.com
Subject: [PATCH 2/2] erofs: replace global decompressors[] with stack memory
Date: Wed, 26 Apr 2023 12:10:27 +0800 [thread overview]
Message-ID: <e9d0a320fb45d74f1f602dd77f685d1bae59325c.1682481589.git.huyue2@coolpad.com> (raw)
In-Reply-To: <a0c8b87b5c165750107bbaad6b014c02311b610d.1682481589.git.huyue2@coolpad.com>
In-Reply-To: <a0c8b87b5c165750107bbaad6b014c02311b610d.1682481589.git.huyue2@coolpad.com>
From: Yue Hu <huyue2@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@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
next prev parent reply other threads:[~2023-04-26 4:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-26 4:10 [PATCH 1/2] erofs: get rid of name from struct z_erofs_decompressor Yue Hu
2023-04-26 4:10 ` Yue Hu [this message]
2023-04-26 6:08 ` Gao Xiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e9d0a320fb45d74f1f602dd77f685d1bae59325c.1682481589.git.huyue2@coolpad.com \
--to=zbestahu@gmail.com \
--cc=chao@kernel.org \
--cc=huyue2@coolpad.com \
--cc=jefflexu@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiang@kernel.org \
--cc=zhangwen@coolpad.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®