aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMatthew Ahrens <[email protected]>2013-12-11 14:33:41 -0800
committerBrian Behlendorf <[email protected]>2014-07-29 10:55:29 -0700
commitda536844d55b2f3aaefdaebd36fb97bb867494aa (patch)
tree2b0b5bbad2595189476a8084e24f26e6106bbb4d /include
parentb0bc7a84d90dcbf5321d48c5b24ed771c5a128b0 (diff)
Illumos 4368, 4369.
4369 implement zfs bookmarks 4368 zfs send filesystems from readonly pools Reviewed by: Christopher Siden <[email protected]> Reviewed by: George Wilson <[email protected]> Approved by: Garrett D'Amore <[email protected]> References: https://www.illumos.org/issues/4369 https://www.illumos.org/issues/4368 https://github.com/illumos/illumos-gate/commit/78f1710 Ported by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2530
Diffstat (limited to 'include')
-rw-r--r--include/libzfs.h6
-rw-r--r--include/libzfs_core.h32
-rw-r--r--include/libzfs_impl.h4
-rw-r--r--include/sys/Makefile.am1
-rw-r--r--include/sys/dsl_bookmark.h51
-rw-r--r--include/sys/dsl_dataset.h12
-rw-r--r--include/sys/dsl_deleg.h3
-rw-r--r--include/sys/fs/zfs.h14
-rw-r--r--include/zfeature_common.h1
-rw-r--r--include/zfs_deleg.h2
-rw-r--r--include/zfs_namecheck.h5
11 files changed, 105 insertions, 26 deletions
diff --git a/include/libzfs.h b/include/libzfs.h
index 5bc8b03ef..561b34b87 100644
--- a/include/libzfs.h
+++ b/include/libzfs.h
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
@@ -204,6 +204,7 @@ extern int zpool_log_history(libzfs_handle_t *, const char *);
extern int libzfs_errno(libzfs_handle_t *);
extern const char *libzfs_error_action(libzfs_handle_t *);
extern const char *libzfs_error_description(libzfs_handle_t *);
+extern int zfs_standard_error(libzfs_handle_t *, int, const char *);
extern void libzfs_mnttab_init(libzfs_handle_t *);
extern void libzfs_mnttab_fini(libzfs_handle_t *);
extern void libzfs_mnttab_cache(libzfs_handle_t *, boolean_t);
@@ -557,6 +558,7 @@ extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *);
extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *);
extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *);
extern int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, void *);
+extern int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *);
typedef struct get_all_cb {
zfs_handle_t **cb_handles;
@@ -618,6 +620,7 @@ typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *);
extern int zfs_send(zfs_handle_t *, const char *, const char *,
sendflags_t *, int, snapfilter_cb_t, void *, nvlist_t **);
+extern int zfs_send_one(zfs_handle_t *, const char *, int);
extern int zfs_promote(zfs_handle_t *);
extern int zfs_hold(zfs_handle_t *, const char *, const char *,
@@ -687,6 +690,7 @@ extern zfs_handle_t *zfs_path_to_zhandle(libzfs_handle_t *, char *, zfs_type_t);
extern boolean_t zfs_dataset_exists(libzfs_handle_t *, const char *,
zfs_type_t);
extern int zfs_spa_version(zfs_handle_t *, int *);
+extern boolean_t zfs_bookmark_exists(const char *path);
extern int zfs_append_partition(char *path, size_t max_len);
extern int zfs_resolve_shortname(const char *name, char *path, size_t pathlen);
extern int zfs_strcmp_pathname(char *name, char *cmp_name, int wholedisk);
diff --git a/include/libzfs_core.h b/include/libzfs_core.h
index 3642dc7af..484a48afe 100644
--- a/include/libzfs_core.h
+++ b/include/libzfs_core.h
@@ -38,27 +38,27 @@ extern "C" {
int libzfs_core_init(void);
void libzfs_core_fini(void);
-int lzc_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t **errlist);
-int lzc_create(const char *fsname, dmu_objset_type_t type, nvlist_t *props);
-int lzc_clone(const char *fsname, const char *origin, nvlist_t *props);
-int lzc_destroy_snaps(nvlist_t *snaps, boolean_t defer, nvlist_t **errlist);
+int lzc_snapshot(nvlist_t *, nvlist_t *, nvlist_t **);
+int lzc_create(const char *, dmu_objset_type_t, nvlist_t *);
+int lzc_clone(const char *, const char *, nvlist_t *);
+int lzc_destroy_snaps(nvlist_t *, boolean_t, nvlist_t **);
+int lzc_bookmark(nvlist_t *, nvlist_t **);
+int lzc_get_bookmarks(const char *, nvlist_t *, nvlist_t **);
+int lzc_destroy_bookmarks(nvlist_t *, nvlist_t **);
-int lzc_snaprange_space(const char *firstsnap, const char *lastsnap,
- uint64_t *usedp);
+int lzc_snaprange_space(const char *, const char *, uint64_t *);
-int lzc_hold(nvlist_t *holds, int cleanup_fd, nvlist_t **errlist);
-int lzc_release(nvlist_t *holds, nvlist_t **errlist);
-int lzc_get_holds(const char *snapname, nvlist_t **holdsp);
+int lzc_hold(nvlist_t *, int, nvlist_t **);
+int lzc_release(nvlist_t *, nvlist_t **);
+int lzc_get_holds(const char *, nvlist_t **);
-int lzc_send(const char *snapname, const char *fromsnap, int fd);
-int lzc_receive(const char *snapname, nvlist_t *props, const char *origin,
- boolean_t force, int fd);
-int lzc_send_space(const char *snapname, const char *fromsnap,
- uint64_t *result);
+int lzc_send(const char *, const char *, int);
+int lzc_receive(const char *, nvlist_t *, const char *, boolean_t, int);
+int lzc_send_space(const char *, const char *, uint64_t *);
-boolean_t lzc_exists(const char *dataset);
+boolean_t lzc_exists(const char *);
-int lzc_rollback(const char *fsname, char *snapnamebuf, int snapnamelen);
+int lzc_rollback(const char *, char *, int);
#ifdef __cplusplus
}
diff --git a/include/libzfs_impl.h b/include/libzfs_impl.h
index 5502455e0..e805e3ee7 100644
--- a/include/libzfs_impl.h
+++ b/include/libzfs_impl.h
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
#ifndef _LIBZFS_IMPL_H
@@ -190,6 +190,8 @@ int create_parents(libzfs_handle_t *, char *, int);
boolean_t isa_child_of(const char *dataset, const char *parent);
zfs_handle_t *make_dataset_handle(libzfs_handle_t *, const char *);
+zfs_handle_t *make_bookmark_handle(zfs_handle_t *, const char *,
+ nvlist_t *props);
int zpool_open_silent(libzfs_handle_t *, const char *, zpool_handle_t **);
diff --git a/include/sys/Makefile.am b/include/sys/Makefile.am
index 4115c6d8f..90f3cce1b 100644
--- a/include/sys/Makefile.am
+++ b/include/sys/Makefile.am
@@ -17,6 +17,7 @@ COMMON_H = \
$(top_srcdir)/include/sys/dmu_tx.h \
$(top_srcdir)/include/sys/dmu_zfetch.h \
$(top_srcdir)/include/sys/dnode.h \
+ $(top_srcdir)/include/sys/dsl_bookmark.h \
$(top_srcdir)/include/sys/dsl_dataset.h \
$(top_srcdir)/include/sys/dsl_deadlist.h \
$(top_srcdir)/include/sys/dsl_deleg.h \
diff --git a/include/sys/dsl_bookmark.h b/include/sys/dsl_bookmark.h
new file mode 100644
index 000000000..3591986d7
--- /dev/null
+++ b/include/sys/dsl_bookmark.h
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2013 by Delphix. All rights reserved.
+ */
+
+#ifndef _SYS_DSL_BOOKMARK_H
+#define _SYS_DSL_BOOKMARK_H
+
+#include <sys/zfs_context.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct dsl_pool;
+struct dsl_dataset;
+
+/*
+ * On disk zap object.
+ */
+typedef struct zfs_bookmark_phys {
+ uint64_t zbm_guid; /* guid of bookmarked dataset */
+ uint64_t zbm_creation_txg; /* birth transaction group */
+ uint64_t zbm_creation_time; /* bookmark creation time */
+} zfs_bookmark_phys_t;
+
+int dsl_bookmark_create(nvlist_t *, nvlist_t *);
+int dsl_get_bookmarks(const char *, nvlist_t *, nvlist_t *);
+int dsl_get_bookmarks_impl(dsl_dataset_t *, nvlist_t *, nvlist_t *);
+int dsl_bookmark_destroy(nvlist_t *, nvlist_t *);
+int dsl_bookmark_lookup(struct dsl_pool *, const char *,
+ struct dsl_dataset *, zfs_bookmark_phys_t *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_DSL_BOOKMARK_H */
diff --git a/include/sys/dsl_dataset.h b/include/sys/dsl_dataset.h
index 27ef405e0..4979ae615 100644
--- a/include/sys/dsl_dataset.h
+++ b/include/sys/dsl_dataset.h
@@ -76,6 +76,13 @@ struct dsl_pool;
*/
/*
+ * This field's value is the object ID of a zap object which contains the
+ * bookmarks of this dataset. If it is present, then this dataset is counted
+ * in the refcount of the SPA_FEATURES_BOOKMARKS feature.
+ */
+#define DS_FIELD_BOOKMARK_NAMES "com.delphix:bookmarks"
+
+/*
* DS_FLAG_CI_DATASET is set if the dataset contains a file system whose
* name lookups should be performed case-insensitively.
*/
@@ -127,6 +134,7 @@ typedef struct dsl_dataset {
/* only used in syncing context, only valid for non-snapshots: */
struct dsl_dataset *ds_prev;
+ uint64_t ds_bookmarks; /* DMU_OTN_ZAP_METADATA */
/* has internal locking: */
dsl_deadlist_t ds_deadlist;
@@ -247,7 +255,8 @@ int dsl_dataset_set_refquota(const char *dsname, zprop_source_t source,
int dsl_dataset_set_refreservation(const char *dsname, zprop_source_t source,
uint64_t reservation);
-boolean_t dsl_dataset_is_before(dsl_dataset_t *later, dsl_dataset_t *earlier);
+boolean_t dsl_dataset_is_before(dsl_dataset_t *later, dsl_dataset_t *earlier,
+ uint64_t earlier_txg);
void dsl_dataset_long_hold(dsl_dataset_t *ds, void *tag);
void dsl_dataset_long_rele(dsl_dataset_t *ds, void *tag);
boolean_t dsl_dataset_long_held(dsl_dataset_t *ds);
@@ -270,6 +279,7 @@ int dsl_dataset_snap_lookup(dsl_dataset_t *ds, const char *name,
int dsl_dataset_snap_remove(dsl_dataset_t *ds, const char *name, dmu_tx_t *tx);
void dsl_dataset_set_refreservation_sync_impl(dsl_dataset_t *ds,
zprop_source_t source, uint64_t value, dmu_tx_t *tx);
+void dsl_dataset_zapify(dsl_dataset_t *ds, dmu_tx_t *tx);
int dsl_dataset_rollback(const char *fsname, void *owner, nvlist_t *result);
#ifdef ZFS_DEBUG
diff --git a/include/sys/dsl_deleg.h b/include/sys/dsl_deleg.h
index 5842639aa..59e8e0555 100644
--- a/include/sys/dsl_deleg.h
+++ b/include/sys/dsl_deleg.h
@@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
#ifndef _SYS_DSL_DELEG_H
@@ -56,6 +56,7 @@ extern "C" {
#define ZFS_DELEG_PERM_HOLD "hold"
#define ZFS_DELEG_PERM_RELEASE "release"
#define ZFS_DELEG_PERM_DIFF "diff"
+#define ZFS_DELEG_PERM_BOOKMARK "bookmark"
/*
* Note: the names of properties that are marked delegatable are also
diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h
index 7b3ae6cff..53f2718ab 100644
--- a/include/sys/fs/zfs.h
+++ b/include/sys/fs/zfs.h
@@ -46,10 +46,11 @@ extern "C" {
* combined into masks that can be passed to various functions.
*/
typedef enum {
- ZFS_TYPE_FILESYSTEM = 0x1,
- ZFS_TYPE_SNAPSHOT = 0x2,
- ZFS_TYPE_VOLUME = 0x4,
- ZFS_TYPE_POOL = 0x8
+ ZFS_TYPE_FILESYSTEM = (1 << 0),
+ ZFS_TYPE_SNAPSHOT = (1 << 1),
+ ZFS_TYPE_VOLUME = (1 << 2),
+ ZFS_TYPE_POOL = (1 << 3),
+ ZFS_TYPE_BOOKMARK = (1 << 4)
} zfs_type_t;
typedef enum dmu_objset_type {
@@ -786,7 +787,7 @@ typedef struct ddt_histogram {
*/
typedef enum zfs_ioc {
/*
- * Illumos - 69/128 numbers reserved.
+ * Illumos - 70/128 numbers reserved.
*/
ZFS_IOC_FIRST = ('Z' << 8),
ZFS_IOC = ZFS_IOC_FIRST,
@@ -857,6 +858,9 @@ typedef enum zfs_ioc {
ZFS_IOC_SEND_NEW,
ZFS_IOC_SEND_SPACE,
ZFS_IOC_CLONE,
+ ZFS_IOC_BOOKMARK,
+ ZFS_IOC_GET_BOOKMARKS,
+ ZFS_IOC_DESTROY_BOOKMARKS,
/*
* Linux - 3/64 numbers reserved.
diff --git a/include/zfeature_common.h b/include/zfeature_common.h
index bc774184a..acf239829 100644
--- a/include/zfeature_common.h
+++ b/include/zfeature_common.h
@@ -46,6 +46,7 @@ typedef enum spa_feature {
SPA_FEATURE_ENABLED_TXG,
SPA_FEATURE_HOLE_BIRTH,
SPA_FEATURE_EXTENSIBLE_DATASET,
+ SPA_FEATURE_BOOKMARKS,
SPA_FEATURES
} spa_feature_t;
diff --git a/include/zfs_deleg.h b/include/zfs_deleg.h
index 9997dffae..16133c59f 100644
--- a/include/zfs_deleg.h
+++ b/include/zfs_deleg.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
#ifndef _ZFS_DELEG_H
@@ -65,6 +66,7 @@ typedef enum {
ZFS_DELEG_NOTE_HOLD,
ZFS_DELEG_NOTE_RELEASE,
ZFS_DELEG_NOTE_DIFF,
+ ZFS_DELEG_NOTE_BOOKMARK,
ZFS_DELEG_NOTE_NONE
} zfs_deleg_note_t;
diff --git a/include/zfs_namecheck.h b/include/zfs_namecheck.h
index 7711da099..cbefbaa0d 100644
--- a/include/zfs_namecheck.h
+++ b/include/zfs_namecheck.h
@@ -22,6 +22,9 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2013 by Delphix. All rights reserved.
+ */
#ifndef _ZFS_NAMECHECK_H
#define _ZFS_NAMECHECK_H
@@ -48,7 +51,7 @@ typedef enum {
int pool_namecheck(const char *, namecheck_err_t *, char *);
int dataset_namecheck(const char *, namecheck_err_t *, char *);
int mountpoint_namecheck(const char *, namecheck_err_t *);
-int snapshot_namecheck(const char *, namecheck_err_t *, char *);
+int zfs_component_namecheck(const char *, namecheck_err_t *, char *);
int permset_namecheck(const char *, namecheck_err_t *, char *);
#ifdef __cplusplus