Skip to content

Commit 24a6465

Browse files
ahrensbehlendorf
authored andcommitted
Illumos #3588
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@77372cb Ported-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
1 parent c2e42f9 commit 24a6465

File tree

5 files changed

+45
-1
lines changed

5 files changed

+45
-1
lines changed

include/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_PROP_SNAPDEV,
142144
ZFS_PROP_ACLTYPE,
143145
ZFS_NUM_PROPS

man/man8/zfs.8

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,40 @@ This property is \fBon\fR if the snapshot has been marked for deferred destructi
431431
.ne 2
432432
.mk
433433
.na
434+
\fB\fBlogicalreferenced\fR\fR
435+
.ad
436+
.sp .6
437+
.RS 4n
438+
The amount of space that is "logically" accessible by this dataset. See
439+
the \fBreferenced\fR property. The logical space ignores the effect of
440+
the \fBcompression\fR and \fBcopies\fR properties, giving a quantity
441+
closer to the amount of data that applications see. However, it does
442+
include space consumed by metadata.
443+
.sp
444+
This property can also be referred to by its shortened column name,
445+
\fBlrefer\fR.
446+
.RE
447+
448+
.sp
449+
.ne 2
450+
.na
451+
\fB\fBlogicalused\fR\fR
452+
.ad
453+
.sp .6
454+
.RS 4n
455+
The amount of space that is "logically" consumed by this dataset and all
456+
its descendents. See the \fBused\fR property. The logical space
457+
ignores the effect of the \fBcompression\fR and \fBcopies\fR properties,
458+
giving a quantity closer to the amount of data that applications see.
459+
However, it does include space consumed by metadata.
460+
.sp
461+
This property can also be referred to by its shortened column name,
462+
\fBlused\fR.
463+
.RE
464+
465+
.sp
466+
.ne 2
467+
.na
434468
\fB\fBmounted\fR\fR
435469
.ad
436470
.sp .6

module/zcommon/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

@@ -365,6 +365,10 @@ zfs_prop_init(void)
365365
ZFS_TYPE_SNAPSHOT, "<count>", "USERREFS");
366366
zprop_register_number(ZFS_PROP_WRITTEN, "written", 0, PROP_READONLY,
367367
ZFS_TYPE_DATASET, "<size>", "WRITTEN");
368+
zprop_register_number(ZFS_PROP_LOGICALUSED, "logicalused", 0,
369+
PROP_READONLY, ZFS_TYPE_DATASET, "<size>", "LUSED");
370+
zprop_register_number(ZFS_PROP_LOGICALREFERENCED, "logicalreferenced",
371+
0, PROP_READONLY, ZFS_TYPE_DATASET, "<size>", "LREFER");
368372

369373
/* default number properties */
370374
zprop_register_number(ZFS_PROP_QUOTA, "quota", 0, PROP_DEFAULT,

module/zfs/dsl_dataset.c

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

13891389
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_REFRATIO, ratio);
1390+
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALREFERENCED,
1391+
ds->ds_phys->ds_uncompressed_bytes);
13901392

13911393
if (dsl_dataset_is_snapshot(ds)) {
13921394
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_COMPRESSRATIO, ratio);

module/zfs/dsl_dir.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,8 @@ dsl_dir_stats(dsl_dir_t *dd, nvlist_t *nv)
440440
dd->dd_phys->dd_compressed_bytes == 0 ? 100 :
441441
(dd->dd_phys->dd_uncompressed_bytes * 100 /
442442
dd->dd_phys->dd_compressed_bytes));
443+
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_LOGICALUSED,
444+
dd->dd_phys->dd_uncompressed_bytes);
443445
if (dd->dd_phys->dd_flags & DD_FLAG_USED_BREAKDOWN) {
444446
dsl_prop_nvlist_add_uint64(nv, ZFS_PROP_USEDSNAP,
445447
dd->dd_phys->dd_used_breakdown[DD_USED_SNAP]);

0 commit comments

Comments
 (0)