Skip to content

Commit 6c934a9

Browse files
ahrensjsai20
authored andcommitted
Remove deduplicated send/receive code
Deduplicated send streams (i.e. `zfs send -D` and `zfs receive` of such streams) are deprecated. Deduplicated send streams can be received by first converting them to non-deduplicated with the `zstream redup` command. This commit removes the code for sending and receiving deduplicated send streams. `zfs send -D` will now print a warning, ignore the `-D` flag, and generate a regular (non-deduplicated) send stream. `zfs receive` of a deduplicated send stream will print an error message and fail. The resulting code simplification (especially in the kernel's support for receiving dedup streams) should help enable future performance enhancements. Several new tests are added which leverage `zstream redup`. Reviewed-by: Paul Dagnelie <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Matthew Ahrens <[email protected]> Issue openzfs#7887 Issue openzfs#10117 Issue openzfs#10156 Closes openzfs#10212
1 parent 8ba6810 commit 6c934a9

26 files changed

+219
-1081
lines changed

cmd/zfs/zfs_main.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/*
2323
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24-
* Copyright (c) 2011, 2019 by Delphix. All rights reserved.
24+
* Copyright (c) 2011, 2020 by Delphix. All rights reserved.
2525
* Copyright 2012 Milan Jurik. All rights reserved.
2626
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
2727
* Copyright (c) 2013 Steven Hartland. All rights reserved.
@@ -4266,7 +4266,10 @@ zfs_do_send(int argc, char **argv)
42664266
flags.progress = B_TRUE;
42674267
break;
42684268
case 'D':
4269-
flags.dedup = B_TRUE;
4269+
(void) fprintf(stderr,
4270+
gettext("WARNING: deduplicated send is no "
4271+
"longer supported. A regular,\n"
4272+
"non-deduplicated stream will be generated.\n\n"));
42704273
break;
42714274
case 'n':
42724275
flags.dryrun = B_TRUE;
@@ -4333,16 +4336,6 @@ zfs_do_send(int argc, char **argv)
43334336
}
43344337
}
43354338

4336-
if (flags.dedup) {
4337-
(void) fprintf(stderr,
4338-
gettext("WARNING: deduplicated send is "
4339-
"deprecated, and will be removed in a\n"
4340-
"future release. (In the future, the flag will be "
4341-
"accepted, but a\n"
4342-
"regular, non-deduplicated stream will be "
4343-
"generated.)\n\n"));
4344-
}
4345-
43464339
if (flags.parsable && flags.verbosity == 0)
43474340
flags.verbosity = 1;
43484341

@@ -4351,7 +4344,7 @@ zfs_do_send(int argc, char **argv)
43514344

43524345
if (resume_token != NULL) {
43534346
if (fromname != NULL || flags.replicate || flags.props ||
4354-
flags.backup || flags.dedup || flags.holds ||
4347+
flags.backup || flags.holds ||
43554348
flags.saved || redactbook != NULL) {
43564349
(void) fprintf(stderr,
43574350
gettext("invalid flags combined with -t\n"));
@@ -4375,7 +4368,7 @@ zfs_do_send(int argc, char **argv)
43754368

43764369
if (flags.saved) {
43774370
if (fromname != NULL || flags.replicate || flags.props ||
4378-
flags.doall || flags.backup || flags.dedup ||
4371+
flags.doall || flags.backup ||
43794372
flags.holds || flags.largeblock || flags.embed_data ||
43804373
flags.compress || flags.raw || redactbook != NULL) {
43814374
(void) fprintf(stderr, gettext("incompatible flags "

include/libzfs.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/*
2323
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24-
* Copyright (c) 2011, 2018 by Delphix. All rights reserved.
24+
* Copyright (c) 2011, 2020 by Delphix. All rights reserved.
2525
* Copyright Joyent, Inc.
2626
* Copyright (c) 2013 Steven Hartland. All rights reserved.
2727
* Copyright (c) 2016, Intel Corporation.
@@ -651,8 +651,8 @@ typedef struct sendflags {
651651
/* if dataset is a clone, do incremental from its origin */
652652
boolean_t fromorigin;
653653

654-
/* do deduplication */
655-
boolean_t dedup;
654+
/* field no longer used, maintained for backwards compatibility */
655+
boolean_t pad;
656656

657657
/* send properties (ie, -p) */
658658
boolean_t props;

include/libzfs_impl.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/*
2323
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24-
* Copyright (c) 2011, 2017 by Delphix. All rights reserved.
24+
* Copyright (c) 2011, 2020 by Delphix. All rights reserved.
2525
* Copyright (c) 2018 Datto Inc.
2626
*/
2727

@@ -71,7 +71,6 @@ struct libzfs_handle {
7171
int libzfs_pool_iter;
7272
char libzfs_chassis_id[256];
7373
boolean_t libzfs_prop_debug;
74-
boolean_t libzfs_dedup_warning_printed;
7574
};
7675

7776
#define ZFSSHARE_MISS 0x01 /* Didn't find entry in cache */

include/sys/dmu.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
/*
2222
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23-
* Copyright (c) 2011, 2018 by Delphix. All rights reserved.
23+
* Copyright (c) 2011, 2020 by Delphix. All rights reserved.
2424
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
2525
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
2626
* Copyright 2014 HybridCluster. All rights reserved.
@@ -864,8 +864,6 @@ int dmu_assign_arcbuf_by_dnode(dnode_t *dn, uint64_t offset,
864864
int dmu_assign_arcbuf_by_dbuf(dmu_buf_t *handle, uint64_t offset,
865865
struct arc_buf *buf, dmu_tx_t *tx);
866866
#define dmu_assign_arcbuf dmu_assign_arcbuf_by_dbuf
867-
void dmu_copy_from_buf(objset_t *os, uint64_t object, uint64_t offset,
868-
dmu_buf_t *handle, dmu_tx_t *tx);
869867
#ifdef HAVE_UIO_ZEROCOPY
870868
int dmu_xuio_init(struct xuio *uio, int niov);
871869
void dmu_xuio_fini(struct xuio *uio);

include/sys/dmu_recv.h

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/*
2323
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24-
* Copyright (c) 2012, 2018 by Delphix. All rights reserved.
24+
* Copyright (c) 2012, 2020 by Delphix. All rights reserved.
2525
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
2626
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
2727
*/
@@ -53,10 +53,8 @@ typedef struct dmu_recv_cookie {
5353
boolean_t drc_raw;
5454
boolean_t drc_clone;
5555
boolean_t drc_spill;
56-
struct avl_tree *drc_guid_to_ds_map;
5756
nvlist_t *drc_keynvl;
5857
uint64_t drc_fromsnapobj;
59-
uint64_t drc_newsnapobj;
6058
uint64_t drc_ivset_guid;
6159
void *drc_owner;
6260
cred_t *drc_cred;
@@ -80,13 +78,11 @@ typedef struct dmu_recv_cookie {
8078
objlist_t *drc_ignore_objlist;
8179
} dmu_recv_cookie_t;
8280

83-
int dmu_recv_begin(char *tofs, char *tosnap, dmu_replay_record_t *drr_begin,
84-
boolean_t force, boolean_t resumable, nvlist_t *localprops,
85-
nvlist_t *hidden_args, char *origin, dmu_recv_cookie_t *drc,
86-
zfs_file_t *fp, offset_t *voffp);
87-
int dmu_recv_stream(dmu_recv_cookie_t *drc, int cleanup_fd,
88-
uint64_t *action_handlep, offset_t *voffp);
89-
int dmu_recv_end(dmu_recv_cookie_t *drc, void *owner);
90-
boolean_t dmu_objset_is_receiving(objset_t *os);
81+
int dmu_recv_begin(char *, char *, dmu_replay_record_t *,
82+
boolean_t, boolean_t, nvlist_t *, nvlist_t *, char *,
83+
dmu_recv_cookie_t *, zfs_file_t *, offset_t *);
84+
int dmu_recv_stream(dmu_recv_cookie_t *, offset_t *);
85+
int dmu_recv_end(dmu_recv_cookie_t *, void *);
86+
boolean_t dmu_objset_is_receiving(objset_t *);
9187

9288
#endif /* _DMU_RECV_H */

include/sys/zfs_ioctl.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
/*
2222
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23-
* Copyright (c) 2012, 2018 by Delphix. All rights reserved.
23+
* Copyright (c) 2012, 2020 by Delphix. All rights reserved.
2424
* Copyright 2016 RackTop Systems.
2525
* Copyright (c) 2017, Intel Corporation.
2626
*/
@@ -111,8 +111,7 @@ typedef enum drr_headertype {
111111
/*
112112
* Mask of all supported backup features
113113
*/
114-
#define DMU_BACKUP_FEATURE_MASK (DMU_BACKUP_FEATURE_DEDUP | \
115-
DMU_BACKUP_FEATURE_DEDUPPROPS | DMU_BACKUP_FEATURE_SA_SPILL | \
114+
#define DMU_BACKUP_FEATURE_MASK (DMU_BACKUP_FEATURE_SA_SPILL | \
116115
DMU_BACKUP_FEATURE_EMBED_DATA | DMU_BACKUP_FEATURE_LZ4 | \
117116
DMU_BACKUP_FEATURE_RESUMING | DMU_BACKUP_FEATURE_LARGE_BLOCKS | \
118117
DMU_BACKUP_FEATURE_COMPRESSED | DMU_BACKUP_FEATURE_LARGE_DNODE | \

include/sys/zfs_onexit.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
/*
2323
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24+
* Copyright (c) 2020 by Delphix. All rights reserved.
2425
*/
2526

2627
#ifndef _SYS_ZFS_ONEXIT_H
@@ -54,10 +55,6 @@ extern int zfs_onexit_fd_hold(int fd, minor_t *minorp);
5455
extern void zfs_onexit_fd_rele(int fd);
5556
extern int zfs_onexit_add_cb(minor_t minor, void (*func)(void *), void *data,
5657
uint64_t *action_handle);
57-
extern int zfs_onexit_del_cb(minor_t minor, uint64_t action_handle,
58-
boolean_t fire);
59-
extern int zfs_onexit_cb_data(minor_t minor, uint64_t action_handle,
60-
void **data);
6158

6259
#ifdef __cplusplus
6360
}

0 commit comments

Comments
 (0)