diff options
author | Christian Schwarz <[email protected]> | 2019-11-10 23:24:14 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2020-02-11 13:19:12 -0800 |
commit | a73f361fdb2c0a7778e70b482e316054fc2d8630 (patch) | |
tree | 094642f07952d4149c2dab358a35910961d0c42e /include/sys | |
parent | 7b49bbc8164a8a5cd31cf1ba7a6cd88269fec8d0 (diff) |
Implement bookmark copying
This feature allows copying existing bookmarks using
zfs bookmark fs#target fs#newbookmark
There are some niche use cases for such functionality,
e.g. when using bookmarks as markers for replication progress.
Copying redaction bookmarks produces a normal bookmark that
cannot be used for redacted send (we are not duplicating
the redaction object).
ZCP support for bookmarking (both creation and copying) will be
implemented in a separate patch based on this work.
Overview:
- Terminology:
- source = existing snapshot or bookmark
- new/bmark = new bookmark
- Implement bookmark copying in `dsl_bookmark.c`
- create new bookmark node
- copy source's `zbn_phys` to new's `zbn_phys`
- zero-out redaction object id in copy
- Extend existing bookmark ioctl nvlist schema to accept
bookmarks as sources
- => `dsl_bookmark_create_nvl_validate` is authoritative
- use `dsl_dataset_is_before` check for both snapshot
and bookmark sources
- Adjust CLI
- refactor shortname expansion logic in `zfs_do_bookmark`
- Update man pages
- warn about redaction bookmark handling
- Add test cases
- CLI
- pyyzfs libzfs_core bindings
Reviewed-by: Matt Ahrens <[email protected]>
Reviewed-by: Paul Dagnelie <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Christian Schwarz <[email protected]>
Closes #9571
Diffstat (limited to 'include/sys')
-rw-r--r-- | include/sys/dsl_bookmark.h | 1 | ||||
-rw-r--r-- | include/sys/fs/zfs.h | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/include/sys/dsl_bookmark.h b/include/sys/dsl_bookmark.h index 7e4b8f02f..ec3895d40 100644 --- a/include/sys/dsl_bookmark.h +++ b/include/sys/dsl_bookmark.h @@ -103,6 +103,7 @@ typedef struct redact_block_phys { typedef int (*rl_traverse_callback_t)(redact_block_phys_t *, void *); int dsl_bookmark_create(nvlist_t *, nvlist_t *); +int dsl_bookmark_create_nvl_validate(nvlist_t *); int dsl_bookmark_create_redacted(const char *, const char *, uint64_t, uint64_t *, void *, redaction_list_t **); int dsl_get_bookmarks(const char *, nvlist_t *, nvlist_t *); diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h index 3e2c00235..f919bd9b1 100644 --- a/include/sys/fs/zfs.h +++ b/include/sys/fs/zfs.h @@ -1310,6 +1310,8 @@ typedef enum zfs_ioc { * not described precisely by generic errno codes. * * These numbers should not change over time. New entries should be appended. + * + * (Keep in sync with contrib/pyzfs/libzfs_core/_constants.py) */ typedef enum { ZFS_ERR_CHECKPOINT_EXISTS = 1024, @@ -1327,6 +1329,7 @@ typedef enum { ZFS_ERR_SPILL_BLOCK_FLAG_MISSING, ZFS_ERR_UNKNOWN_SEND_STREAM_FEATURE, ZFS_ERR_EXPORT_IN_PROGRESS, + ZFS_ERR_BOOKMARK_SOURCE_NOT_ANCESTOR, } zfs_errno_t; /* |