changeset 13969:b2c7608044b7

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>
author Matthew Ahrens <mahrens@delphix.com>
date Fri, 22 Feb 2013 01:23:09 -0800
parents e4988c7d0403
children c9a5683da38e
files usr/src/common/zfs/zfs_prop.c usr/src/man/man1m/zfs.1m usr/src/uts/common/fs/zfs/dsl_dataset.c usr/src/uts/common/fs/zfs/dsl_dir.c usr/src/uts/common/sys/fs/zfs.h
diffstat 5 files changed, 45 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/common/zfs/zfs_prop.c	Thu Feb 21 13:58:29 2013 -0800
+++ b/usr/src/common/zfs/zfs_prop.c	Fri Feb 22 01:23:09 2013 -0800
@@ -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.
  */
 
@@ -350,6 +350,10 @@
 	    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,
--- a/usr/src/man/man1m/zfs.1m	Thu Feb 21 13:58:29 2013 -0800
+++ b/usr/src/man/man1m/zfs.1m	Fri Feb 22 01:23:09 2013 -0800
@@ -535,6 +535,40 @@
 .sp
 .ne 2
 .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
--- a/usr/src/uts/common/fs/zfs/dsl_dataset.c	Thu Feb 21 13:58:29 2013 -0800
+++ b/usr/src/uts/common/fs/zfs/dsl_dataset.c	Fri Feb 22 01:23:09 2013 -0800
@@ -2247,6 +2247,8 @@
 	    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);
--- a/usr/src/uts/common/fs/zfs/dsl_dir.c	Thu Feb 21 13:58:29 2013 -0800
+++ b/usr/src/uts/common/fs/zfs/dsl_dir.c	Fri Feb 22 01:23:09 2013 -0800
@@ -530,6 +530,8 @@
 	    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]);
--- a/usr/src/uts/common/sys/fs/zfs.h	Thu Feb 21 13:58:29 2013 -0800
+++ b/usr/src/uts/common/sys/fs/zfs.h	Fri Feb 22 01:23:09 2013 -0800
@@ -138,6 +138,8 @@
 	ZFS_PROP_REFRATIO,
 	ZFS_PROP_WRITTEN,
 	ZFS_PROP_CLONES,
+	ZFS_PROP_LOGICALUSED,
+	ZFS_PROP_LOGICALREFERENCED,
 	ZFS_NUM_PROPS
 } zfs_prop_t;