Print this page
2882 implement libzfs_core
2883 changing "canmount" property to "on" should not always remount dataset
2900 "zfs snapshot" should be able to create multiple, arbitrary snapshots at once
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Chris Siden <christopher.siden@delphix.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Bill Pijewski <wdp@joyent.com>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>


 163         char ds_snapname[MAXNAMELEN];
 164 } dsl_dataset_t;
 165 
 166 struct dsl_ds_destroyarg {
 167         dsl_dataset_t *ds;              /* ds to destroy */
 168         dsl_dataset_t *rm_origin;       /* also remove our origin? */
 169         boolean_t is_origin_rm;         /* set if removing origin snap */
 170         boolean_t defer;                /* destroy -d requested? */
 171         boolean_t releasing;            /* destroying due to release? */
 172         boolean_t need_prep;            /* do we need to retry due to EBUSY? */
 173 };
 174 
 175 /*
 176  * The max length of a temporary tag prefix is the number of hex digits
 177  * required to express UINT64_MAX plus one for the hyphen.
 178  */
 179 #define MAX_TAG_PREFIX_LEN      17
 180 
 181 struct dsl_ds_holdarg {
 182         dsl_sync_task_group_t *dstg;
 183         char *htag;
 184         char *snapname;
 185         boolean_t recursive;
 186         boolean_t gotone;
 187         boolean_t temphold;
 188         char failed[MAXPATHLEN];
 189 };
 190 
 191 #define dsl_dataset_is_snapshot(ds) \
 192         ((ds)->ds_phys->ds_num_children != 0)
 193 
 194 #define DS_UNIQUE_IS_ACCURATE(ds)       \
 195         (((ds)->ds_phys->ds_flags & DS_FLAG_UNIQUE_ACCURATE) != 0)
 196 
 197 int dsl_dataset_hold(const char *name, void *tag, dsl_dataset_t **dsp);
 198 int dsl_dataset_hold_obj(struct dsl_pool *dp, uint64_t dsobj,
 199     void *tag, dsl_dataset_t **);
 200 int dsl_dataset_own(const char *name, boolean_t inconsistentok,
 201     void *tag, dsl_dataset_t **dsp);
 202 int dsl_dataset_own_obj(struct dsl_pool *dp, uint64_t dsobj,
 203     boolean_t inconsistentok, void *tag, dsl_dataset_t **dsp);
 204 void dsl_dataset_name(dsl_dataset_t *ds, char *name);
 205 void dsl_dataset_rele(dsl_dataset_t *ds, void *tag);
 206 void dsl_dataset_disown(dsl_dataset_t *ds, void *tag);
 207 void dsl_dataset_drop_ref(dsl_dataset_t *ds, void *tag);
 208 boolean_t dsl_dataset_tryown(dsl_dataset_t *ds, boolean_t inconsistentok,
 209     void *tag);
 210 void dsl_dataset_make_exclusive(dsl_dataset_t *ds, void *tag);
 211 void dsl_register_onexit_hold_cleanup(dsl_dataset_t *ds, const char *htag,
 212     minor_t minor);
 213 uint64_t dsl_dataset_create_sync(dsl_dir_t *pds, const char *lastname,
 214     dsl_dataset_t *origin, uint64_t flags, cred_t *, dmu_tx_t *);
 215 uint64_t dsl_dataset_create_sync_dd(dsl_dir_t *dd, dsl_dataset_t *origin,
 216     uint64_t flags, dmu_tx_t *tx);
 217 int dsl_dataset_destroy(dsl_dataset_t *ds, void *tag, boolean_t defer);
 218 int dsl_snapshots_destroy(char *fsname, char *snapname, boolean_t defer);
 219 dsl_checkfunc_t dsl_dataset_destroy_check;
 220 dsl_syncfunc_t dsl_dataset_destroy_sync;
 221 dsl_checkfunc_t dsl_dataset_snapshot_check;
 222 dsl_syncfunc_t dsl_dataset_snapshot_sync;
 223 dsl_syncfunc_t dsl_dataset_user_hold_sync;


 224 int dsl_dataset_rename(char *name, const char *newname, boolean_t recursive);
 225 int dsl_dataset_promote(const char *name, char *conflsnap);
 226 int dsl_dataset_clone_swap(dsl_dataset_t *clone, dsl_dataset_t *origin_head,
 227     boolean_t force);
 228 int dsl_dataset_user_hold(char *dsname, char *snapname, char *htag,
 229     boolean_t recursive, boolean_t temphold, int cleanup_fd);
 230 int dsl_dataset_user_hold_for_send(dsl_dataset_t *ds, char *htag,
 231     boolean_t temphold);
 232 int dsl_dataset_user_release(char *dsname, char *snapname, char *htag,
 233     boolean_t recursive);
 234 int dsl_dataset_user_release_tmp(struct dsl_pool *dp, uint64_t dsobj,
 235     char *htag, boolean_t retry);
 236 int dsl_dataset_get_holds(const char *dsname, nvlist_t **nvp);
 237 
 238 blkptr_t *dsl_dataset_get_blkptr(dsl_dataset_t *ds);
 239 void dsl_dataset_set_blkptr(dsl_dataset_t *ds, blkptr_t *bp, dmu_tx_t *tx);
 240 
 241 spa_t *dsl_dataset_get_spa(dsl_dataset_t *ds);
 242 
 243 boolean_t dsl_dataset_modified_since_lastsnap(dsl_dataset_t *ds);




 163         char ds_snapname[MAXNAMELEN];
 164 } dsl_dataset_t;
 165 
 166 struct dsl_ds_destroyarg {
 167         dsl_dataset_t *ds;              /* ds to destroy */
 168         dsl_dataset_t *rm_origin;       /* also remove our origin? */
 169         boolean_t is_origin_rm;         /* set if removing origin snap */
 170         boolean_t defer;                /* destroy -d requested? */
 171         boolean_t releasing;            /* destroying due to release? */
 172         boolean_t need_prep;            /* do we need to retry due to EBUSY? */
 173 };
 174 
 175 /*
 176  * The max length of a temporary tag prefix is the number of hex digits
 177  * required to express UINT64_MAX plus one for the hyphen.
 178  */
 179 #define MAX_TAG_PREFIX_LEN      17
 180 
 181 struct dsl_ds_holdarg {
 182         dsl_sync_task_group_t *dstg;
 183         const char *htag;
 184         char *snapname;
 185         boolean_t recursive;
 186         boolean_t gotone;
 187         boolean_t temphold;
 188         char failed[MAXPATHLEN];
 189 };
 190 
 191 #define dsl_dataset_is_snapshot(ds) \
 192         ((ds)->ds_phys->ds_num_children != 0)
 193 
 194 #define DS_UNIQUE_IS_ACCURATE(ds)       \
 195         (((ds)->ds_phys->ds_flags & DS_FLAG_UNIQUE_ACCURATE) != 0)
 196 
 197 int dsl_dataset_hold(const char *name, void *tag, dsl_dataset_t **dsp);
 198 int dsl_dataset_hold_obj(struct dsl_pool *dp, uint64_t dsobj,
 199     void *tag, dsl_dataset_t **);
 200 int dsl_dataset_own(const char *name, boolean_t inconsistentok,
 201     void *tag, dsl_dataset_t **dsp);
 202 int dsl_dataset_own_obj(struct dsl_pool *dp, uint64_t dsobj,
 203     boolean_t inconsistentok, void *tag, dsl_dataset_t **dsp);
 204 void dsl_dataset_name(dsl_dataset_t *ds, char *name);
 205 void dsl_dataset_rele(dsl_dataset_t *ds, void *tag);
 206 void dsl_dataset_disown(dsl_dataset_t *ds, void *tag);
 207 void dsl_dataset_drop_ref(dsl_dataset_t *ds, void *tag);
 208 boolean_t dsl_dataset_tryown(dsl_dataset_t *ds, boolean_t inconsistentok,
 209     void *tag);
 210 void dsl_dataset_make_exclusive(dsl_dataset_t *ds, void *tag);
 211 void dsl_register_onexit_hold_cleanup(dsl_dataset_t *ds, const char *htag,
 212     minor_t minor);
 213 uint64_t dsl_dataset_create_sync(dsl_dir_t *pds, const char *lastname,
 214     dsl_dataset_t *origin, uint64_t flags, cred_t *, dmu_tx_t *);
 215 uint64_t dsl_dataset_create_sync_dd(dsl_dir_t *dd, dsl_dataset_t *origin,
 216     uint64_t flags, dmu_tx_t *tx);
 217 int dsl_dataset_destroy(dsl_dataset_t *ds, void *tag, boolean_t defer);

 218 dsl_checkfunc_t dsl_dataset_destroy_check;
 219 dsl_syncfunc_t dsl_dataset_destroy_sync;


 220 dsl_syncfunc_t dsl_dataset_user_hold_sync;
 221 int dsl_dataset_snapshot_check(dsl_dataset_t *ds, const char *, dmu_tx_t *tx);
 222 void dsl_dataset_snapshot_sync(dsl_dataset_t *ds, const char *, dmu_tx_t *tx);
 223 int dsl_dataset_rename(char *name, const char *newname, boolean_t recursive);
 224 int dsl_dataset_promote(const char *name, char *conflsnap);
 225 int dsl_dataset_clone_swap(dsl_dataset_t *clone, dsl_dataset_t *origin_head,
 226     boolean_t force);
 227 int dsl_dataset_user_hold(char *dsname, char *snapname, char *htag,
 228     boolean_t recursive, boolean_t temphold, int cleanup_fd);
 229 int dsl_dataset_user_hold_for_send(dsl_dataset_t *ds, char *htag,
 230     boolean_t temphold);
 231 int dsl_dataset_user_release(char *dsname, char *snapname, char *htag,
 232     boolean_t recursive);
 233 int dsl_dataset_user_release_tmp(struct dsl_pool *dp, uint64_t dsobj,
 234     char *htag, boolean_t retry);
 235 int dsl_dataset_get_holds(const char *dsname, nvlist_t **nvp);
 236 
 237 blkptr_t *dsl_dataset_get_blkptr(dsl_dataset_t *ds);
 238 void dsl_dataset_set_blkptr(dsl_dataset_t *ds, blkptr_t *bp, dmu_tx_t *tx);
 239 
 240 spa_t *dsl_dataset_get_spa(dsl_dataset_t *ds);
 241 
 242 boolean_t dsl_dataset_modified_since_lastsnap(dsl_dataset_t *ds);