Compare commits

...

No commits in common. "c9s" and "c10s" have entirely different histories.
c9s ... c10s

5 changed files with 287 additions and 0 deletions

3
.gitignore vendored
View File

@ -0,0 +1,3 @@
/erofs-utils-1.7.1.tar.gz
/erofs-utils-1.8.2.tar.gz
/erofs-utils-1.8.4.tar.gz

View File

@ -0,0 +1,60 @@
From d55344291092b69a2ba6f11dbcda52fa534ac124 Mon Sep 17 00:00:00 2001
From: Alexander Egorenkov <egorenar@linux.ibm.com>
Date: Tue, 29 Apr 2025 09:30:52 +0200
Subject: erofs-utils: fix endiannes issue
Macros __BYTE_ORDER, __LITTLE_ENDIAN and __BIG_ENDIAN are defined in
user space header 'endian.h'. Not including this header results in
the condition #if __BYTE_ORDER == __LITTLE_ENDIAN being always true,
even on BE architectures (e.g. s390x). Due to this bug the compressor
library was built for LE byte-order on BE arch s390x.
Fixes: bc99c763e3fe ("erofs-utils: switch to effective unaligned access")
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Reviewed-by: Ian Kent <raven@themaw.net>
Reviewed-by: Hongbo Li <lihongbo22@huawei.com>
Link: https://lore.kernel.org/r/20250429073052.53681-1-egorenar@linux.ibm.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
configure.ac | 1 +
include/erofs/defs.h | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/configure.ac b/configure.ac
index 6e1e7a1..88f1cbe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -194,6 +194,7 @@ AC_ARG_WITH(selinux,
AC_CHECK_HEADERS(m4_flatten([
dirent.h
execinfo.h
+ endian.h
fcntl.h
getopt.h
inttypes.h
diff --git a/include/erofs/defs.h b/include/erofs/defs.h
index 051a270..21e0f09 100644
--- a/include/erofs/defs.h
+++ b/include/erofs/defs.h
@@ -24,6 +24,21 @@ extern "C"
#include <config.h>
#endif
+#ifdef HAVE_ENDIAN_H
+#include <endian.h>
+#else
+/* Use GNU C predefined macros as a fallback */
+#ifndef __BYTE_ORDER
+#define __BYTE_ORDER __BYTE_ORDER__
+#endif
+#ifndef __LITTLE_ENDIAN
+#define __LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
+#endif
+#ifndef __BIG_ENDIAN
+#define __BIG_ENDIAN __ORDER_BIG_ENDIAN__
+#endif
+#endif
+
#ifdef HAVE_LINUX_TYPES_H
#include <linux/types.h>
#endif

View File

@ -0,0 +1,102 @@
From 06875b3f2182eab24b81083dfde542f778b201cc Mon Sep 17 00:00:00 2001
From: Gao Xiang <hsiangkao@linux.alibaba.com>
Date: Fri, 3 Jan 2025 10:40:11 +0800
Subject: erofs-utils: mkfs: support `-Efragdedupe=inode`
If the entire inode can be deduplicated against an existing fragment,
simply reuse it.
Multi-threading can still be applied for `-Efragdedupe=inode` with
the current codebase:
Fedora Linux 39 (Workstation Edition) LiveCD results:
-zlzma,level=6,dictsize=131072 -C65536 -Eall-fragments
`-E^fragdedupe` 2,003,587,072 bytes (1911 MiB)
`-Efragdedupe=inode` 1,970,577,408 bytes (1880 MiB)
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20250103024011.198163-1-hsiangkao@linux.alibaba.com
---
include/erofs/config.h | 8 +++++++-
lib/compress.c | 9 +++++++--
mkfs/main.c | 13 ++++++++++---
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/include/erofs/config.h b/include/erofs/config.h
index 47e4d00..92c1467 100644
--- a/include/erofs/config.h
+++ b/include/erofs/config.h
@@ -33,6 +33,12 @@ enum {
TIMESTAMP_CLAMPING,
};
+enum {
+ FRAGDEDUPE_FULL,
+ FRAGDEDUPE_INODE,
+ FRAGDEDUPE_OFF,
+};
+
#define EROFS_MAX_COMPR_CFGS 64
struct erofs_compr_opts {
@@ -53,7 +59,7 @@ struct erofs_configure {
bool c_fragments;
bool c_all_fragments;
bool c_dedupe;
- bool c_nofragdedupe;
+ char c_fragdedupe;
bool c_ignore_mtime;
bool c_showprogress;
bool c_extra_ea_name_prefixes;
diff --git a/lib/compress.c b/lib/compress.c
index 0e8faad..20ab208 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -1527,12 +1527,17 @@ void *erofs_begin_compressed_file(struct erofs_inode *inode, int fd, u64 fpos)
* parts into the packed inode.
*/
if (cfg.c_fragments && !erofs_is_packed_inode(inode) &&
- !cfg.c_nofragdedupe) {
+ cfg.c_fragdedupe != FRAGDEDUPE_OFF) {
ret = z_erofs_fragments_dedupe(inode, fd, &ictx->tof_chksum);
if (ret < 0)
goto err_free_ictx;
- }
+ if (cfg.c_fragdedupe == FRAGDEDUPE_INODE &&
+ inode->fragment_size < inode->i_size) {
+ erofs_dbg("Discard the sub-inode tail fragment @ nid %llu", inode->nid);
+ inode->fragment_size = 0;
+ }
+ }
ictx->inode = inode;
ictx->fpos = fpos;
init_list_head(&ictx->extents);
diff --git a/mkfs/main.c b/mkfs/main.c
index 3f74fa2..0f6a32b 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -306,9 +306,16 @@ static int erofs_mkfs_feat_set_dedupe(bool en, const char *val,
static int erofs_mkfs_feat_set_fragdedupe(bool en, const char *val,
unsigned int vallen)
{
- if (vallen)
- return -EINVAL;
- cfg.c_nofragdedupe = !en;
+ if (!en) {
+ if (vallen)
+ return -EINVAL;
+ cfg.c_fragdedupe = FRAGDEDUPE_OFF;
+ } else if (vallen == sizeof("inode") - 1 &&
+ !memcmp(val, "inode", vallen)) {
+ cfg.c_fragdedupe = FRAGDEDUPE_INODE;
+ } else {
+ cfg.c_fragdedupe = FRAGDEDUPE_FULL;
+ }
return 0;
}
--
cgit 1.2.3-korg

121
erofs-utils.spec Normal file
View File

@ -0,0 +1,121 @@
%bcond deflate %[ 0%{?fedora} >= 34 || (0%{?rhel} >= 8 && 0%{?rhel} <= 9) ]
%bcond fuse 1
%bcond lz4 %[ 0%{?fedora} >= 34 || 0%{?rhel} >= 9 ]
%bcond lzma %[ 0%{?fedora} >= 36 || 0%{?rhel} >= 10 ]
%bcond qpl %[ 0%{?fedora} >= 41 && "%{_arch}" == "x86_64" ]
%bcond selinux 1
%bcond uuid 1
%bcond xxhash %[ 0%{?fedora} || (0%{?rhel} >= 9 && 0%{?rhel} < 10) ]
%bcond zlib 1
%bcond zstd 1
Name: erofs-utils
Version: 1.8.4
Release: 3%{?dist}
Summary: Utilities for working with EROFS
License: GPL-2.0-only AND GPL-2.0-or-later AND (GPL-2.0-only OR Apache-2.0) AND (GPL-2.0-or-later OR Apache-2.0) AND (GPL-2.0-only OR BSD-2-Clause) AND (GPL-2.0-or-later OR BSD-2-Clause) AND Unlicense
URL: https://erofs.docs.kernel.org/
Source: https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/snapshot/%{name}-%{version}.tar.gz
Patch: https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/patch/?id=06875b3f2182eab24b81083dfde542f778b201cc#/%{name}-1.8.4-fragdedupe-inode-support.patch
Patch: https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/patch/?id=d55344291092b69a2ba6f11dbcda52fa534ac124#/%{name}-1.8.4-fix-endianness-issue.patch
BuildRequires: %[ "%{toolchain}" == "clang" ? "clang compiler-rt" : "gcc" ]
BuildRequires: libtool
BuildRequires: make
%{?with_deflate:BuildRequires: pkgconfig(libdeflate)}
%{?with_fuse:BuildRequires: pkgconfig(fuse3) >= 3.2}
%{?with_lz4:BuildRequires: pkgconfig(liblz4) >= 1.9.3}
%{?with_lzma:BuildRequires: pkgconfig(liblzma) >= 5.4}
%{?with_qpl:BuildRequires: pkgconfig(qpl) >= 1.5.0}
%{?with_selinux:BuildRequires: pkgconfig(libselinux)}
%{?with_uuid:BuildRequires: pkgconfig(uuid)}
%{?with_xxhash:BuildRequires: pkgconfig(libxxhash)}
%{?with_zlib:BuildRequires: pkgconfig(zlib)}
%{?with_zstd:BuildRequires: pkgconfig(libzstd) >= 1.4.0}
%description
EROFS stands for Enhanced Read-Only File System. It aims to be a general
read-only file system solution for various use cases instead of just focusing
on saving storage space without considering runtime performance.
This package includes tools to create, check, and extract EROFS images.
%if %{with fuse}
%package -n erofs-fuse
Summary: FUSE support for mounting EROFS images
Requires: fuse3
%description -n erofs-fuse
EROFS stands for Enhanced Read-Only File System. It aims to be a general
read-only file system solution for various use cases instead of just focusing
on saving storage space without considering runtime performance.
This package includes erofsfuse to mount EROFS images.
%endif
%prep
%autosetup -p1
%build
autoreconf -fi
%configure \
--enable-multithreading \
--%{?with_deflate:with}%{!?with_deflate:without}-libdeflate \
--%{?with_fuse:enable}%{!?with_fuse:disable}-fuse \
--%{?with_lz4:enable}%{!?with_lz4:disable}-lz4 \
--%{?with_lzma:enable}%{!?with_lzma:disable}-lzma \
--%{?with_qpl:with}%{!?with_qpl:without}-qpl \
--%{?with_selinux:with}%{!?with_selinux:without}-selinux \
--%{?with_uuid:with}%{!?with_uuid:without}-uuid \
--%{?with_xxhash:with}%{!?with_xxhash:without}-xxhash \
--%{?with_zlib:with}%{!?with_zlib:without}-zlib \
--%{?with_zstd:with}%{!?with_zstd:without}-libzstd
%make_build
%install
%make_install
%files
%{_bindir}/dump.erofs
%{_bindir}/fsck.erofs
%{_bindir}/mkfs.erofs
%{_mandir}/man1/dump.erofs.1*
%{_mandir}/man1/fsck.erofs.1*
%{_mandir}/man1/mkfs.erofs.1*
%doc AUTHORS ChangeLog README docs/PERFORMANCE.md docs/compress-hints.example
%license LICENSES/Apache-2.0 LICENSES/GPL-2.0
%if %{with fuse}
%files -n erofs-fuse
%{_bindir}/erofsfuse
%{_mandir}/man1/erofsfuse.1*
%doc AUTHORS ChangeLog README
%license LICENSES/Apache-2.0 LICENSES/GPL-2.0
%endif
%changelog
* Mon May 05 2025 Abhi Das <adas@redhat.com> - 1.8.4-3
- erofs-utils: fix endianness issue
Resolves: RHEL-86463
* Thu Jan 02 2025 Neal Gompa <ngompa@centosproject.org> - 1.8.4-2
- Rebase to 1.8.4-2 for performance and compression fixes
Resolves: RHEL-72588
* Wed Nov 20 2024 Abhi Das <adas@redhat.com> - 1.8.2-2
- Rebase to 1.8.2-2 for zstd and multithreading support and
Remove erroneously added gating.yaml
Resolves: RHEL-68370
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.7.1-5
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Wed Jul 17 2024 Abhi Das <adas@redhat.com> - 1.7.1-4
- Import 1.7.1 to RHEL

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (erofs-utils-1.8.4.tar.gz) = c941b0a2ab6c650a9aa4c9cadeb277ebc87007dc51354ff013c7cb763e6e8c9d44ed9e4791730ed05088faaba8c612198b924e70f5e52019382cfdf6d2e6b677