Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send/recv: open up additional stream feature flags #15454

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 30 additions & 34 deletions include/sys/zfs_ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,36 @@ extern "C" {
#define ZFS_ACLTYPE_POSIX 1
#define ZFS_ACLTYPE_NFSV4 2

/*
* The drr_versioninfo field of the dmu_replay_record has the
* following layout:
*
* 64 56 48 40 32 24 16 8 0
* +-------+-------+-------+-------+-------+-------+-------+-------+
* |reserve| feature-flags |C|S|
* +-------+-------+-------+-------+-------+-------+-------+-------+
*
* The low order two bits indicate the header type: SUBSTREAM (0x1)
* or COMPOUNDSTREAM (0x2). Using two bits for this is historical:
* this field used to be a version number, where the two version types
* were 1 and 2. Using two bits for this allows earlier versions of
* the code to be able to recognize send streams that don't use any
* of the features indicated by feature flags.
*
* The top 8 bits are reserved for future expansion. At time of writing there
* are no plans for these. If you want to use them, please reach out to the
* OpenZFS community, e.g., on GitHub or Slack.
*/

/*
* Field manipulation macros for the drr_versioninfo field of the
* send stream header.
*/
#define DMU_GET_STREAM_HDRTYPE(vi) BF64_GET((vi), 0, 2)
#define DMU_SET_STREAM_HDRTYPE(vi, x) BF64_SET((vi), 0, 2, x)

#define DMU_GET_FEATUREFLAGS(vi) BF64_GET((vi), 2, 56)
#define DMU_SET_FEATUREFLAGS(vi, x) BF64_SET((vi), 2, 56, x)
robn marked this conversation as resolved.
Show resolved Hide resolved

/*
* Header types for zfs send streams.
Expand All @@ -83,16 +109,9 @@ typedef enum drr_headertype {
DMU_COMPOUNDSTREAM = 0x2
} drr_headertype_t;

#define DMU_GET_STREAM_HDRTYPE(vi) BF64_GET((vi), 0, 2)
#define DMU_SET_STREAM_HDRTYPE(vi, x) BF64_SET((vi), 0, 2, x)

#define DMU_GET_FEATUREFLAGS(vi) BF64_GET((vi), 2, 30)
#define DMU_SET_FEATUREFLAGS(vi, x) BF64_SET((vi), 2, 30, x)

/*
* Feature flags for zfs send streams (flags in drr_versioninfo)
*/

#define DMU_BACKUP_FEATURE_DEDUP (1 << 0)
#define DMU_BACKUP_FEATURE_DEDUPPROPS (1 << 1)
#define DMU_BACKUP_FEATURE_SA_SPILL (1 << 2)
Expand Down Expand Up @@ -125,12 +144,6 @@ typedef enum drr_headertype {
*/
#define DMU_BACKUP_FEATURE_SWITCH_TO_LARGE_BLOCKS (1 << 27)
/* flag #28 is reserved for a Nutanix feature */
/*
* flag #29 is the last unused bit. It is reserved to indicate a to-be-designed
* extension to the stream format which will accomodate more feature flags.
* If you need to add another feature flag, please reach out to the OpenZFS
* community, e.g., on GitHub or Slack.
*/

/*
* Mask of all supported backup features
Expand All @@ -150,23 +163,6 @@ typedef enum dmu_send_resume_token_version {
ZFS_SEND_RESUME_TOKEN_VERSION = 1
} dmu_send_resume_token_version_t;

/*
* The drr_versioninfo field of the dmu_replay_record has the
* following layout:
*
* 64 56 48 40 32 24 16 8 0
* +-------+-------+-------+-------+-------+-------+-------+-------+
* | reserved | feature-flags |C|S|
* +-------+-------+-------+-------+-------+-------+-------+-------+
*
* The low order two bits indicate the header type: SUBSTREAM (0x1)
* or COMPOUNDSTREAM (0x2). Using two bits for this is historical:
* this field used to be a version number, where the two version types
* were 1 and 2. Using two bits for this allows earlier versions of
* the code to be able to recognize send streams that don't use any
* of the features indicated by feature flags.
*/

#define DMU_BACKUP_MAGIC 0x2F5bacbacULL

/*
Expand Down Expand Up @@ -230,10 +226,6 @@ typedef enum dmu_send_resume_token_version {
((drro)->drr_raw_bonuslen != 0 ? \
(drro)->drr_raw_bonuslen : P2ROUNDUP((drro)->drr_bonuslen, 8))

/*
* zfs ioctl command structure
*/

/* Header is used in C++ so can't forward declare untagged struct */
struct drr_begin {
uint64_t drr_magic;
Expand Down Expand Up @@ -477,6 +469,10 @@ typedef enum zfs_case {
ZFS_CASE_MIXED
} zfs_case_t;

/*
* zfs ioctl command structure
*/

/*
* Note: this struct must have the same layout in 32-bit and 64-bit, so
* that 32-bit processes (like /sbin/zfs) can pass it to the 64-bit
Expand Down
Loading