Skip to content

Commit

Permalink
Fix documentation
Browse files Browse the repository at this point in the history
This fixes some of the rebase mistakes on the documentation
It also adds some commenting to compress_adaptive

Co-authored-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl> (+1 squashed commits)

Squashed commits:

[8de8850] Add adaptive compression

- This Commit rebases and squashes openzfs#7560
- Adds tests for Adaptive compression

Co-authored-by:  n1kl (bunge) <n1kl@users.noreply.github.com>
Co-authored-by:  Ruben Kelevra <RubenKelevra@users.noreply.github.com>
Co-authored-by: Andy Lavr <andy.lavr@gmail.com>
Co-authored-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Co-authored-by:  Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
Signed-off-by: n1kl (bunge) <n1kl@users.noreply.github.com>
Signed-off-by: RubenKelevra <ruben@vfn-nrw.de>
Signed-off-by: Andy Lavr <andy.lavr@gmail.com>
Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
  • Loading branch information
5 people committed Oct 8, 2020
1 parent a76e4e6 commit 844448c
Show file tree
Hide file tree
Showing 26 changed files with 459 additions and 12 deletions.
3 changes: 2 additions & 1 deletion cmd/dbufstat/dbufstat.in
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ def get_compstring(c):
"ZIO_COMPRESS_GZIP_6", "ZIO_COMPRESS_GZIP_7",
"ZIO_COMPRESS_GZIP_8", "ZIO_COMPRESS_GZIP_9",
"ZIO_COMPRESS_ZLE", "ZIO_COMPRESS_LZ4",
"ZIO_COMPRESS_ZSTD", "ZIO_COMPRESS_FUNCTION"]
"ZIO_COMPRESS_ZSTD", "ZIO_COMPRESS_ADAPTIVE",
"ZIO_COMPRESS_FUNCTION"]

# If "-rr" option is used, don't convert to string representation
if raw > 1:
Expand Down
1 change: 1 addition & 0 deletions include/sys/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COMMON_H = \
bptree.h \
btree.h \
bqueue.h \
compress_adaptive.h \
dataset_kstats.h \
dbuf.h \
ddt.h \
Expand Down
38 changes: 38 additions & 0 deletions include/sys/compress_adaptive.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/

#ifndef _SYS_ADAPTIVE_COMPRESS_H
#define _SYS_ADAPTIVE_COMPRESS_H

#define COMPRESS_ADAPTIVE_LEVELS 10

#include <sys/spa.h>
#include <sys/zio.h>

size_t compress_adaptive(zio_t *zio, abd_t *src, void *dst,
size_t s_len, enum zio_compress *c, uint8_t level);

void compress_calc_avg_without_zero(uint64_t act, uint64_t *res, int n);

uint64_t compress_calc_Bps(uint64_t byte, hrtime_t delay);


#endif /* _SYS_ADAPTIVE_COMPRESS_H */
2 changes: 2 additions & 0 deletions include/sys/dsl_dataset.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ boolean_t dsl_dataset_get_uint64_array_feature(dsl_dataset_t *ds,
void dsl_dataset_activate_redaction(dsl_dataset_t *ds, uint64_t *redact_snaps,
uint64_t num_redact_snaps, dmu_tx_t *tx);

int dsl_dataset_activate_compress_adaptive( const char *ddname);

#ifdef ZFS_DEBUG
#define dprintf_ds(ds, fmt, ...) do { \
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
Expand Down
3 changes: 3 additions & 0 deletions include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,9 @@ typedef struct vdev_stat_ex {
uint64_t vsx_agg_histo[ZIO_PRIORITY_NUM_QUEUEABLE]
[VDEV_RQ_HISTO_BUCKETS];


uint64_t vsx_diskBps[ZIO_TYPES];

} vdev_stat_ex_t;

/*
Expand Down
1 change: 1 addition & 0 deletions include/sys/vdev_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ struct vdev_cache {

typedef struct vdev_queue_class {
uint32_t vqc_active;
uint64_t vqc_queued_size;

/*
* Sorted by offset or timestamp, depending on if the queue is
Expand Down
7 changes: 7 additions & 0 deletions include/sys/zio.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <sys/avl.h>
#include <sys/fs/zfs.h>
#include <sys/zio_impl.h>
#include <sys/compress_adaptive.h>

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -527,6 +528,12 @@ struct zio {

/* Taskq dispatching state */
taskq_ent_t io_tqent;

/* stored in pio */
uint8_t io_compress_level;
boolean_t io_compress_adaptive_exploring;

uint64_t io_compress_adaptive_Bps[COMPRESS_ADAPTIVE_LEVELS];
};

enum blk_verify_flag {
Expand Down
1 change: 1 addition & 0 deletions include/sys/zio_compress.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ enum zio_compress {
ZIO_COMPRESS_ZLE,
ZIO_COMPRESS_LZ4,
ZIO_COMPRESS_ZSTD,
ZIO_COMPRESS_ADAPTIVE,
ZIO_COMPRESS_FUNCTIONS
};

Expand Down
1 change: 1 addition & 0 deletions include/zfeature_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ typedef enum spa_feature {
SPA_FEATURE_LIVELIST,
SPA_FEATURE_DEVICE_REBUILD,
SPA_FEATURE_ZSTD_COMPRESS,
SPA_FEATURE_COMPRESS_ADAPTIVE,
SPA_FEATURES
} spa_feature_t;

Expand Down
1 change: 1 addition & 0 deletions lib/libzpool/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ KERNEL_C = \
btree.c \
bqueue.c \
cityhash.c \
compress_adaptive.c \
dbuf.c \
dbuf_stats.c \
ddt.c \
Expand Down
31 changes: 29 additions & 2 deletions man/man5/zpool-features.5
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,34 @@ in which new features are enabled. This has no user-visible impact,
but other features may depend on this feature.

This feature becomes \fBactive\fR as soon as it is enabled and will
never return to being \fBenabled\fB.
never return to being \fBenabled\fR.
.RE

.sp
.ne 2
.na
\fB\fBcompress_adaptive\fR\fR
.ad
.RS 4n
.TS
l l .
GUID org.zfsonlinux:compress_adaptive
READ\-ONLY COMPATIBLE yes
DEPENDENCIES lz4_compress,extensible_dataset
.TE

\fBcompress_adaptive\fR chooses the compression algorithm out of lz4 and gzip[1-9]
to perform with optimal write throughput.

When the \fBcompress_adaptive\fR feature is set to \fBenabled\fR, the
administrator can turn on \fBcompress_adaptive\fR on any dataset on the
pool using the \fBzfs\fR(8) command. Please note that doing so will
immediately activate the \fBcompress_adaptive\fR feature on the underlying
pool.

This feature becomes \fBactive\fR as soon as it is used on one dataset and will
return to being \fBenabled\fR once all filesystems that have ever had their compression set to
+\fBcompress_adaptive\fR are destroyed.
.RE

.sp
Expand Down Expand Up @@ -982,4 +1009,4 @@ Booting off of \fBzstd\fR-compressed root pools is not yet supported.
.RE

.SH "SEE ALSO"
zpool(8)
zpool(8)
2 changes: 1 addition & 1 deletion man/man8/zfs.8
Original file line number Diff line number Diff line change
Expand Up @@ -774,4 +774,4 @@ to mount zfs datasets. This option is provided for backwards compatibility with
.Xr zfs-wait 8 ,
.Xr zfsconcepts 8 ,
.Xr zfsprops 8 ,
.Xr zpool 8
.Xr zpool 8
4 changes: 2 additions & 2 deletions man/man8/zfsprops.8
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ Changing this property affects only newly-written data.
.It Xo
.Sy compression Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Sy gzip Ns | Ns
.Sy gzip- Ns Em N Ns | Ns Sy lz4 Ns | Ns Sy lzjb Ns | Ns Sy zle Ns | Ns Sy zstd Ns | Ns
.Sy zstd- Ns Em N Ns | Ns Sy zstd-fast Ns | Ns Sy zstd-fast- Ns Em N
.Sy zstd- Ns Em N Ns | Ns Sy zstd-fast Ns | Ns Sy zstd-fast- Ns Em N | Ns Sy adaptive Ns
.Xc
Controls the compression algorithm used for this dataset.
.Pp
Expand Down Expand Up @@ -1989,4 +1989,4 @@ Use the
.Nm zfs Cm inherit
command to clear a user property.
If the property is not defined in any parent dataset, it is removed entirely.
Property values are limited to 8192 bytes.
Property values are limited to 8192 bytes.
13 changes: 13 additions & 0 deletions module/zcommon/zfeature_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,19 @@ zpool_feature_init(void)
"LZ4 compression algorithm support.",
ZFEATURE_FLAG_ACTIVATE_ON_ENABLE, ZFEATURE_TYPE_BOOLEAN, NULL);

{
static const spa_feature_t compress_adaptive_deps[] = {
SPA_FEATURE_LZ4_COMPRESS,
SPA_FEATURE_EXTENSIBLE_DATASET,
SPA_FEATURE_NONE
};
zfeature_register(SPA_FEATURE_COMPRESS_ADAPTIVE,
"org.zfsonlinux:compress_adaptive", "compress_adaptive",
"adaptive compression algorithm selection support.",
ZFEATURE_FLAG_PER_DATASET | ZFEATURE_FLAG_READONLY_COMPAT,
ZFEATURE_TYPE_BOOLEAN, compress_adaptive_deps);
}

zfeature_register(SPA_FEATURE_MULTI_VDEV_CRASH_DUMP,
"com.joyent:multi_vdev_crash_dump", "multi_vdev_crash_dump",
"Crash dumps to multiple vdev pools.",
Expand Down
5 changes: 4 additions & 1 deletion module/zcommon/zfs_prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ zfs_prop_init(void)
ZIO_COMPLEVEL_ZSTD(ZIO_ZSTD_LEVEL_FAST_500) },
{ "zstd-fast-1000",
ZIO_COMPLEVEL_ZSTD(ZIO_ZSTD_LEVEL_FAST_1000) },

{ "adaptive", ZIO_COMPRESS_ADAPTIVE },

{ NULL }
};

Expand Down Expand Up @@ -414,7 +417,7 @@ zfs_prop_init(void)
zprop_register_index(ZFS_PROP_COMPRESSION, "compression",
ZIO_COMPRESS_DEFAULT, PROP_INHERIT,
ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
"on | off | lzjb | gzip | gzip-[1-9] | zle | lz4 | "
"on | off | adaptive | lzjb | gzip | gzip-[1-9] | zle | lz4 | "
"zstd | zstd-[1-19] | "
"zstd-fast-[1-10,20,30,40,50,60,70,80,90,100,500,1000]",
"COMPRESS", compress_table);
Expand Down
1 change: 1 addition & 0 deletions module/zfs/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ $(MODULE)-objs += arc.o
$(MODULE)-objs += blkptr.o
$(MODULE)-objs += bplist.o
$(MODULE)-objs += bpobj.o
$(MODULE)-objs += compress_adaptive.o
$(MODULE)-objs += bptree.o
$(MODULE)-objs += btree.o
$(MODULE)-objs += bqueue.o
Expand Down
Loading

0 comments on commit 844448c

Please sign in to comment.