Skip to content

Commit

Permalink
zfs_zstd: FreeBSD-local changes to add IN_LIBSA guards.
Browse files Browse the repository at this point in the history
This is not associated with a specific upstream commit but apparently
a local diff applied as part of:

commit e3aa18ad71782a73d3dd9dd3d526bbd2b607ca16
Merge: 645886d028c8 b9d9845
Author: Martin Matuska <mm@FreeBSD.org>
Date:   Fri Jun 3 17:58:39 2022 +0200

    zfs: merge openzfs/zfs@b9d98453f

    Notable upstream pull request merges:
      openzfs#12321 Fix inflated quiesce time caused by lwb_tx during zil_commit()
      openzfs#13244 zstd early abort
      openzfs#13360 Verify BPs as part of spa_load_verify_cb()
      openzfs#13452 More speculative prefetcher improvements
      openzfs#13466 Expose zpool guids through kstats
      openzfs#13476 Refactor Log Size Limit
      openzfs#13484 FreeBSD: libspl: Add locking around statfs globals
      openzfs#13498 Cancel in-progress rebuilds when we finish removal
      openzfs#13499 zed: Take no action on scrub/resilver checksum errors
      openzfs#13513 Remove wrong assertion in log spacemap

    Obtained from:  OpenZFS
    OpenZFS commit: b9d9845
  • Loading branch information
mmatuska authored and bsdjhb committed Jul 12, 2023
1 parent f514117 commit ca5d0e6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion module/zstd/zfs_zstd.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@
#include "lib/zstd.h"
#include "lib/common/zstd_errors.h"

#ifndef IN_LIBSA
static uint_t zstd_earlyabort_pass = 1;
static int zstd_cutoff_level = ZIO_ZSTD_LEVEL_3;
static unsigned int zstd_abort_size = (128 * 1024);
#endif

static kstat_t *zstd_ksp = NULL;

Expand Down Expand Up @@ -180,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 = {
Expand Down Expand Up @@ -429,7 +435,7 @@ zstd_enum_to_level(enum zio_zstd_levels level, int16_t *zstd_level)
return (1);
}


#ifndef IN_LIBSA
size_t
zfs_zstd_compress_wrap(void *s_start, void *d_start, size_t s_len, size_t d_len,
int level)
Expand Down Expand Up @@ -593,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
Expand Down Expand Up @@ -680,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)
Expand All @@ -696,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
Expand Down

0 comments on commit ca5d0e6

Please sign in to comment.