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

@@ -4978,20 +4978,10 @@
  */
 /* ARGSUSED */
 static int
 zfs_ioc_release(const char *pool, nvlist_t *holds, nvlist_t *errlist)
 {
-        nvpair_t *pair;
-
-        /*
-         * The release may cause the snapshot to be destroyed; make sure it
-         * is not mounted.
-         */
-        for (pair = nvlist_next_nvpair(holds, NULL); pair != NULL;
-            pair = nvlist_next_nvpair(holds, pair))
-                zfs_unmount_snap(nvpair_name(pair));
-
         return (dsl_dataset_user_release(holds, errlist));
 }
 
 /*
  * inputs: