]> granicus.if.org Git - zfs/commitdiff
Illumos #3588
authorMatthew Ahrens <mahrens@delphix.com>
Fri, 22 Feb 2013 09:23:09 +0000 (01:23 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 31 Oct 2013 17:16:11 +0000 (10:16 -0700)
3588 provide zfs properties for logical (uncompressed) space
     used and referenced
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Dan McDonald <danmcd@nexenta.com>
Reviewed by: Richard Elling <richard.elling@dey-sys.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

References:
  https://www.illumos.org/issues/3588
  illumos/illumos-gate@77372cb0f35e8d3615ca2e16044f033397e88e21

Ported-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
include/sys/fs/zfs.h
man/man8/zfs.8
module/zcommon/zfs_prop.c
module/zfs/dsl_dataset.c
module/zfs/dsl_dir.c

index 92a843b8c9bc51bb045333f509da0d482925096b..89ac90ba71fdfeac03d2f4e766a4eeafac66e930 100644 (file)
@@ -138,6 +138,8 @@ typedef enum {
        ZFS_PROP_REFRATIO,
        ZFS_PROP_WRITTEN,
        ZFS_PROP_CLONES,
+       ZFS_PROP_LOGICALUSED,
+       ZFS_PROP_LOGICALREFERENCED,
        ZFS_PROP_SNAPDEV,
        ZFS_PROP_ACLTYPE,
        ZFS_NUM_PROPS
index 65d98ce762224cc669de57d01315a9e293e34606..60a11a57ea0f994cb61412283281dfaa4bb56183 100644 (file)
@@ -431,6 +431,40 @@ This property is \fBon\fR if the snapshot has been marked for deferred destructi
 .ne 2
 .mk
 .na
+\fB\fBlogicalreferenced\fR\fR
+.ad
+.sp .6
+.RS 4n
+The amount of space that is "logically" accessible by this dataset.  See
+the \fBreferenced\fR property.  The logical space ignores the effect of
+the \fBcompression\fR and \fBcopies\fR properties, giving a quantity
+closer to the amount of data that applications see.  However, it does
+include space consumed by metadata.
+.sp
+This property can also be referred to by its shortened column name,
+\fBlrefer\fR.
+.RE
+
+.sp
+.ne 2
+.na
+\fB\fBlogicalused\fR\fR
+.ad
+.sp .6
+.RS 4n
+The amount of space that is "logically" consumed by this dataset and all
+its descendents.  See the \fBused\fR property.  The logical space
+ignores the effect of the \fBcompression\fR and \fBcopies\fR properties,
+giving a quantity closer to the amount of data that applications see.
+However, it does include space consumed by metadata.
+.sp
+This property can also be referred to by its shortened column name,
+\fBlused\fR.
+.RE
+
+.sp
+.ne 2
+.na
 \fB\fBmounted\fR\fR
 .ad
 .sp .6
index 7e3563285c70414f44dc6471077fc183bff414c2..93ccfef6bf5120812874e2394afa33541152fe1b 100644 (file)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
  */
 
@@ -365,6 +365,10 @@ zfs_prop_init(void)
            ZFS_TYPE_SNAPSHOT, "<count>", "USERREFS");
        zprop_register_number(ZFS_PROP_WRITTEN, "written", 0, PROP_READONLY,
            ZFS_TYPE_DATASET, "<size>", "WRITTEN");
+       zprop_register_number(ZFS_PROP_LOGICALUSED, "logicalused", 0,
+           PROP_READONLY, ZFS_TYPE_DATASET, "<size>", "LUSED");
+       zprop_register_number(ZFS_PROP_LOGICALREFERENCED, "logicalreferenced",
+           0, PROP_READONLY, ZFS_TYPE_DATASET, "<size>", "LREFER");
 
        /* default number properties */
        zprop_register_number(ZFS_PROP_QUOTA, "quota", 0, PROP_DEFAULT,
index 33bcd2ab3b7b9552817720f33e896689f39889a7..4d767cd86acf55f1c2cbdab75a7733c746a2782b 100644 (file)
@@ -1387,6 +1387,8 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvlist_t *nv)
            ds->ds_phys->ds_compressed_bytes);
 
        dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_REFRATIO, ratio);
+       dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALREFERENCED,
+           ds->ds_phys->ds_uncompressed_bytes);
 
        if (dsl_dataset_is_snapshot(ds)) {
                dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_COMPRESSRATIO, ratio);
index ccae3f2709f4aa1eb8edefdffc5a4bb0d5f8493b..69a28ef2531313c215d47376c28af0ea7fe674ee 100644 (file)
@@ -440,6 +440,8 @@ dsl_dir_stats(dsl_dir_t *dd, nvlist_t *nv)
            dd->dd_phys->dd_compressed_bytes == 0 ? 100 :
            (dd->dd_phys->dd_uncompressed_bytes * 100 /
            dd->dd_phys->dd_compressed_bytes));
+       dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALUSED,
+           dd->dd_phys->dd_uncompressed_bytes);
        if (dd->dd_phys->dd_flags & DD_FLAG_USED_BREAKDOWN) {
                dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USEDSNAP,
                    dd->dd_phys->dd_used_breakdown[DD_USED_SNAP]);