mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
DLPX-40252 integrate EP-476 compressed zfs send/receive
Authored by: Dan Kimmel <dan.kimmel@delphix.com> Reviewed by: Tom Caputi <tcaputi@datto.com> Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov> Ported by: David Quigley <david.quigley@intel.com> Issue #5078
This commit is contained in:
committed by
Brian Behlendorf
parent
d3c2ae1c08
commit
2aa34383b9
+17
-3
@@ -142,11 +142,17 @@ typedef enum arc_flags
|
||||
|
||||
} arc_flags_t;
|
||||
|
||||
typedef enum arc_buf_flags {
|
||||
ARC_BUF_FLAG_SHARED = 1 << 0,
|
||||
ARC_BUF_FLAG_COMPRESSED = 1 << 1
|
||||
} arc_buf_flags_t;
|
||||
|
||||
struct arc_buf {
|
||||
arc_buf_hdr_t *b_hdr;
|
||||
arc_buf_t *b_next;
|
||||
kmutex_t b_evict_lock;
|
||||
void *b_data;
|
||||
arc_buf_flags_t b_prop_flags;
|
||||
};
|
||||
|
||||
typedef enum arc_buf_contents {
|
||||
@@ -201,14 +207,22 @@ typedef struct arc_buf_info {
|
||||
|
||||
void arc_space_consume(uint64_t space, arc_space_type_t type);
|
||||
void arc_space_return(uint64_t space, arc_space_type_t type);
|
||||
arc_buf_t *arc_alloc_buf(spa_t *spa, int32_t size, void *tag,
|
||||
arc_buf_contents_t type);
|
||||
arc_buf_t *arc_loan_buf(spa_t *spa, uint64_t size);
|
||||
boolean_t arc_is_metadata(arc_buf_t *buf);
|
||||
enum zio_compress arc_get_compression(arc_buf_t *buf);
|
||||
int arc_decompress(arc_buf_t *buf);
|
||||
arc_buf_t *arc_alloc_buf(spa_t *spa, void *tag, arc_buf_contents_t type,
|
||||
int32_t size);
|
||||
arc_buf_t *arc_alloc_compressed_buf(spa_t *spa, void *tag,
|
||||
uint64_t psize, uint64_t lsize, enum zio_compress compression_type);
|
||||
arc_buf_t *arc_loan_buf(spa_t *spa, boolean_t is_metadata, int size);
|
||||
arc_buf_t *arc_loan_compressed_buf(spa_t *spa, uint64_t psize, uint64_t lsize,
|
||||
enum zio_compress compression_type);
|
||||
void arc_return_buf(arc_buf_t *buf, void *tag);
|
||||
void arc_loan_inuse_buf(arc_buf_t *buf, void *tag);
|
||||
void arc_buf_destroy(arc_buf_t *buf, void *tag);
|
||||
void arc_buf_info(arc_buf_t *buf, arc_buf_info_t *abi, int state_index);
|
||||
uint64_t arc_buf_size(arc_buf_t *buf);
|
||||
uint64_t arc_buf_lsize(arc_buf_t *buf);
|
||||
void arc_release(arc_buf_t *buf, void *tag);
|
||||
int arc_released(arc_buf_t *buf);
|
||||
void arc_buf_sigsegv(int sig, siginfo_t *si, void *unused);
|
||||
|
||||
@@ -92,6 +92,7 @@ struct arc_callback {
|
||||
void *acb_private;
|
||||
arc_done_func_t *acb_done;
|
||||
arc_buf_t *acb_buf;
|
||||
boolean_t acb_compressed;
|
||||
zio_t *acb_zio_dummy;
|
||||
arc_callback_t *acb_next;
|
||||
};
|
||||
|
||||
+3
-2
@@ -44,6 +44,7 @@
|
||||
#include <sys/inttypes.h>
|
||||
#include <sys/cred.h>
|
||||
#include <sys/fs/zfs.h>
|
||||
#include <sys/zio_compress.h>
|
||||
#include <sys/zio_priority.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
@@ -421,8 +422,8 @@ dmu_write_embedded(objset_t *os, uint64_t object, uint64_t offset,
|
||||
#define WP_DMU_SYNC 0x2
|
||||
#define WP_SPILL 0x4
|
||||
|
||||
void dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp,
|
||||
struct zio_prop *zp);
|
||||
void dmu_write_policy(objset_t *os, struct dnode *dn, int level, int wp,
|
||||
enum zio_compress compress_override, struct zio_prop *zp);
|
||||
/*
|
||||
* The bonus data is accessed more or less like a regular buffer.
|
||||
* You must dmu_bonus_hold() to get the buffer, which will give you a
|
||||
|
||||
@@ -41,14 +41,14 @@ struct dmu_replay_record;
|
||||
extern const char *recv_clone_name;
|
||||
|
||||
int dmu_send(const char *tosnap, const char *fromsnap, boolean_t embedok,
|
||||
boolean_t large_block_ok, int outfd, uint64_t resumeobj, uint64_t resumeoff,
|
||||
struct vnode *vp, offset_t *off);
|
||||
boolean_t large_block_ok, boolean_t compressok, int outfd,
|
||||
uint64_t resumeobj, uint64_t resumeoff, struct vnode *vp, offset_t *off);
|
||||
int dmu_send_estimate(struct dsl_dataset *ds, struct dsl_dataset *fromds,
|
||||
uint64_t *sizep);
|
||||
boolean_t stream_compressed, uint64_t *sizep);
|
||||
int dmu_send_estimate_from_txg(struct dsl_dataset *ds, uint64_t fromtxg,
|
||||
uint64_t *sizep);
|
||||
boolean_t stream_compressed, uint64_t *sizep);
|
||||
int dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap,
|
||||
boolean_t embedok, boolean_t large_block_ok,
|
||||
boolean_t embedok, boolean_t large_block_ok, boolean_t compressok,
|
||||
int outfd, struct vnode *vp, offset_t *off);
|
||||
|
||||
typedef struct dmu_recv_cookie {
|
||||
|
||||
@@ -108,7 +108,9 @@ struct dsl_pool;
|
||||
#define DS_FIELD_RESUME_OBJECT "com.delphix:resume_object"
|
||||
#define DS_FIELD_RESUME_OFFSET "com.delphix:resume_offset"
|
||||
#define DS_FIELD_RESUME_BYTES "com.delphix:resume_bytes"
|
||||
#define DS_FIELD_RESUME_LARGEBLOCK "com.delphix:resume_largeblockok"
|
||||
#define DS_FIELD_RESUME_EMBEDOK "com.delphix:resume_embedok"
|
||||
#define DS_FIELD_RESUME_COMPRESSOK "com.delphix:resume_compressok"
|
||||
|
||||
/*
|
||||
* DS_FLAG_CI_DATASET is set if the dataset contains a file system whose
|
||||
|
||||
@@ -98,7 +98,7 @@ typedef struct refcount {
|
||||
atomic_add_64(&(src)->rc_count, -__tmp); \
|
||||
atomic_add_64(&(dst)->rc_count, __tmp); \
|
||||
}
|
||||
#define refcount_transfer_ownership(rc, current_holder, new_holder)
|
||||
#define refcount_transfer_ownership(rc, current_holder, new_holder) (void)0
|
||||
|
||||
#define refcount_init()
|
||||
#define refcount_fini()
|
||||
|
||||
+17
-6
@@ -96,20 +96,21 @@ typedef enum drr_headertype {
|
||||
#define DMU_BACKUP_FEATURE_SA_SPILL (1 << 2)
|
||||
/* flags #3 - #15 are reserved for incompatible closed-source implementations */
|
||||
#define DMU_BACKUP_FEATURE_EMBED_DATA (1 << 16)
|
||||
#define DMU_BACKUP_FEATURE_EMBED_DATA_LZ4 (1 << 17)
|
||||
#define DMU_BACKUP_FEATURE_LZ4 (1 << 17)
|
||||
/* flag #18 is reserved for a Delphix feature */
|
||||
#define DMU_BACKUP_FEATURE_LARGE_BLOCKS (1 << 19)
|
||||
#define DMU_BACKUP_FEATURE_RESUMING (1 << 20)
|
||||
#define DMU_BACKUP_FEATURE_LARGE_DNODE (1 << 21)
|
||||
#define DMU_BACKUP_FEATURE_COMPRESSED (1 << 22)
|
||||
|
||||
/*
|
||||
* Mask of all supported backup features
|
||||
*/
|
||||
#define DMU_BACKUP_FEATURE_MASK (DMU_BACKUP_FEATURE_DEDUP | \
|
||||
DMU_BACKUP_FEATURE_DEDUPPROPS | DMU_BACKUP_FEATURE_SA_SPILL | \
|
||||
DMU_BACKUP_FEATURE_EMBED_DATA | DMU_BACKUP_FEATURE_EMBED_DATA_LZ4 | \
|
||||
DMU_BACKUP_FEATURE_EMBED_DATA | DMU_BACKUP_FEATURE_LZ4 | \
|
||||
DMU_BACKUP_FEATURE_RESUMING | DMU_BACKUP_FEATURE_LARGE_BLOCKS | \
|
||||
DMU_BACKUP_FEATURE_LARGE_DNODE)
|
||||
DMU_BACKUP_FEATURE_COMPRESSED | DMU_BACKUP_FEATURE_LARGE_DNODE)
|
||||
|
||||
/* Are all features in the given flag word currently supported? */
|
||||
#define DMU_STREAM_SUPPORTED(x) (!((x) & ~DMU_BACKUP_FEATURE_MASK))
|
||||
@@ -162,6 +163,12 @@ typedef enum dmu_send_resume_token_version {
|
||||
|
||||
#define DRR_IS_DEDUP_CAPABLE(flags) ((flags) & DRR_CHECKSUM_DEDUP)
|
||||
|
||||
/* deal with compressed drr_write replay records */
|
||||
#define DRR_WRITE_COMPRESSED(drrw) ((drrw)->drr_compressiontype != 0)
|
||||
#define DRR_WRITE_PAYLOAD_SIZE(drrw) \
|
||||
(DRR_WRITE_COMPRESSED(drrw) ? (drrw)->drr_compressed_size : \
|
||||
(drrw)->drr_logical_size)
|
||||
|
||||
/*
|
||||
* zfs ioctl command structure
|
||||
*/
|
||||
@@ -210,12 +217,16 @@ typedef struct dmu_replay_record {
|
||||
dmu_object_type_t drr_type;
|
||||
uint32_t drr_pad;
|
||||
uint64_t drr_offset;
|
||||
uint64_t drr_length;
|
||||
uint64_t drr_logical_size;
|
||||
uint64_t drr_toguid;
|
||||
uint8_t drr_checksumtype;
|
||||
uint8_t drr_checksumflags;
|
||||
uint8_t drr_pad2[6];
|
||||
ddt_key_t drr_key; /* deduplication key */
|
||||
uint8_t drr_compressiontype;
|
||||
uint8_t drr_pad2[5];
|
||||
/* deduplication key */
|
||||
ddt_key_t drr_key;
|
||||
/* only nonzero if drr_compressiontype is not 0 */
|
||||
uint64_t drr_compressed_size;
|
||||
/* content follows */
|
||||
} drr_write;
|
||||
struct drr_free {
|
||||
|
||||
+4
-22
@@ -98,26 +98,6 @@ enum zio_checksum {
|
||||
#define ZIO_DEDUPCHECKSUM ZIO_CHECKSUM_SHA256
|
||||
#define ZIO_DEDUPDITTO_MIN 100
|
||||
|
||||
enum zio_compress {
|
||||
ZIO_COMPRESS_INHERIT = 0,
|
||||
ZIO_COMPRESS_ON,
|
||||
ZIO_COMPRESS_OFF,
|
||||
ZIO_COMPRESS_LZJB,
|
||||
ZIO_COMPRESS_EMPTY,
|
||||
ZIO_COMPRESS_GZIP_1,
|
||||
ZIO_COMPRESS_GZIP_2,
|
||||
ZIO_COMPRESS_GZIP_3,
|
||||
ZIO_COMPRESS_GZIP_4,
|
||||
ZIO_COMPRESS_GZIP_5,
|
||||
ZIO_COMPRESS_GZIP_6,
|
||||
ZIO_COMPRESS_GZIP_7,
|
||||
ZIO_COMPRESS_GZIP_8,
|
||||
ZIO_COMPRESS_GZIP_9,
|
||||
ZIO_COMPRESS_ZLE,
|
||||
ZIO_COMPRESS_LZ4,
|
||||
ZIO_COMPRESS_FUNCTIONS
|
||||
};
|
||||
|
||||
/*
|
||||
* The number of "legacy" compression functions which can be set on individual
|
||||
* objects.
|
||||
@@ -407,6 +387,8 @@ struct zio {
|
||||
void *io_private;
|
||||
int64_t io_prev_space_delta; /* DMU private */
|
||||
blkptr_t io_bp_orig;
|
||||
/* io_lsize != io_orig_size iff this is a raw write */
|
||||
uint64_t io_lsize;
|
||||
|
||||
/* Data represented by this I/O */
|
||||
void *io_data;
|
||||
@@ -464,11 +446,11 @@ extern zio_t *zio_root(spa_t *spa,
|
||||
zio_done_func_t *done, void *private, enum zio_flag flags);
|
||||
|
||||
extern zio_t *zio_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, void *data,
|
||||
uint64_t size, zio_done_func_t *done, void *private,
|
||||
uint64_t lsize, zio_done_func_t *done, void *private,
|
||||
zio_priority_t priority, enum zio_flag flags, const zbookmark_phys_t *zb);
|
||||
|
||||
extern zio_t *zio_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp,
|
||||
void *data, uint64_t size, const zio_prop_t *zp,
|
||||
void *data, uint64_t size, uint64_t psize, const zio_prop_t *zp,
|
||||
zio_done_func_t *ready, zio_done_func_t *children_ready,
|
||||
zio_done_func_t *physdone, zio_done_func_t *done,
|
||||
void *private, zio_priority_t priority, enum zio_flag flags,
|
||||
|
||||
@@ -22,17 +22,36 @@
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
* Copyright (c) 2015 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ZIO_COMPRESS_H
|
||||
#define _SYS_ZIO_COMPRESS_H
|
||||
|
||||
#include <sys/zio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum zio_compress {
|
||||
ZIO_COMPRESS_INHERIT = 0,
|
||||
ZIO_COMPRESS_ON,
|
||||
ZIO_COMPRESS_OFF,
|
||||
ZIO_COMPRESS_LZJB,
|
||||
ZIO_COMPRESS_EMPTY,
|
||||
ZIO_COMPRESS_GZIP_1,
|
||||
ZIO_COMPRESS_GZIP_2,
|
||||
ZIO_COMPRESS_GZIP_3,
|
||||
ZIO_COMPRESS_GZIP_4,
|
||||
ZIO_COMPRESS_GZIP_5,
|
||||
ZIO_COMPRESS_GZIP_6,
|
||||
ZIO_COMPRESS_GZIP_7,
|
||||
ZIO_COMPRESS_GZIP_8,
|
||||
ZIO_COMPRESS_GZIP_9,
|
||||
ZIO_COMPRESS_ZLE,
|
||||
ZIO_COMPRESS_LZ4,
|
||||
ZIO_COMPRESS_FUNCTIONS
|
||||
};
|
||||
|
||||
/* Common signature for all zio compress functions. */
|
||||
typedef size_t zio_compress_func_t(void *src, void *dst,
|
||||
size_t s_len, size_t d_len, int);
|
||||
|
||||
Reference in New Issue
Block a user