From: Gao Xiang <xiang@kernel.org>
To: linux-erofs@lists.ozlabs.org
Cc: Gao Xiang <xiang@kernel.org>
Subject: [PATCH 4/8] erofs-utils: add big physical cluster definition
Date: Sun, 11 Apr 2021 11:48:40 +0800 [thread overview]
Message-ID: <20210411034844.12673-5-xiang@kernel.org> (raw)
In-Reply-To: <20210411034844.12673-1-xiang@kernel.org>
This keeps in sync with the kernel definition.
Signed-off-by: Gao Xiang <xiang@kernel.org>
---
include/erofs/internal.h | 1 +
include/erofs_fs.h | 25 ++++++++++++++++++++-----
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/include/erofs/internal.h b/include/erofs/internal.h
index 6e481faa8c9f..1339341a0792 100644
--- a/include/erofs/internal.h
+++ b/include/erofs/internal.h
@@ -108,6 +108,7 @@ static inline void erofs_sb_clear_##name(void) \
EROFS_FEATURE_FUNCS(lz4_0padding, incompat, INCOMPAT_LZ4_0PADDING)
EROFS_FEATURE_FUNCS(compr_cfgs, incompat, INCOMPAT_COMPR_CFGS)
+EROFS_FEATURE_FUNCS(big_pcluster, incompat, INCOMPAT_BIG_PCLUSTER)
EROFS_FEATURE_FUNCS(sb_chksum, compat, COMPAT_SB_CHKSUM)
#define EROFS_I_EA_INITED (1 << 0)
diff --git a/include/erofs_fs.h b/include/erofs_fs.h
index a24deb095537..52da7abaac92 100644
--- a/include/erofs_fs.h
+++ b/include/erofs_fs.h
@@ -21,9 +21,11 @@
*/
#define EROFS_FEATURE_INCOMPAT_LZ4_0PADDING 0x00000001
#define EROFS_FEATURE_INCOMPAT_COMPR_CFGS 0x00000002
+#define EROFS_FEATURE_INCOMPAT_BIG_PCLUSTER 0x00000002
#define EROFS_ALL_FEATURE_INCOMPAT \
(EROFS_FEATURE_INCOMPAT_LZ4_0PADDING | \
- EROFS_FEATURE_INCOMPAT_COMPR_CFGS)
+ EROFS_FEATURE_INCOMPAT_COMPR_CFGS | \
+ EROFS_FEATURE_INCOMPAT_BIG_PCLUSTER)
/* 128-byte erofs on-disk super block */
struct erofs_super_block {
@@ -199,6 +201,9 @@ static inline unsigned int erofs_xattr_entry_size(struct erofs_xattr_entry *e)
e->e_name_len + le16_to_cpu(e->e_value_size));
}
+/* maximum supported size of a physical compression cluster */
+#define Z_EROFS_PCLUSTER_MAX_SIZE (1024 * 1024)
+
/* available compression algorithm types (for h_algorithmtype) */
enum {
Z_EROFS_COMPRESSION_LZ4 = 0,
@@ -208,17 +213,20 @@ enum {
/* 14 bytes (+ length field = 16 bytes) */
struct z_erofs_lz4_cfgs {
__le16 max_distance;
- u8 reserved[12];
+ __le16 max_pclusterblks;
+ u8 reserved[10];
} __packed;
/*
* bit 0 : COMPACTED_2B indexes (0 - off; 1 - on)
* e.g. for 4k logical cluster size, 4B if compacted 2B is off;
* (4B) + 2B + (4B) if compacted 2B is on.
+ * bit 1 : HEAD1 big pcluster (0 - off; 1 - on)
+ * bit 2 : HEAD2 big pcluster (0 - off; 1 - on)
*/
-#define Z_EROFS_ADVISE_COMPACTED_2B_BIT 0
-
-#define Z_EROFS_ADVISE_COMPACTED_2B (1 << Z_EROFS_ADVISE_COMPACTED_2B_BIT)
+#define Z_EROFS_ADVISE_COMPACTED_2B 0x0001
+#define Z_EROFS_ADVISE_BIG_PCLUSTER_1 0x0002
+#define Z_EROFS_ADVISE_BIG_PCLUSTER_2 0x0004
struct z_erofs_map_header {
__le32 h_reserved1;
@@ -275,6 +283,13 @@ enum {
#define Z_EROFS_VLE_DI_CLUSTER_TYPE_BITS 2
#define Z_EROFS_VLE_DI_CLUSTER_TYPE_BIT 0
+/*
+ * D0_CBLKCNT will be marked _only_ at the 1st non-head lcluster to store the
+ * compressed block count of a compressed extent (in logical clusters, aka.
+ * block count of a pcluster).
+ */
+#define Z_EROFS_VLE_DI_D0_CBLKCNT (1 << 11)
+
struct z_erofs_vle_decompressed_index {
__le16 di_advise;
/* where to decompress in the head cluster */
--
2.20.1
next prev parent reply other threads:[~2021-04-11 3:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-11 3:48 [PATCH 0/8] erofs-utils: support big pcluster compression Gao Xiang
2021-04-11 3:48 ` [PATCH 1/8] erofs-utils: support adjust lz4 history window size Gao Xiang
2021-04-11 3:48 ` [PATCH 2/8] erofs-utils: introduce ondisk compression cfgs Gao Xiang
2021-04-11 3:48 ` [PATCH 3/8] erofs-utils: add -C# for the maximum size of pclusters Gao Xiang
2021-04-11 3:48 ` Gao Xiang [this message]
2021-04-11 3:48 ` [PATCH 5/8] erofs-utils: fuse: support multiple block compression Gao Xiang
2021-04-11 3:48 ` [PATCH 6/8] erofs-utils: mkfs: " Gao Xiang
2021-04-11 3:48 ` [PATCH 7/8] erofs-utils: fuse: support compact indexes for bigpcluster Gao Xiang
2021-04-11 3:48 ` [PATCH 8/8] erofs-utils: mkfs: " Gao Xiang
2021-04-15 3:27 ` [PATCH v1.1 1/8] erofs-utils: support adjust lz4 history window size 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=20210411034844.12673-5-xiang@kernel.org \
--to=xiang@kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
/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