Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Aug 2022 03:49:22 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4f0c9b76cf75 - main - stand: Only compile decompression routines
Message-ID:  <202208130349.27D3nMBx032780@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=4f0c9b76cf75724ef0b9c59bb8c182be24361d7c

commit 4f0c9b76cf75724ef0b9c59bb8c182be24361d7c
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-08-13 03:30:24 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-08-13 03:48:18 +0000

    stand: Only compile decompression routines
    
    We don't need the compress rotuines, nor zstd_opt.c. Remove them.
    Expand the number of places we omit code for IN_LIBSA (which are FreeBSD
    specific). Due to the agressive optimization, though, this doesn't
    reduce the size of the loader. It does reduce the number of 'false
    positives' for places to omit to reduce the size as well as reducing the
    build time slightly.
    
    Sponsored by:           Netflix
    Reviewed by:            tsoome, delphij
    Differential Revision:  https://reviews.freebsd.org/D36145
---
 stand/libsa/zfs/Makefile.inc               | 8 +++-----
 sys/contrib/openzfs/module/zstd/zfs_zstd.c | 8 +++++++-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/stand/libsa/zfs/Makefile.inc b/stand/libsa/zfs/Makefile.inc
index b168451e24d0..dfd136a02a48 100644
--- a/stand/libsa/zfs/Makefile.inc
+++ b/stand/libsa/zfs/Makefile.inc
@@ -12,13 +12,11 @@ ZFS_SRC=	zfs.c nvlist.c skein.c skein_block.c list.c
 ZFS_SRC+=	zfs_zstd.c
 ZFS_SRC+=	blake3.c blake3_generic.c blake3_impl_hack.c
 ZSTD_SRC+=	entropy_common.c error_private.c
-ZSTD_SRC+=	fse_compress.c fse_decompress.c hist.c
-ZSTD_SRC+=	huf_compress.c huf_decompress.c pool.c xxhash.c
-ZSTD_SRC+=	zstd_common.c zstd_compress.c zstd_compress_literals.c
-ZSTD_SRC+=	zstd_compress_sequences.c zstd_compress_superblock.c
+ZSTD_SRC+=	fse_decompress.c hist.c
+ZSTD_SRC+=	huf_decompress.c pool.c xxhash.c
+ZSTD_SRC+=	zstd_common.c
 ZSTD_SRC+=	zstd_ddict.c zstd_decompress.c zstd_decompress_block.c
 ZSTD_SRC+=	zstd_double_fast.c zstd_fast.c zstd_lazy.c zstd_ldm.c
-ZSTD_SRC+=	zstd_opt.c
 
 SRCS+=		${ZFS_SRC} ${ZSTD_SRC}
 
diff --git a/sys/contrib/openzfs/module/zstd/zfs_zstd.c b/sys/contrib/openzfs/module/zstd/zfs_zstd.c
index d7977dfa6b40..48b41ff7532c 100644
--- a/sys/contrib/openzfs/module/zstd/zfs_zstd.c
+++ b/sys/contrib/openzfs/module/zstd/zfs_zstd.c
@@ -182,16 +182,20 @@ struct zstd_levelmap {
  *
  * The ZSTD handlers were split up for the most simplified implementation.
  */
+#ifndef IN_LIBSA
 static void *zstd_alloc(void *opaque, size_t size);
+#endif
 static void *zstd_dctx_alloc(void *opaque, size_t size);
 static void zstd_free(void *opaque, void *ptr);
 
+#ifndef IN_LIBSA
 /* Compression memory handler */
 static const ZSTD_customMem zstd_malloc = {
 	zstd_alloc,
 	zstd_free,
 	NULL,
 };
+#endif
 
 /* Decompression memory handler */
 static const ZSTD_customMem zstd_dctx_malloc = {
@@ -489,7 +493,6 @@ keep_trying:
 	return (zfs_zstd_compress(s_start, d_start, s_len, d_len, level));
 
 }
-#endif
 
 /* Compress block using zstd */
 size_t
@@ -596,6 +599,7 @@ zfs_zstd_compress(void *s_start, void *d_start, size_t s_len, size_t d_len,
 
 	return (c_len + sizeof (*hdr));
 }
+#endif
 
 /* Decompress block using zstd and return its stored level */
 int
@@ -683,6 +687,7 @@ zfs_zstd_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len,
 	    NULL));
 }
 
+#ifndef IN_LIBSA
 /* Allocator for zstd compression context using mempool_allocator */
 static void *
 zstd_alloc(void *opaque __maybe_unused, size_t size)
@@ -699,6 +704,7 @@ zstd_alloc(void *opaque __maybe_unused, size_t size)
 
 	return ((void*)z + (sizeof (struct zstd_kmem)));
 }
+#endif
 
 /*
  * Allocator for zstd decompression context using mempool_allocator with



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202208130349.27D3nMBx032780>