Skip to content

Commit

Permalink
Fix naming of levels
Browse files Browse the repository at this point in the history
Will be squashed after successful test.

Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
  • Loading branch information
c0d3z3r0 committed Feb 28, 2020
1 parent 342bafe commit 85d406c
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 143 deletions.
102 changes: 50 additions & 52 deletions include/sys/zio_compress.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,58 +61,56 @@ enum zio_compress {
#define ZIO_COMPLEVEL_DEFAULT 255

enum zio_zstd_levels {
ZIO_ZSTDLVL_INHERIT = 0,
ZIO_ZSTDLVL_1,
#define ZIO_ZSTD_LEVEL_MIN ZIO_ZSTDLVL_1
ZIO_ZSTDLVL_2,
ZIO_ZSTDLVL_3,
#define ZIO_ZSTD_LEVEL_DEFAULT ZIO_ZSTDLVL_3
ZIO_ZSTDLVL_4,
ZIO_ZSTDLVL_5,
ZIO_ZSTDLVL_6,
ZIO_ZSTDLVL_7,
ZIO_ZSTDLVL_8,
ZIO_ZSTDLVL_9,
ZIO_ZSTDLVL_10,
ZIO_ZSTDLVL_11,
ZIO_ZSTDLVL_12,
ZIO_ZSTDLVL_13,
ZIO_ZSTDLVL_14,
ZIO_ZSTDLVL_15,
ZIO_ZSTDLVL_16,
ZIO_ZSTDLVL_17,
ZIO_ZSTDLVL_18,
ZIO_ZSTDLVL_19,
#define ZIO_ZSTD_LEVEL_MAX ZIO_ZSTDLVL_19
#define ZIO_ZSTDLVL_MAX ZIO_ZSTDLVL_19
ZIO_ZSTDLVL_RESERVE = 101, /* Leave room for new positive levels */
ZIO_ZSTDLVL_FAST, /* Fast levels are negative */
ZIO_ZSTDLVL_FAST_1,
#define ZIO_ZSTD_FAST_LEVEL_DEFAULT ZIO_ZSTDLVL_FAST_1
ZIO_ZSTDLVL_FAST_2,
ZIO_ZSTDLVL_FAST_3,
ZIO_ZSTDLVL_FAST_4,
ZIO_ZSTDLVL_FAST_5,
ZIO_ZSTDLVL_FAST_6,
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O_ZSTD_LEVEL_FAST, /* Fast levels are negative */
ZIO_ZSTD_LEVEL_FAST_1,
#define ZIO_ZSTD_LEVEL_FAST_DEFAULT ZIO_ZSTD_LEVEL_FAST_1
ZIO_ZSTD_LEVEL_FAST_2,
ZIO_ZSTD_LEVEL_FAST_3,
ZIO_ZSTD_LEVEL_FAST_4,
ZIO_ZSTD_LEVEL_FAST_5,
ZIO_ZSTD_LEVEL_FAST_6,
ZIO_ZSTD_LEVEL_FAST_7,
ZIO_ZSTD_LEVEL_FAST_8,
ZIO_ZSTD_LEVEL_FAST_9,
ZIO_ZSTD_LEVEL_FAST_10,
ZIO_ZSTD_LEVEL_FAST_20,
ZIO_ZSTD_LEVEL_FAST_30,
ZIO_ZSTD_LEVEL_FAST_40,
ZIO_ZSTD_LEVEL_FAST_50,
ZIO_ZSTD_LEVEL_FAST_60,
ZIO_ZSTD_LEVEL_FAST_70,
ZIO_ZSTD_LEVEL_FAST_80,
ZIO_ZSTD_LEVEL_FAST_90,
ZIO_ZSTD_LEVEL_FAST_100,
ZIO_ZSTD_LEVEL_FAST_500,
ZIO_ZSTD_LEVEL_FAST_1000,
#define ZIO_ZSTD_LEVEL_FAST_MAX ZIO_ZSTD_LEVEL_FAST_1000
ZIO_ZSTD_LEVEL_AUTO = 251, /* Reserved for future use */
ZIO_ZSTD_LEVEL_LEVELS
};

/* Forward Declaration to avoid visibility problems */
Expand Down
82 changes: 41 additions & 41 deletions module/zcommon/zfs_prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ zfs_prop_init(void)
{ "lz4", ZIO_COMPRESS_LZ4 },
{ "zstd", ZIO_COMPRESS_ZSTD },
{ "zstd-fast", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTD_FAST_LEVEL_DEFAULT << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_DEFAULT << SPA_COMPRESSBITS) },
/*
* ZSTD 1-19 are synthetic. We store the compression level in a
* separate hidden property to avoid wasting a large amount of
Expand All @@ -138,88 +138,88 @@ zfs_prop_init(void)
* to be stored on disk in the block pointer.
*/
{ "zstd-1", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_1 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_1 << SPA_COMPRESSBITS) },
{ "zstd-2", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_2 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_2 << SPA_COMPRESSBITS) },
{ "zstd-3", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_3 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_3 << SPA_COMPRESSBITS) },
{ "zstd-4", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_4 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_4 << SPA_COMPRESSBITS) },
{ "zstd-5", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_5 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_5 << SPA_COMPRESSBITS) },
{ "zstd-6", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_6 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_6 << SPA_COMPRESSBITS) },
{ "zstd-7", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_7 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_7 << SPA_COMPRESSBITS) },
{ "zstd-8", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_8 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_8 << SPA_COMPRESSBITS) },
{ "zstd-9", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_9 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_9 << SPA_COMPRESSBITS) },
{ "zstd-10", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_10 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_10 << SPA_COMPRESSBITS) },
{ "zstd-11", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_11 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_11 << SPA_COMPRESSBITS) },
{ "zstd-12", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_12 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_12 << SPA_COMPRESSBITS) },
{ "zstd-13", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_13 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_13 << SPA_COMPRESSBITS) },
{ "zstd-14", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_14 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_14 << SPA_COMPRESSBITS) },
{ "zstd-15", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_15 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_15 << SPA_COMPRESSBITS) },
{ "zstd-16", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_16 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_16 << SPA_COMPRESSBITS) },
{ "zstd-17", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_17 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_17 << SPA_COMPRESSBITS) },
{ "zstd-18", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_18 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_18 << SPA_COMPRESSBITS) },
{ "zstd-19", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_19 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_19 << SPA_COMPRESSBITS) },
/*
* The ZSTD-Fast levels are also synthetic.
*/
{ "zstd-fast-1", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_1 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_1 << SPA_COMPRESSBITS) },
{ "zstd-fast-2", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_2 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_2 << SPA_COMPRESSBITS) },
{ "zstd-fast-3", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_3 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_3 << SPA_COMPRESSBITS) },
{ "zstd-fast-4", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_4 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_4 << SPA_COMPRESSBITS) },
{ "zstd-fast-5", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_5 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_5 << SPA_COMPRESSBITS) },
{ "zstd-fast-6", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_6 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_6 << SPA_COMPRESSBITS) },
{ "zstd-fast-7", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_7 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_7 << SPA_COMPRESSBITS) },
{ "zstd-fast-8", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_8 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_8 << SPA_COMPRESSBITS) },
{ "zstd-fast-9", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_9 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_9 << SPA_COMPRESSBITS) },
{ "zstd-fast-10", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_10 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_10 << SPA_COMPRESSBITS) },
{ "zstd-fast-20", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_20 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_20 << SPA_COMPRESSBITS) },
{ "zstd-fast-30", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_30 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_30 << SPA_COMPRESSBITS) },
{ "zstd-fast-40", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_40 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_40 << SPA_COMPRESSBITS) },
{ "zstd-fast-50", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_50 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_50 << SPA_COMPRESSBITS) },
{ "zstd-fast-60", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_60 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_60 << SPA_COMPRESSBITS) },
{ "zstd-fast-70", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_70 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_70 << SPA_COMPRESSBITS) },
{ "zstd-fast-80", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_80 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_80 << SPA_COMPRESSBITS) },
{ "zstd-fast-90", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_90 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_90 << SPA_COMPRESSBITS) },
{ "zstd-fast-100", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_100 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_100 << SPA_COMPRESSBITS) },
{ "zstd-fast-500", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_500 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_500 << SPA_COMPRESSBITS) },
{ "zstd-fast-1000", ZIO_COMPRESS_ZSTD |
(ZIO_ZSTDLVL_FAST_1000 << SPA_COMPRESSBITS) },
(ZIO_ZSTD_LEVEL_FAST_1000 << SPA_COMPRESSBITS) },
{ NULL }
};

Expand Down
4 changes: 2 additions & 2 deletions module/zfs/zio_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ zio_complevel_select(spa_t *spa, enum zio_compress compress, uint8_t child,
uint8_t result;

result = child;
if (result == ZIO_ZSTDLVL_INHERIT)
if (result == ZIO_ZSTD_LEVEL_INHERIT)
result = parent;

return (result);
Expand Down Expand Up @@ -142,7 +142,7 @@ zio_compress_data(enum zio_compress c, abd_t *src, void *dst, size_t s_len,

if (c == ZIO_COMPRESS_ZSTD) {
/* If we don't know the level, we can't compress it */
if (level == ZIO_ZSTDLVL_INHERIT)
if (level == ZIO_ZSTD_LEVEL_INHERIT)
return (s_len);

if (level == ZIO_COMPLEVEL_DEFAULT)
Expand Down
89 changes: 41 additions & 48 deletions module/zstd/zstd.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,46 +102,46 @@ static const ZSTD_customMem zstd_dctx_malloc = {
};

static struct levelmap fastlevels[] = {
{ZIO_ZSTDLVL_1, ZIO_ZSTDLVL_1},
{ZIO_ZSTDLVL_2, ZIO_ZSTDLVL_2},
{ZIO_ZSTDLVL_3, ZIO_ZSTDLVL_3},
{ZIO_ZSTDLVL_4, ZIO_ZSTDLVL_4},
{ZIO_ZSTDLVL_5, ZIO_ZSTDLVL_5},
{ZIO_ZSTDLVL_6, ZIO_ZSTDLVL_6},
{ZIO_ZSTDLVL_7, ZIO_ZSTDLVL_7},
{ZIO_ZSTDLVL_8, ZIO_ZSTDLVL_8},
{ZIO_ZSTDLVL_9, ZIO_ZSTDLVL_9},
{ZIO_ZSTDLVL_10, ZIO_ZSTDLVL_10},
{ZI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STD_LEVEL_FAST_80},
{-90, ZIO_ZSTD_LEVEL_FAST_90},
{-100, ZIO_ZSTD_LEVEL_FAST_100},
{-500, ZIO_ZSTD_LEVEL_FAST_500},
{-1000, ZIO_ZSTD_LEVEL_FAST_1000},
};

/*
Expand Down Expand Up @@ -317,13 +317,6 @@ zstd_compress(void *s_start, void *d_start, size_t s_len, size_t d_len,
ASSERT3U(d_len, <=, s_len);
ASSERT3U(levelcookie, !=, 0);

if (levelcookie == ZIO_COMPLEVEL_DEFAULT) {
levelcookie = ZIO_ZSTD_LEVEL_DEFAULT;
}
if (levelcookie == ZIO_ZSTDLVL_DEFAULT) {
levelcookie = ZIO_ZSTD_LEVEL_DEFAULT;
}

cctx = ZSTD_createCCtx_advanced(zstd_malloc);

/*
Expand Down Expand Up @@ -380,7 +373,7 @@ zstd_decompress_level(void *s_start, void *d_start, size_t s_len, size_t d_len,
uint8_t zstdlevel = zstd_cookie_to_enum(levelcookie);

ASSERT3U(d_len, >=, s_len);
ASSERT3U(zstdlevel, !=, ZIO_ZSTDLVL_INHERIT);
ASSERT3U(zstdlevel, !=, ZIO_ZSTD_LEVEL_INHERIT);

/* Invalid compressed buffer size encoded at start */
if (bufsize + sizeof (bufsize) > s_len) {
Expand Down

0 comments on commit 85d406c

Please sign in to comment.