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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/zfs_ioctl.c
          +++ new/usr/src/uts/common/fs/zfs/zfs_ioctl.c
↓ open down ↓ 4972 lines elided ↑ open up ↑
4973 4973   *
4974 4974   * outnvl: {
4975 4975   *     snapname -> error value (int32)
4976 4976   *     ...
4977 4977   * }
4978 4978   */
4979 4979  /* ARGSUSED */
4980 4980  static int
4981 4981  zfs_ioc_release(const char *pool, nvlist_t *holds, nvlist_t *errlist)
4982 4982  {
4983      -        nvpair_t *pair;
4984      -
4985      -        /*
4986      -         * The release may cause the snapshot to be destroyed; make sure it
4987      -         * is not mounted.
4988      -         */
4989      -        for (pair = nvlist_next_nvpair(holds, NULL); pair != NULL;
4990      -            pair = nvlist_next_nvpair(holds, pair))
4991      -                zfs_unmount_snap(nvpair_name(pair));
4992      -
4993 4983          return (dsl_dataset_user_release(holds, errlist));
4994 4984  }
4995 4985  
4996 4986  /*
4997 4987   * inputs:
4998 4988   * zc_name              name of new filesystem or snapshot
4999 4989   * zc_value             full name of old snapshot
5000 4990   *
5001 4991   * outputs:
5002 4992   * zc_cookie            space in bytes
↓ open down ↓ 916 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX