MCPcopy Create free account
hub / github.com/F-Stack/f-stack / zstd_enum_to_level

Function zstd_enum_to_level

freebsd/contrib/openzfs/module/zstd/zfs_zstd.c:346–362  ·  view source on GitHub ↗

Convert ZFS internal enum to ZSTD level */

Source from the content-addressed store, hash-verified

344
345/* Convert ZFS internal enum to ZSTD level */
346static int
347zstd_enum_to_level(enum zio_zstd_levels level, int16_t *zstd_level)
348{
349 if (level > 0 && level <= ZIO_ZSTD_LEVEL_19) {
350 *zstd_level = zstd_levels[level - 1].zstd_level;
351 return (0);
352 }
353 if (level >= ZIO_ZSTD_LEVEL_FAST_1 &&
354 level <= ZIO_ZSTD_LEVEL_FAST_1000) {
355 *zstd_level = zstd_levels[level - ZIO_ZSTD_LEVEL_FAST_1
356 + ZIO_ZSTD_LEVEL_19].zstd_level;
357 return (0);
358 }
359
360 /* Invalid/unknown zfs compression enum - this should never happen. */
361 return (1);
362}
363
364/* Compress block using zstd */
365size_t

Callers 2

zfs_zstd_compressFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected