On 11/06/2010 11:42, Arne Jansen wrote:
Darren J Moffat wrote:
But the following document says "Recursive ZFS snapshots are created
quickly as one atomic operation. The snapshots are created together (all
at once) or not created at all."
http://docs.sun.com/app/docs/doc/819-5461/gdfdt?a=view
I've looked at the code again - I miss read part of it - it does appear
to be an "all or nothing" both for the create and destroy.
I read the code differently, zfs destroy does the iteration in the
zfs utility, not even in libzfs. The ioctl doesn't even have a recurse
flag.
You are correct that the ZFS_IOC_DESTROY ioctl doesn't have a resurse
flag but the code path is different for recursive snapshot destroy and
single snapshot or non snapshot destroy.
For the snapshot case start in zfs_main.c:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/zfs/zfs_main.c#zfs_do_destroy
In particular line 1041 in the current version of the source:
if (cb.cb_recurse && (cp = strchr(argv[0], '@'))) {
...
}
In zfs_do_destroy() if recurse is set we call zfs_destroy_snaps()
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libzfs/common/libzfs_dataset.c#zfs_destroy_snaps
Which makes a single ioctl call ZFS_IOC_DESTROY_SNAPS
Which ends up in the kernel in zfs_ioctl.c here:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/zfs/zfs_ioctl.c#zfs_ioc_destroy_snaps
Which then goes to the DMU layer here:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/zfs/dsl_dataset.c#dmu_snapshots_destroy
--
Darren J Moffat
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss