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

Function zstd_alloc

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

Allocator for zstd compression context using mempool_allocator */

Source from the content-addressed store, hash-verified

552
553/* Allocator for zstd compression context using mempool_allocator */
554static void *
555zstd_alloc(void *opaque __maybe_unused, size_t size)
556{
557 size_t nbytes = sizeof (struct zstd_kmem) + size;
558 struct zstd_kmem *z = NULL;
559
560 z = (struct zstd_kmem *)zstd_mempool_alloc(zstd_mempool_cctx, nbytes);
561
562 if (!z) {
563 ZSTDSTAT_BUMP(zstd_stat_alloc_fail);
564 return (NULL);
565 }
566
567 return ((void*)z + (sizeof (struct zstd_kmem)));
568}
569
570/*
571 * Allocator for zstd decompression context using mempool_allocator with

Callers

nothing calls this directly

Calls 1

zstd_mempool_allocFunction · 0.85

Tested by

no test coverage detected