From: Gao Xiang <xiang@kernel.org>
To: linux-erofs@lists.ozlabs.org, Chao Yu <yuchao0@huawei.com>,
Chao Yu <chao@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH v2 06/10] erofs: adjust per-CPU buffers according to max_pclusterblks
Date: Thu, 1 Apr 2021 11:29:50 +0800 [thread overview]
Message-ID: <20210401032954.20555-7-xiang@kernel.org> (raw)
In-Reply-To: <20210401032954.20555-1-xiang@kernel.org>
From: Gao Xiang <hsiangkao@redhat.com>
Adjust per-CPU buffers on demand since big pcluster definition is
available. Also, bail out unsupported pcluster size according to
Z_EROFS_PCLUSTER_MAX_SIZE.
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
---
fs/erofs/decompressor.c | 16 ++++++++++++----
fs/erofs/internal.h | 2 ++
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c
index fb4838c0f0df..5d9f9dbd3681 100644
--- a/fs/erofs/decompressor.c
+++ b/fs/erofs/decompressor.c
@@ -32,6 +32,7 @@ int z_erofs_load_lz4_config(struct super_block *sb,
struct erofs_super_block *dsb,
struct z_erofs_lz4_cfgs *lz4, int size)
{
+ struct erofs_sb_info *sbi = EROFS_SB(sb);
u16 distance;
if (lz4) {
@@ -40,16 +41,23 @@ int z_erofs_load_lz4_config(struct super_block *sb,
return -EINVAL;
}
distance = le16_to_cpu(lz4->max_distance);
+
+ sbi->lz4.max_pclusterblks = le16_to_cpu(lz4->max_pclusterblks);
+ if (sbi->lz4.max_pclusterblks >
+ Z_EROFS_PCLUSTER_MAX_SIZE / EROFS_BLKSIZ) {
+ erofs_err(sb, "too large lz4 pcluster blocks %u",
+ sbi->lz4.max_pclusterblks);
+ return -EINVAL;
+ }
} else {
distance = le16_to_cpu(dsb->u1.lz4_max_distance);
+ sbi->lz4.max_pclusterblks = 1;
}
- EROFS_SB(sb)->lz4.max_distance_pages = distance ?
+ sbi->lz4.max_distance_pages = distance ?
DIV_ROUND_UP(distance, PAGE_SIZE) + 1 :
LZ4_MAX_DISTANCE_PAGES;
-
- /* TODO: use max pclusterblks after bigpcluster is enabled */
- return erofs_pcpubuf_growsize(1);
+ return erofs_pcpubuf_growsize(sbi->lz4.max_pclusterblks);
}
static int z_erofs_lz4_prepare_destpages(struct z_erofs_decompress_req *rq,
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index c4b3938a7e56..f1305af50f67 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -63,6 +63,8 @@ struct erofs_fs_context {
struct erofs_sb_lz4_info {
/* # of pages needed for EROFS lz4 rolling decompression */
u16 max_distance_pages;
+ /* maximum possible blocks for pclusters in the filesystem */
+ u16 max_pclusterblks;
};
struct erofs_sb_info {
--
2.20.1
next prev parent reply other threads:[~2021-04-01 3:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 3:29 [PATCH v2 00/10] erofs: add big pcluster compression support Gao Xiang
2021-04-01 3:29 ` [PATCH v2 01/10] erofs: reserve physical_clusterbits[] Gao Xiang
2021-04-01 3:29 ` [PATCH v2 02/10] erofs: introduce multipage per-CPU buffers Gao Xiang
2021-04-01 3:29 ` [PATCH v2 03/10] erofs: introduce physical cluster slab pools Gao Xiang
2021-04-01 3:29 ` [PATCH v2 04/10] erofs: fix up inplace I/O pointer for big pcluster Gao Xiang
2021-04-01 3:29 ` [PATCH v2 05/10] erofs: add big physical cluster definition Gao Xiang
2021-04-01 3:29 ` Gao Xiang [this message]
2021-04-01 3:29 ` [PATCH v2 07/10] erofs: support parsing big pcluster compress indexes Gao Xiang
2021-04-01 3:29 ` [PATCH v2 08/10] erofs: support parsing big pcluster compact indexes Gao Xiang
2021-04-01 3:29 ` [PATCH v2 09/10] erofs: support decompress big pcluster for lz4 backend Gao Xiang
2021-04-01 3:29 ` [PATCH v2 10/10] erofs: enable big pcluster feature Gao Xiang
2021-04-03 3:17 ` [PATCH v2 00/10] erofs: add big pcluster compression support Gao Xiang
2021-04-03 3:52 ` Chao Yu
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=20210401032954.20555-7-xiang@kernel.org \
--to=xiang@kernel.org \
--cc=chao@kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yuchao0@huawei.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;
as well as URLs for NNTP newsgroup(s).