Skip to content

Commit 77372cb

Browse files
ahrensChristopher Siden
authored andcommitted
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>
1 parent 03f8c36 commit 77372cb

File tree

5 files changed

+45
-1
lines changed

5 files changed

+45
-1
lines changed

usr/src/common/zfs/zfs_prop.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
/*
2222
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23-
* Copyright (c) 2011 by Delphix. All rights reserved.
23+
* Copyright (c) 2012 by Delphix. All rights reserved.
2424
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
2525
*/
2626

@@ -350,6 +350,10 @@ zfs_prop_init(void)
350350
ZFS_TYPE_SNAPSHOT, "<count>", "USERREFS");
351351
zprop_register_number(ZFS_PROP_WRITTEN, "written", 0, PROP_READONLY,
352352
ZFS_TYPE_DATASET, "<size>", "WRITTEN");
353+
zprop_register_number(ZFS_PROP_LOGICALUSED, "logicalused", 0,
354+
PROP_READONLY, ZFS_TYPE_DATASET, "<size>", "LUSED");
355+
zprop_register_number(ZFS_PROP_LOGICALREFERENCED, "logicalreferenced",
356+
0, PROP_READONLY, ZFS_TYPE_DATASET, "<size>", "LREFER");
353357

354358
/* default number properties */
355359
zprop_register_number(ZFS_PROP_QUOTA, "quota", 0, PROP_DEFAULT,

usr/src/man/man1m/zfs.1m

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,40 @@ by using the \fBzfs destroy\fR \fB-d\fR command. Otherwise, the property is
532532
\fBoff\fR.
533533
.RE
534534

535+
.sp
536+
.ne 2
537+
.na
538+
\fB\fBlogicalreferenced\fR\fR
539+
.ad
540+
.sp .6
541+
.RS 4n
542+
The amount of space that is "logically" accessible by this dataset. See
543+
the \fBreferenced\fR property. The logical space ignores the effect of
544+
the \fBcompression\fR and \fBcopies\fR properties, giving a quantity
545+
closer to the amount of data that applications see. However, it does
546+
include space consumed by metadata.
547+
.sp
548+
This property can also be referred to by its shortened column name,
549+
\fBlrefer\fR.
550+
.RE
551+
552+
.sp
553+
.ne 2
554+
.na
555+
\fB\fBlogicalused\fR\fR
556+
.ad
557+
.sp .6
558+
.RS 4n
559+
The amount of space that is "logically" consumed by this dataset and all
560+
its descendents. See the \fBused\fR property. The logical space
561+
ignores the effect of the \fBcompression\fR and \fBcopies\fR properties,
562+
giving a quantity closer to the amount of data that applications see.
563+
However, it does include space consumed by metadata.
564+
.sp
565+
This property can also be referred to by its shortened column name,
566+
\fBlused\fR.
567+
.RE
568+
535569
.sp
536570
.ne 2
537571
.na

usr/src/uts/common/fs/zfs/dsl_dataset.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,6 +2247,8 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvlist_t *nv)
22472247
ds->ds_phys->ds_compressed_bytes);
22482248

22492249
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_REFRATIO, ratio);
2250+
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALREFERENCED,
2251+
ds->ds_phys->ds_uncompressed_bytes);
22502252

22512253
if (dsl_dataset_is_snapshot(ds)) {
22522254
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_COMPRESSRATIO, ratio);

usr/src/uts/common/fs/zfs/dsl_dir.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,8 @@ dsl_dir_stats(dsl_dir_t *dd, nvlist_t *nv)
530530
dd->dd_phys->dd_compressed_bytes == 0 ? 100 :
531531
(dd->dd_phys->dd_uncompressed_bytes * 100 /
532532
dd->dd_phys->dd_compressed_bytes));
533+
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALUSED,
534+
dd->dd_phys->dd_uncompressed_bytes);
533535
if (dd->dd_phys->dd_flags & DD_FLAG_USED_BREAKDOWN) {
534536
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USEDSNAP,
535537
dd->dd_phys->dd_used_breakdown[DD_USED_SNAP]);

usr/src/uts/common/sys/fs/zfs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ typedef enum {
138138
ZFS_PROP_REFRATIO,
139139
ZFS_PROP_WRITTEN,
140140
ZFS_PROP_CLONES,
141+
ZFS_PROP_LOGICALUSED,
142+
ZFS_PROP_LOGICALREFERENCED,
141143
ZFS_NUM_PROPS
142144
} zfs_prop_t;
143145

0 commit comments

Comments
 (0)