]> granicus.if.org Git - zfs/commitdiff
Illumos 4929 - want prevsnap property
authorMatthew Ahrens <mahrens@delphix.com>
Fri, 1 Jan 2016 13:15:31 +0000 (14:15 +0100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 11 Jan 2016 19:58:26 +0000 (11:58 -0800)
4929 want prevsnap property
Reviewed by: Adam Leventhal <adam.leventhal@delphix.com>
Reviewed by: Matt Amdur <matt.amdur@delphix.com>
Reviewed by: Saso Kiselkov <skiselkov.ml@gmail.com>
Reviewed by: Boris Protopopov <bprotopopov@hotmail.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@omniti.com>

References:
  https://www.illumos.org/issues/4929
  https://github.com/illumos/illumos-gate/commit/b461c74

Porting notes:
- [include/sys/fs/zfs.h]
  - f67d70 Create an 'overlay' property
  - 11b9ec Add full SELinux support
- [fs/zfs/dsl_dataset.c]
  - This increases the stack size of dsl_dataset_stats() but
    nothing has been changed until this is shown to be an issue.

Ported-by: kernelOfTruth kerneloftruth@gmail.com
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
include/sys/fs/zfs.h
module/zcommon/zfs_prop.c
module/zfs/dsl_dataset.c

index 4da144c724abcadd6091caf17b50a1184fbe0042..536fab785c6db284d64644aa435c7652668fee1c 100644 (file)
@@ -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;
 
index aaebab444cfa409432f41117643ddc962415af5e..5a88cbe6c7b033476bf5c44db87c18b175420004 100644 (file)
@@ -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
index edc5ea17a4076cce4d46a5cbc8d9d5acdbffa267..9c017124a1cab8aa568990b63b726f5b2023cc34 100644 (file)
@@ -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);
        }