[PATCH v6 1/3] erofs: rename lz4_0pading to zero_padding
Huang Jianan
jnhuang95 at gmail.com
Sat Nov 13 03:09:33 AEDT 2021
From: Huang Jianan <huangjianan at oppo.com>
Renaming lz4_0padding to zero_padding globally since LZMA and later
algorithms also need that.
Signed-off-by: Huang Jianan <huangjianan at oppo.com>
---
fs/erofs/decompressor.c | 18 +++++++++---------
fs/erofs/erofs_fs.h | 4 ++--
fs/erofs/internal.h | 2 +-
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c
index bf37fc76b182..3c848422a9ca 100644
--- a/fs/erofs/decompressor.c
+++ b/fs/erofs/decompressor.c
@@ -114,7 +114,7 @@ static int z_erofs_lz4_prepare_dstpages(struct z_erofs_decompress_req *rq,
static void *z_erofs_lz4_handle_inplace_io(struct z_erofs_decompress_req *rq,
void *inpage, unsigned int *inputmargin, int *maptype,
- bool support_0padding)
+ bool support_zero_padding)
{
unsigned int nrpages_in, nrpages_out;
unsigned int ofull, oend, inputsize, total, i, j;
@@ -128,7 +128,7 @@ static void *z_erofs_lz4_handle_inplace_io(struct z_erofs_decompress_req *rq,
nrpages_out = ofull >> PAGE_SHIFT;
if (rq->inplace_io) {
- if (rq->partial_decoding || !support_0padding ||
+ if (rq->partial_decoding || !support_zero_padding ||
ofull - oend < LZ4_DECOMPRESS_INPLACE_MARGIN(inputsize))
goto docopy;
@@ -187,17 +187,17 @@ static int z_erofs_lz4_decompress_mem(struct z_erofs_decompress_req *rq,
{
unsigned int inputmargin;
u8 *headpage, *src;
- bool support_0padding;
+ bool support_zero_padding;
int ret, maptype;
DBG_BUGON(*rq->in == NULL);
headpage = kmap_atomic(*rq->in);
inputmargin = 0;
- support_0padding = false;
+ support_zero_padding = false;
- /* decompression inplace is only safe when 0padding is enabled */
- if (erofs_sb_has_lz4_0padding(EROFS_SB(rq->sb))) {
- support_0padding = true;
+ /* decompression inplace is only safe when zero_padding is enabled */
+ if (erofs_sb_has_zero_padding(EROFS_SB(rq->sb))) {
+ support_zero_padding = true;
while (!headpage[inputmargin & ~PAGE_MASK])
if (!(++inputmargin & ~PAGE_MASK))
@@ -211,12 +211,12 @@ static int z_erofs_lz4_decompress_mem(struct z_erofs_decompress_req *rq,
rq->inputsize -= inputmargin;
src = z_erofs_lz4_handle_inplace_io(rq, headpage, &inputmargin,
- &maptype, support_0padding);
+ &maptype, support_zero_padding);
if (IS_ERR(src))
return PTR_ERR(src);
/* legacy format could compress extra data in a pcluster. */
- if (rq->partial_decoding || !support_0padding)
+ if (rq->partial_decoding || !support_zero_padding)
ret = LZ4_decompress_safe_partial(src + inputmargin, out,
rq->inputsize, rq->outputsize, rq->outputsize);
else
diff --git a/fs/erofs/erofs_fs.h b/fs/erofs/erofs_fs.h
index 083997a034e5..f4506a642a12 100644
--- a/fs/erofs/erofs_fs.h
+++ b/fs/erofs/erofs_fs.h
@@ -17,14 +17,14 @@
* Any bits that aren't in EROFS_ALL_FEATURE_INCOMPAT should
* be incompatible with this kernel version.
*/
-#define EROFS_FEATURE_INCOMPAT_LZ4_0PADDING 0x00000001
+#define EROFS_FEATURE_INCOMPAT_ZERO_PADDING 0x00000001
#define EROFS_FEATURE_INCOMPAT_COMPR_CFGS 0x00000002
#define EROFS_FEATURE_INCOMPAT_BIG_PCLUSTER 0x00000002
#define EROFS_FEATURE_INCOMPAT_CHUNKED_FILE 0x00000004
#define EROFS_FEATURE_INCOMPAT_DEVICE_TABLE 0x00000008
#define EROFS_FEATURE_INCOMPAT_COMPR_HEAD2 0x00000008
#define EROFS_ALL_FEATURE_INCOMPAT \
- (EROFS_FEATURE_INCOMPAT_LZ4_0PADDING | \
+ (EROFS_FEATURE_INCOMPAT_ZERO_PADDING | \
EROFS_FEATURE_INCOMPAT_COMPR_CFGS | \
EROFS_FEATURE_INCOMPAT_BIG_PCLUSTER | \
EROFS_FEATURE_INCOMPAT_CHUNKED_FILE | \
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index 3265688af7f9..273754e7b340 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -258,7 +258,7 @@ static inline bool erofs_sb_has_##name(struct erofs_sb_info *sbi) \
return sbi->feature_##compat & EROFS_FEATURE_##feature; \
}
-EROFS_FEATURE_FUNCS(lz4_0padding, incompat, INCOMPAT_LZ4_0PADDING)
+EROFS_FEATURE_FUNCS(zero_padding, incompat, INCOMPAT_ZERO_PADDING)
EROFS_FEATURE_FUNCS(compr_cfgs, incompat, INCOMPAT_COMPR_CFGS)
EROFS_FEATURE_FUNCS(big_pcluster, incompat, INCOMPAT_BIG_PCLUSTER)
EROFS_FEATURE_FUNCS(device_table, incompat, INCOMPAT_DEVICE_TABLE)
--
2.25.1
More information about the Linux-erofs
mailing list