summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sys/fs/zfs.h1
-rw-r--r--module/zcommon/zfs_prop.c2
-rw-r--r--module/zfs/dsl_dataset.c6
3 files changed, 9 insertions, 0 deletions
diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h
index 4da144c72..536fab785 100644
--- a/include/sys/fs/zfs.h
+++ b/include/sys/fs/zfs.h
@@ -155,6 +155,7 @@ typedef enum {
ZFS_PROP_RELATIME,
ZFS_PROP_REDUNDANT_METADATA,
ZFS_PROP_OVERLAY,
+ ZFS_PROP_PREV_SNAP,
ZFS_NUM_PROPS
} zfs_prop_t;
diff --git a/module/zcommon/zfs_prop.c b/module/zcommon/zfs_prop.c
index aaebab444..5a88cbe6c 100644
--- a/module/zcommon/zfs_prop.c
+++ b/module/zcommon/zfs_prop.c
@@ -452,6 +452,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");
/*
* Property to be removed once libbe is integrated
diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c
index edc5ea17a..9c017124a 100644
--- a/module/zfs/dsl_dataset.c
+++ b/module/zfs/dsl_dataset.c
@@ -1695,6 +1695,12 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvlist_t *nv)
dsl_dataset_phys(ds)->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);
}