From ff95e6ff7f15e80345f114ebf0db450c0e226fd8 Mon Sep 17 00:00:00 2001 From: delphij Date: Tue, 1 Jul 2014 22:42:53 +0000 Subject: [PATCH] MFV r268122: 4929 want prevsnap property illumos/illumos-gate@b461c7460e5e77cf65f00151162e654220c6e2fb MFC after: 2 weeks --- sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c | 2 ++ .../contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c | 8 +++++++- sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c b/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c index b345206a4a1c..bd023c70ef47 100644 --- a/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c +++ b/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c @@ -435,6 +435,8 @@ zfs_prop_init(void) PROP_READONLY, ZFS_TYPE_DATASET, "OBJSETID"); zprop_register_hidden(ZFS_PROP_INCONSISTENT, "inconsistent", PROP_TYPE_NUMBER, PROP_READONLY, ZFS_TYPE_DATASET, "INCONSISTENT"); + zprop_register_hidden(ZFS_PROP_PREV_SNAP, "prevsnap", PROP_TYPE_STRING, + PROP_READONLY, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, "PREVSNAP"); /* oddball properties */ zprop_register_impl(ZFS_PROP_CREATION, "creation", PROP_TYPE_NUMBER, 0, diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c index f21af21eb2bd..4e41f4701edf 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2011 Martin Matuska - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2014 by Delphix. All rights reserved. * Copyright (c) 2014, Joyent, Inc. All rights reserved. * Copyright (c) 2014 RackTop Systems. */ @@ -1603,6 +1603,12 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvlist_t *nv) ds->ds_phys->ds_unique_bytes); get_clones_stat(ds, nv); } else { + if (ds->ds_prev != NULL && ds->ds_prev != dp->dp_origin_snap) { + char buf[MAXNAMELEN]; + dsl_dataset_name(ds->ds_prev, buf); + dsl_prop_nvlist_add_string(nv, ZFS_PROP_PREV_SNAP, buf); + } + dsl_dir_stats(ds->ds_dir, nv); } diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h b/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h index 3609a90c4def..b2288fbdd640 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h @@ -151,6 +151,7 @@ typedef enum { ZFS_PROP_FILESYSTEM_COUNT, ZFS_PROP_SNAPSHOT_COUNT, ZFS_PROP_REDUNDANT_METADATA, + ZFS_PROP_PREV_SNAP, ZFS_NUM_PROPS } zfs_prop_t;