]> granicus.if.org Git - zfs/commit
OpenZFS 8604 - Simplify snapshots unmounting code
authorSerapheim Dimitropoulos <serapheim@delphix.com>
Thu, 8 Feb 2018 16:32:45 +0000 (09:32 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 8 Feb 2018 23:29:44 +0000 (15:29 -0800)
commit8d103d88565efa90e545de57210c12edef77c938
tree30ebd9d9ffb71c17ae6fd7e97fbf7007e8fb1147
parentfc5d4b6737b810be88d60ca5fa9de7e2fba4e26d
OpenZFS 8604 - Simplify snapshots unmounting code

Authored by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Ported-by: Don Brady <don.brady@delphix.com>
Every time we want to unmount a snapshot (happens during snapshot
deletion or renaming) we unnecessarily iterate through all the
mountpoints in the VFS layer (see zfs_get_vfs).

The current patch completely gets rid of that code and changes
the approach while keeping the behavior of that code path the
same. Specifically, it puts a hold on the dataset/snapshot and
gets its vfs resource reference directly, instead of linearly
searching for it. If that reference exists we attempt to amount
it.

With the above change, it became obvious that the nvlist
manipulations that we do (add_boolean and add_nvlist) take a
significant amount of time ensuring uniqueness of every new
element even though they don't have too. Thus, we updated the
patch so those nvlists are not trying to enforce the uniqueness
of their elements.

A more complete analysis of the problem solved by this patch
can be found below:
https://sdimitro.github.io/post/snap-unmount-perf/

OpenZFS-issue: https://www.illumos.org/issues/8604
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/126118fb
include/sys/zfs_ioctl.h
module/zfs/dsl_destroy.c
module/zfs/zfs_ioctl.c