The patch titled Subject: include/linux/lz4.h: add some missing macros has been added to the -mm mm-nonmm-unstable branch. Its filename is include-linux-lz4h-add-some-missing-macros.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/include-linux-lz4h-add-some-missing-macros.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx> Subject: include/linux/lz4.h: add some missing macros Date: Tue, 14 Jan 2025 21:04:54 +0800 Currently, LZ4_DISTANCE_MAX and LZ4_DECOMPRESS_INPLACE_MARGIN are defined in the erofs subsystem for LZ4 in-place decompression, which is somewhat unsuitable since they should belong to the LZ4 itself and may change with future LZ4 codebase updates. Move them to include/linux/lz4.h to match the upstream LZ4 library [1]. No logic changes. [1] https://github.com/lz4/lz4/blob/v1.10.0/lib/lz4.h#L670 Link: https://lkml.kernel.org/r/20250114130454.1191150-1-hsiangkao@xxxxxxxxxxxxxxxxx Signed-off-by: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx> Cc: Yann Collet <yann.collet.73@xxxxxxxxx> Cc: Nick Terrell <terrelln@xxxxxx> Cc: Chao Yu <chao@xxxxxxxxxx> Cc: Yue Hu <zbestahu@xxxxxxxxx> Cc; Jeffle Xu <jefflexu@xxxxxxxxxxxxxxxxx> Cc: Sandeep Dhavale <dhavale@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/erofs/decompressor.c | 7 ------- include/linux/lz4.h | 6 ++++++ lib/lz4/lz4_compress.c | 1 - lib/lz4/lz4_decompress.c | 1 - lib/lz4/lz4defs.h | 4 ++-- lib/lz4/lz4hc_compress.c | 1 - 6 files changed, 8 insertions(+), 12 deletions(-) --- a/fs/erofs/decompressor.c~include-linux-lz4h-add-some-missing-macros +++ a/fs/erofs/decompressor.c @@ -7,14 +7,7 @@ #include "compress.h" #include <linux/lz4.h> -#ifndef LZ4_DISTANCE_MAX /* history window size */ -#define LZ4_DISTANCE_MAX 65535 /* set to maximum value by default */ -#endif - #define LZ4_MAX_DISTANCE_PAGES (DIV_ROUND_UP(LZ4_DISTANCE_MAX, PAGE_SIZE) + 1) -#ifndef LZ4_DECOMPRESS_INPLACE_MARGIN -#define LZ4_DECOMPRESS_INPLACE_MARGIN(srcsize) (((srcsize) >> 8) + 32) -#endif struct z_erofs_lz4_decompress_ctx { struct z_erofs_decompress_req *rq; --- a/include/linux/lz4.h~include-linux-lz4h-add-some-missing-macros +++ a/include/linux/lz4.h @@ -645,4 +645,10 @@ int LZ4_decompress_safe_usingDict(const int LZ4_decompress_fast_usingDict(const char *source, char *dest, int originalSize, const char *dictStart, int dictSize); +#define LZ4_DECOMPRESS_INPLACE_MARGIN(compressedSize) (((compressedSize) >> 8) + 32) + +#ifndef LZ4_DISTANCE_MAX /* history window size; can be user-defined at compile time */ +#define LZ4_DISTANCE_MAX 65535 /* set to maximum value by default */ +#endif + #endif --- a/lib/lz4/lz4_compress.c~include-linux-lz4h-add-some-missing-macros +++ a/lib/lz4/lz4_compress.c @@ -33,7 +33,6 @@ /*-************************************ * Dependencies **************************************/ -#include <linux/lz4.h> #include "lz4defs.h" #include <linux/module.h> #include <linux/kernel.h> --- a/lib/lz4/lz4_decompress.c~include-linux-lz4h-add-some-missing-macros +++ a/lib/lz4/lz4_decompress.c @@ -33,7 +33,6 @@ /*-************************************ * Dependencies **************************************/ -#include <linux/lz4.h> #include "lz4defs.h" #include <linux/init.h> #include <linux/module.h> --- a/lib/lz4/lz4defs.h~include-linux-lz4h-add-some-missing-macros +++ a/lib/lz4/lz4defs.h @@ -39,6 +39,7 @@ #include <linux/bitops.h> #include <linux/string.h> /* memset, memcpy */ +#include <linux/lz4.h> #define FORCE_INLINE __always_inline @@ -92,8 +93,7 @@ typedef uintptr_t uptrval; #define MB (1 << 20) #define GB (1U << 30) -#define MAXD_LOG 16 -#define MAX_DISTANCE ((1 << MAXD_LOG) - 1) +#define MAX_DISTANCE LZ4_DISTANCE_MAX #define STEPSIZE sizeof(size_t) #define ML_BITS 4 --- a/lib/lz4/lz4hc_compress.c~include-linux-lz4h-add-some-missing-macros +++ a/lib/lz4/lz4hc_compress.c @@ -34,7 +34,6 @@ /*-************************************ * Dependencies **************************************/ -#include <linux/lz4.h> #include "lz4defs.h" #include <linux/module.h> #include <linux/kernel.h> _ Patches currently in -mm which might be from hsiangkao@xxxxxxxxxxxxxxxxx are include-linux-lz4h-add-some-missing-macros.patch