Print this page
Optimize creation and removal of temporary "user holds" placed on
snapshots by a zfs send, by ensuring all the required holds and
releases are done in a single dsl_sync_task.
Creation now collates the required holds during a dry run and
then uses a single lzc_hold call via zfs_hold_apply instead of
processing each snapshot in turn.
Defered (on exit) cleanup by the kernel is also now done in
dsl_sync_task by reusing dsl_dataset_user_release.
On a test with 11 volumes in a tree each with 8 snapshots on a
single HDD zpool this reduces the time required to perform a full
send from 20 seconds to under 0.8 seconds.
For reference eliminating the hold entirely reduces this 0.15
seconds.
While I'm here:-
* Remove some unused structures
* Fix nvlist_t leak in zfs_release_one


  26  */
  27 
  28 #ifndef _SYS_DSL_USERHOLD_H
  29 #define _SYS_DSL_USERHOLD_H
  30 
  31 #include <sys/nvpair.h>
  32 #include <sys/types.h>
  33 
  34 #ifdef  __cplusplus
  35 extern "C" {
  36 #endif
  37 
  38 struct dsl_pool;
  39 struct dsl_dataset;
  40 struct dmu_tx;
  41 
  42 int dsl_dataset_user_hold(nvlist_t *holds, minor_t cleanup_minor,
  43     nvlist_t *errlist);
  44 int dsl_dataset_user_release(nvlist_t *holds, nvlist_t *errlist);
  45 int dsl_dataset_get_holds(const char *dsname, nvlist_t *nvl);
  46 void dsl_dataset_user_release_tmp(struct dsl_pool *dp, uint64_t dsobj,
  47     const char *htag);
  48 int dsl_dataset_user_hold_check_one(struct dsl_dataset *ds, const char *htag,
  49     boolean_t temphold, struct dmu_tx *tx);
  50 void dsl_dataset_user_hold_sync_one(struct dsl_dataset *ds, const char *htag,
  51     minor_t minor, uint64_t now, struct dmu_tx *tx);
  52 
  53 #ifdef  __cplusplus
  54 }
  55 #endif
  56 
  57 #endif /* _SYS_DSL_USERHOLD_H */


  26  */
  27 
  28 #ifndef _SYS_DSL_USERHOLD_H
  29 #define _SYS_DSL_USERHOLD_H
  30 
  31 #include <sys/nvpair.h>
  32 #include <sys/types.h>
  33 
  34 #ifdef  __cplusplus
  35 extern "C" {
  36 #endif
  37 
  38 struct dsl_pool;
  39 struct dsl_dataset;
  40 struct dmu_tx;
  41 
  42 int dsl_dataset_user_hold(nvlist_t *holds, minor_t cleanup_minor,
  43     nvlist_t *errlist);
  44 int dsl_dataset_user_release(nvlist_t *holds, nvlist_t *errlist);
  45 int dsl_dataset_get_holds(const char *dsname, nvlist_t *nvl);


  46 int dsl_dataset_user_hold_check_one(struct dsl_dataset *ds, const char *htag,
  47     boolean_t temphold, struct dmu_tx *tx);
  48 void dsl_dataset_user_hold_sync_one(struct dsl_dataset *ds, const char *htag,
  49     minor_t minor, uint64_t now, struct dmu_tx *tx);
  50 
  51 #ifdef  __cplusplus
  52 }
  53 #endif
  54 
  55 #endif /* _SYS_DSL_USERHOLD_H */