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
This commit is contained in:
Warner Losh 2022-08-12 21:30:24 -06:00
parent 1482113008
commit 4f0c9b76cf
2 changed files with 10 additions and 6 deletions

View File

@ -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}

View File

@ -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 @@ zfs_zstd_compress_wrap(void *s_start, void *d_start, size_t s_len, size_t d_len,
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