Skip to content

Commit

Permalink
feat: update erofs-utils to 1.8.3
Browse files Browse the repository at this point in the history
Utilities for EROFS File System

Issue: deepin-community/sig-deepin-sysdev-team#558
Log: update repo
  • Loading branch information
xzl01 committed Jan 15, 2025
1 parent ab0e7ab commit 189981c
Show file tree
Hide file tree
Showing 24 changed files with 253 additions and 223 deletions.
17 changes: 17 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
erofs-utils 1.8.3

* Another maintenance release includes the following fixes:
- (mkfs.erofs) Fix multi-threaded compression with `-Eall-fragments`;
- (mkfs.erofs) Fix large chunk-based image generation;
- (mkfs.erofs) Avoid large arrays on the stack (Jianan Huang);
- (mkfs.erofs) Fix PAX format parsing in headerball mode (Mike Baynton);
- (mkfs.erofs) Several fixes for incremental builds (Hongzhen Luo);
- (mkfs.erofs) Fix reproducible builds due to `i_ino` (Jooyung Han);
- Use pkg-config for liblz4 configuration;
- Get rid of pthread_cancel() dependencies;
- (mkfs.erofs) Add `-U <clear|random>` support;
- (mkfs.erofs) Add `--hard-dereference` for NixOS reproducibility (Paul Meyer);
- Several minor random fixes.

-- Gao Xiang <[email protected]> Sat, 14 Dec 2024 00:00:00 +0800

erofs-utils 1.8.2

* Another maintenance release includes the following fixes:
Expand Down
4 changes: 2 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1.8.2
2024-09-24
1.8.3
2024-12-14
71 changes: 25 additions & 46 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ AC_ARG_ENABLE([fuzzing],
[enable_fuzzing="no"])

AC_ARG_ENABLE(lz4,
[AS_HELP_STRING([--disable-lz4], [disable LZ4 compression support @<:@default=enabled@:>@])],
[enable_lz4="$enableval"], [enable_lz4="yes"])
[AS_HELP_STRING([--disable-lz4], [disable LZ4 compression support @<:@default=auto@:>@])],
[enable_lz4="$enableval"])

AC_ARG_ENABLE(lzma,
[AS_HELP_STRING([--disable-lzma], [disable LZMA compression support @<:@default=auto@:>@])],
Expand Down Expand Up @@ -172,17 +172,6 @@ AC_ARG_WITH(selinux,
esac], [with_selinux=no])

# Checks for libraries.
# Use customized LZ4 library path when specified.
AC_ARG_WITH(lz4-incdir,
[AS_HELP_STRING([--with-lz4-incdir=DIR], [LZ4 include directory])], [
EROFS_UTILS_PARSE_DIRECTORY(["$withval"],[withval])])

AC_ARG_WITH(lz4-libdir,
[AS_HELP_STRING([--with-lz4-libdir=DIR], [LZ4 lib directory])], [
EROFS_UTILS_PARSE_DIRECTORY(["$withval"],[withval])])

AC_ARG_VAR([LZ4_CFLAGS], [C compiler flags for lz4])
AC_ARG_VAR([LZ4_LIBS], [linker flags for lz4])

# Checks for header files.
AC_CHECK_HEADERS(m4_flatten([
Expand Down Expand Up @@ -396,36 +385,35 @@ AS_IF([test "x$enable_fuse" != "xno"], [
CPPFLAGS="${saved_CPPFLAGS}"], [have_fuse="no"])

# Configure lz4
test -z $LZ4_LIBS && LZ4_LIBS='-llz4'

if test "x$enable_lz4" = "xyes"; then
test -z "${with_lz4_incdir}" || LZ4_CFLAGS="-I$with_lz4_incdir $LZ4_CFLAGS"

AS_IF([test "x$enable_lz4" != "xno"], [
saved_CPPFLAGS=${CPPFLAGS}
CPPFLAGS="${LZ4_CFLAGS} ${CPPFLAGS}"

AC_CHECK_HEADERS([lz4.h],[have_lz4h="yes"], [])

if test "x${have_lz4h}" = "xyes" ; then
PKG_CHECK_MODULES([liblz4], [liblz4], [
# Paranoia: don't trust the result reported by pkgconfig before trying out
saved_LIBS="$LIBS"
saved_LDFLAGS=${LDFLAGS}
test -z "${with_lz4_libdir}" || LDFLAGS="-L$with_lz4_libdir ${LDFLAGS}"
AC_CHECK_LIB(lz4, LZ4_compress_destSize, [
have_lz4="yes"
have_lz4hc="yes"
AC_CHECK_LIB(lz4, LZ4_compress_HC_destSize, [], [
AC_CHECK_DECL(LZ4_compress_HC_destSize, [lz4_force_static="yes"],
[have_lz4hc="no"], [[
#define LZ4_HC_STATIC_LINKING_ONLY (1)
saved_CPPFLAGS=${CPPFLAGS}
CPPFLAGS="${liblz4_CFLAGS} ${CPPFLAGS}"
LIBS="${liblz4_LIBS} $LIBS"
AC_CHECK_HEADERS([lz4.h],[
AC_CHECK_LIB(lz4, LZ4_compress_destSize, [
AC_CHECK_DECL(LZ4_compress_destSize, [have_lz4="yes"],
[], [[
#include <lz4.h>
]])
])
AC_CHECK_LIB(lz4, LZ4_compress_HC_destSize, [
AC_CHECK_DECL(LZ4_compress_HC_destSize, [have_lz4hc="yes"],
[], [[
#include <lz4hc.h>
]])
])
], [AC_MSG_ERROR([Cannot find proper lz4 version (>= 1.8.0)])])
LDFLAGS=${saved_LDFLAGS}
])
LIBS="${saved_LIBS}"
fi
CPPFLAGS=${saved_CPPFLAGS}
fi
CPPFLAGS="${saved_CPPFLAGS}"
], [[]])
AS_IF([test "x$enable_lz4" = "xyes" -a "x$have_lz4" != "xyes"], [
AC_MSG_ERROR([Cannot find a proper liblz4 version])
])
])

# Configure liblzma
have_liblzma="no"
Expand Down Expand Up @@ -581,16 +569,7 @@ if test "x${have_lz4}" = "xyes"; then
if test "x${have_lz4hc}" = "xyes"; then
AC_DEFINE([LZ4HC_ENABLED], [1], [Define to 1 if lz4hc is enabled.])
fi

if test "x${lz4_force_static}" = "xyes"; then
LZ4_LIBS="-Wl,-Bstatic -Wl,-whole-archive -Xlinker ${LZ4_LIBS} -Wl,-no-whole-archive -Wl,-Bdynamic"
test -z "${with_lz4_libdir}" || LZ4_LIBS="-L${with_lz4_libdir} $LZ4_LIBS"
else
test -z "${with_lz4_libdir}" || LZ4_LIBS="-L${with_lz4_libdir} -R${with_lz4_libdir} $LZ4_LIBS"
fi
liblz4_LIBS="${LZ4_LIBS}"
fi
AC_SUBST([liblz4_LIBS])

if test "x${have_liblzma}" = "xyes"; then
AC_DEFINE([HAVE_LIBLZMA], [1], [Define to 1 if liblzma is enabled.])
Expand Down
7 changes: 4 additions & 3 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
erofs-utils (1.8.2-2deepin1) unstable; urgency=medium
erofs-utils (1.8.3-1) unstable; urgency=medium

* Add deepin patch.
* New upstream release 1.8.3.
* Use FUSE3 for erofsfuse, thanks to наб (closes: #1084471).

-- xiangzelong <xiangzelong@deepin.org> Fri, 13 Dec 2024 16:27:30 +0800
-- Gao Xiang <xiang@kernel.org> Sun, 15 Dec 2024 00:00:00 +0800

erofs-utils (1.8.2-2) unstable; urgency=medium

Expand Down
5 changes: 3 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Build-Depends:
pkgconf,
uuid-dev,
zlib1g-dev,
libfuse-dev [linux-any] <!pkg.erofs-utils.no-erofsfuse>
libfuse3-dev [linux-any] <!pkg.erofs-utils.no-erofsfuse>
Section: admin
Standards-Version: 4.7.0
Homepage: http://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git
Expand All @@ -33,9 +33,10 @@ Description: Utilities for EROFS File System
performance for embedded devices with limited memory.

Package: erofsfuse
Architecture: linux-any
Build-Profiles: <!pkg.erofs-utils.no-erofsfuse>
Depends: ${shlibs:Depends}, ${misc:Depends}
Architecture: linux-any
Recommends: fuse3
Description: FUSE Mount Utility for EROFS File System
EROFS (Enhanced Read-Only File System) is a lightweight
read-only file system with modern designs (eg. page-sized
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion debian/patches/series

This file was deleted.

10 changes: 5 additions & 5 deletions fuse/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ erofsfuse_LDADD = $(top_builddir)/lib/liberofs.la ${libfuse2_LIBS} ${libfuse3_LI
${libqpl_LIBS}

if ENABLE_STATIC_FUSE
lib_LIBRARIES = liberofsfuse.a
liberofsfuse_a_SOURCES = main.c
liberofsfuse_a_CFLAGS = -Wall -I$(top_srcdir)/include
liberofsfuse_a_CFLAGS += -Dmain=erofsfuse_main ${libfuse2_CFLAGS} ${libfuse3_CFLAGS} ${libselinux_CFLAGS}
liberofsfuse_a_LIBADD = $(top_builddir)/lib/liberofs.la
lib_LTLIBRARIES = liberofsfuse.la
liberofsfuse_la_SOURCES = main.c
liberofsfuse_la_CFLAGS = -Wall -I$(top_srcdir)/include
liberofsfuse_la_CFLAGS += -Dmain=erofsfuse_main ${libfuse2_CFLAGS} ${libfuse3_CFLAGS} ${libselinux_CFLAGS}
liberofsfuse_la_LIBADD = $(top_builddir)/lib/liberofs.la
endif
2 changes: 1 addition & 1 deletion include/erofs/block_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int erofs_blocklist_open(FILE *fp, bool srcmap);
FILE *erofs_blocklist_close(void);

void tarerofs_blocklist_write(erofs_blk_t blkaddr, erofs_blk_t nblocks,
erofs_off_t srcoff);
erofs_off_t srcoff, unsigned int zeroedlen);
#ifdef WITH_ANDROID
void erofs_droid_blocklist_write(struct erofs_inode *inode,
erofs_blk_t blk_start, erofs_blk_t nblocks);
Expand Down
9 changes: 5 additions & 4 deletions include/erofs/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ struct erofs_configure {
int c_dbg_lvl;
bool c_dry_run;
bool c_legacy_compress;
#ifndef NDEBUG
bool c_random_pclusterblks;
bool c_random_algorithms;
#endif
char c_timeinherit;
char c_chunkbits;
bool c_inline_data;
Expand All @@ -62,6 +58,7 @@ struct erofs_configure {
bool c_extra_ea_name_prefixes;
bool c_xattr_name_filter;
bool c_ovlfs_strip;
bool c_hard_dereference;

#ifdef HAVE_LIBSELINUX
struct selabel_handle *sehnd;
Expand Down Expand Up @@ -94,6 +91,10 @@ struct erofs_configure {
char *fs_config_file;
char *block_list_file;
#endif
#ifndef NDEBUG
bool c_random_pclusterblks;
bool c_random_algorithms;
#endif
};

extern struct erofs_configure cfg;
Expand Down
5 changes: 1 addition & 4 deletions include/erofs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,7 @@ enum {
Z_EROFS_LCLUSTER_TYPE_MAX
};

#define Z_EROFS_LI_LCLUSTER_TYPE_BITS 2
#define Z_EROFS_LI_LCLUSTER_TYPE_BIT 0
#define Z_EROFS_LI_LCLUSTER_TYPE_MASK (Z_EROFS_LCLUSTER_TYPE_MAX - 1)

/* (noncompact only, HEAD) This pcluster refers to partial decompressed data */
#define Z_EROFS_LI_PARTIAL_REF (1 << 15)
Expand Down Expand Up @@ -474,8 +473,6 @@ static inline void erofs_check_ondisk_layout_definitions(void)
sizeof(struct z_erofs_lcluster_index));
BUILD_BUG_ON(sizeof(struct erofs_deviceslot) != 128);

BUILD_BUG_ON(BIT(Z_EROFS_LI_LCLUSTER_TYPE_BITS) <
Z_EROFS_LCLUSTER_TYPE_MAX - 1);
#ifndef __cplusplus
/* exclude old compiler versions like gcc 7.5.0 */
BUILD_BUG_ON(__builtin_constant_p(fmh.v) ?
Expand Down
4 changes: 3 additions & 1 deletion lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ liberofs_la_SOURCES = config.c io.c cache.c super.c inode.c xattr.c exclude.c \

liberofs_la_CFLAGS = -Wall ${libuuid_CFLAGS} -I$(top_srcdir)/include
if ENABLE_LZ4
liberofs_la_CFLAGS += ${LZ4_CFLAGS}
liberofs_la_CFLAGS += ${liblz4_CFLAGS}
liberofs_la_SOURCES += compressor_lz4.c
if ENABLE_LZ4HC
liberofs_la_SOURCES += compressor_lz4hc.c
Expand All @@ -51,9 +51,11 @@ endif

liberofs_la_SOURCES += kite_deflate.c compressor_deflate.c
if ENABLE_LIBDEFLATE
liberofs_la_CFLAGS += ${libdeflate_CFLAGS}
liberofs_la_SOURCES += compressor_libdeflate.c
endif
if ENABLE_LIBZSTD
liberofs_la_CFLAGS += ${libzstd_CFLAGS}
liberofs_la_SOURCES += compressor_libzstd.c
endif
if ENABLE_EROFS_MT
Expand Down
36 changes: 26 additions & 10 deletions lib/blobchunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ static int erofs_blob_hashmap_cmp(const void *a, const void *b,
int erofs_blob_write_chunk_indexes(struct erofs_inode *inode,
erofs_off_t off)
{
erofs_blk_t remaining_blks = BLK_ROUND_UP(inode->sbi, inode->i_size);
struct erofs_sb_info *sbi = inode->sbi;
erofs_blk_t remaining_blks = BLK_ROUND_UP(sbi, inode->i_size);
struct erofs_inode_chunk_index idx = {0};
erofs_blk_t extent_start = EROFS_NULL_ADDR;
erofs_blk_t extent_end, chunkblks;
erofs_off_t source_offset;
unsigned int dst, src, unit;
unsigned int dst, src, unit, zeroedlen;
bool first_extent = true;

if (inode->u.chunkformat & EROFS_CHUNK_FORMAT_INDEXES)
Expand Down Expand Up @@ -169,7 +170,7 @@ int erofs_blob_write_chunk_indexes(struct erofs_inode *inode,
remaining_blks -= extent_end - extent_start;
tarerofs_blocklist_write(extent_start,
extent_end - extent_start,
source_offset);
source_offset, 0);
erofs_droid_blocklist_write_extent(inode,
extent_start,
extent_end - extent_start,
Expand All @@ -190,9 +191,13 @@ int erofs_blob_write_chunk_indexes(struct erofs_inode *inode,
}
off = roundup(off, unit);
extent_end = min(extent_end, extent_start + remaining_blks);
if (extent_start != EROFS_NULL_ADDR)
if (extent_start != EROFS_NULL_ADDR) {
zeroedlen = inode->i_size & (erofs_blksiz(sbi) - 1);
if (zeroedlen)
zeroedlen = erofs_blksiz(sbi) - zeroedlen;
tarerofs_blocklist_write(extent_start, extent_end - extent_start,
source_offset);
source_offset, zeroedlen);
}
erofs_droid_blocklist_write_extent(inode, extent_start,
extent_start == EROFS_NULL_ADDR ?
0 : extent_end - extent_start,
Expand Down Expand Up @@ -480,9 +485,8 @@ int tarerofs_write_chunkes(struct erofs_inode *inode, erofs_off_t data_offset)
int erofs_mkfs_dump_blobs(struct erofs_sb_info *sbi)
{
struct erofs_buffer_head *bh;
ssize_t length;
ssize_t length, ret;
u64 pos_in, pos_out;
ssize_t ret;

if (blobfile) {
fflush(blobfile);
Expand Down Expand Up @@ -532,9 +536,21 @@ int erofs_mkfs_dump_blobs(struct erofs_sb_info *sbi)
pos_out += sbi->bdev.offset;
if (blobfile) {
pos_in = 0;
ret = erofs_copy_file_range(fileno(blobfile), &pos_in,
sbi->bdev.fd, &pos_out, datablob_size);
ret = ret < datablob_size ? -EIO : 0;
do {
length = min_t(erofs_off_t, datablob_size, SSIZE_MAX);
ret = erofs_copy_file_range(fileno(blobfile), &pos_in,
sbi->bdev.fd, &pos_out, length);
} while (ret > 0 && (datablob_size -= ret));

if (ret >= 0) {
if (datablob_size) {
erofs_err("failed to append the remaining %llu-byte chunk data",
datablob_size);
ret = -EIO;
} else {
ret = 0;
}
}
} else {
ret = erofs_io_ftruncate(&sbi->bdev, pos_out + datablob_size);
}
Expand Down
10 changes: 7 additions & 3 deletions lib/block_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@ FILE *erofs_blocklist_close(void)

/* XXX: really need to be cleaned up */
void tarerofs_blocklist_write(erofs_blk_t blkaddr, erofs_blk_t nblocks,
erofs_off_t srcoff)
erofs_off_t srcoff, unsigned int zeroedlen)
{
if (!block_list_fp || !nblocks || !srcmap_enabled)
return;

fprintf(block_list_fp, "%08x %8x %08" PRIx64 "\n",
blkaddr, nblocks, srcoff);
if (zeroedlen)
fprintf(block_list_fp, "%08x %8x %08" PRIx64 " %08u\n",
blkaddr, nblocks, srcoff, zeroedlen);
else
fprintf(block_list_fp, "%08x %8x %08" PRIx64 "\n",
blkaddr, nblocks, srcoff);
}

#ifdef WITH_ANDROID
Expand Down
Loading

0 comments on commit 189981c

Please sign in to comment.