Deleted Added
full compact
zio_compress.c (321610) zio_compress.c (339114)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 11 unchanged lines hidden (view full) ---

20 */
21
22/*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26/*
27 * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 11 unchanged lines hidden (view full) ---

20 */
21
22/*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26/*
27 * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
28 * Copyright (c) 2013, 2016 by Delphix. All rights reserved.
28 * Copyright (c) 2013, 2018 by Delphix. All rights reserved.
29 */
30
31#include <sys/zfs_context.h>
32#include <sys/compress.h>
33#include <sys/kstat.h>
34#include <sys/spa.h>
35#include <sys/zfeature.h>
36#include <sys/zio.h>

--- 14 unchanged lines hidden (view full) ---

51#define ZCOMPSTAT_INCR(stat, val) \
52 atomic_add_64(&zcomp_stats.stat.value.ui64, (val));
53
54#define ZCOMPSTAT_BUMP(stat) ZCOMPSTAT_INCR(stat, 1);
55
56kstat_t *zcomp_ksp;
57
58/*
29 */
30
31#include <sys/zfs_context.h>
32#include <sys/compress.h>
33#include <sys/kstat.h>
34#include <sys/spa.h>
35#include <sys/zfeature.h>
36#include <sys/zio.h>

--- 14 unchanged lines hidden (view full) ---

51#define ZCOMPSTAT_INCR(stat, val) \
52 atomic_add_64(&zcomp_stats.stat.value.ui64, (val));
53
54#define ZCOMPSTAT_BUMP(stat) ZCOMPSTAT_INCR(stat, 1);
55
56kstat_t *zcomp_ksp;
57
58/*
59 * If nonzero, every 1/X decompression attempts will fail, simulating
60 * an undetected memory error.
61 */
62uint64_t zio_decompress_fail_fraction = 0;
63
64/*
59 * Compression vectors.
60 */
61zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS] = {
62 {"inherit", 0, NULL, NULL},
63 {"on", 0, NULL, NULL},
64 {"uncompressed", 0, NULL, NULL},
65 {"lzjb", 0, lzjb_compress, lzjb_decompress},
66 {"empty", 0, NULL, NULL},

--- 100 unchanged lines hidden (view full) ---

167int
168zio_decompress_data(enum zio_compress c, abd_t *src, void *dst,
169 size_t s_len, size_t d_len)
170{
171 void *tmp = abd_borrow_buf_copy(src, s_len);
172 int ret = zio_decompress_data_buf(c, tmp, dst, s_len, d_len);
173 abd_return_buf(src, tmp, s_len);
174
65 * Compression vectors.
66 */
67zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS] = {
68 {"inherit", 0, NULL, NULL},
69 {"on", 0, NULL, NULL},
70 {"uncompressed", 0, NULL, NULL},
71 {"lzjb", 0, lzjb_compress, lzjb_decompress},
72 {"empty", 0, NULL, NULL},

--- 100 unchanged lines hidden (view full) ---

173int
174zio_decompress_data(enum zio_compress c, abd_t *src, void *dst,
175 size_t s_len, size_t d_len)
176{
177 void *tmp = abd_borrow_buf_copy(src, s_len);
178 int ret = zio_decompress_data_buf(c, tmp, dst, s_len, d_len);
179 abd_return_buf(src, tmp, s_len);
180
181 /*
182 * Decompression shouldn't fail, because we've already verifyied
183 * the checksum. However, for extra protection (e.g. against bitflips
184 * in non-ECC RAM), we handle this error (and test it).
185 */
186 ASSERT0(ret);
187 if (zio_decompress_fail_fraction != 0 &&
188 spa_get_random(zio_decompress_fail_fraction) == 0)
189 ret = SET_ERROR(EINVAL);
190
175 return (ret);
176}
177
178void
179zio_compress_init(void)
180{
181
182 zcomp_ksp = kstat_create("zfs", 0, "zcompstats", "misc",

--- 17 unchanged lines hidden ---
191 return (ret);
192}
193
194void
195zio_compress_init(void)
196{
197
198 zcomp_ksp = kstat_create("zfs", 0, "zcompstats", "misc",

--- 17 unchanged lines hidden ---