summaryrefslogtreecommitdiff
path: root/usr/src/lib
diff options
context:
space:
mode:
authorck153898 <none@none>2007-10-29 22:45:33 -0700
committerck153898 <none@none>2007-10-29 22:45:33 -0700
commita9799022bd90b13722204e80112efaa5bf573099 (patch)
tree59256985fdeae5fe80d2e610e28f3bf9ac0b42a8 /usr/src/lib
parentdb97dd7c1f6464efdbafd832c3e6b3b13919e3e3 (diff)
downloadillumos-gate-a9799022bd90b13722204e80112efaa5bf573099.tar.gz
PSARC 2007/555 zfs fs-only quotas and reservationsonnv_77
6431277 want filesystem-only quotas 6483677 need immediate reservation
Diffstat (limited to 'usr/src/lib')
-rw-r--r--usr/src/lib/libzfs/common/libzfs_dataset.c8
-rw-r--r--usr/src/lib/libzfs/common/libzfs_util.c24
-rw-r--r--usr/src/lib/libzfs_jni/common/libzfs_jni_property.c2
3 files changed, 16 insertions, 18 deletions
diff --git a/usr/src/lib/libzfs/common/libzfs_dataset.c b/usr/src/lib/libzfs/common/libzfs_dataset.c
index 05a1eda7e7..0030dfe169 100644
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c
+++ b/usr/src/lib/libzfs/common/libzfs_dataset.c
@@ -772,6 +772,7 @@ zfs_validate_properties(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
switch (prop) {
case ZFS_PROP_RESERVATION:
+ case ZFS_PROP_REFRESERVATION:
if (intval > volsize) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"'%s' is greater than current "
@@ -1627,6 +1628,7 @@ zfs_prop_set(zfs_handle_t *zhp, const char *propname, const char *propval)
*/
switch (prop) {
case ZFS_PROP_QUOTA:
+ case ZFS_PROP_REFQUOTA:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"size is less than current used or "
"reserved space"));
@@ -1634,6 +1636,7 @@ zfs_prop_set(zfs_handle_t *zhp, const char *propname, const char *propval)
break;
case ZFS_PROP_RESERVATION:
+ case ZFS_PROP_REFRESERVATION:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"size is greater than available space"));
(void) zfs_error(hdl, EZFS_PROPSPACE, errbuf);
@@ -1953,7 +1956,9 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src,
break;
case ZFS_PROP_QUOTA:
+ case ZFS_PROP_REFQUOTA:
case ZFS_PROP_RESERVATION:
+ case ZFS_PROP_REFRESERVATION:
*val = getprop_uint64(zhp, prop, source);
if (*val == 0)
*source = ""; /* default */
@@ -2122,7 +2127,10 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
break;
case ZFS_PROP_QUOTA:
+ case ZFS_PROP_REFQUOTA:
case ZFS_PROP_RESERVATION:
+ case ZFS_PROP_REFRESERVATION:
+
if (get_numeric_property(zhp, prop, src, &source, &val) != 0)
return (-1);
diff --git a/usr/src/lib/libzfs/common/libzfs_util.c b/usr/src/lib/libzfs/common/libzfs_util.c
index 6e16aa3be1..d2005867e3 100644
--- a/usr/src/lib/libzfs/common/libzfs_util.c
+++ b/usr/src/lib/libzfs/common/libzfs_util.c
@@ -1065,7 +1065,6 @@ zprop_parse_value(libzfs_handle_t *hdl, nvpair_t *elem, int prop,
const char *propname;
char *value;
boolean_t isnone = B_FALSE;
- boolean_t boolval;
if (type == ZFS_TYPE_POOL) {
proptype = zpool_prop_get_type(prop);
@@ -1116,34 +1115,23 @@ zprop_parse_value(libzfs_handle_t *hdl, nvpair_t *elem, int prop,
/*
* Quota special: force 'none' and don't allow 0.
*/
- if ((type & ZFS_TYPE_DATASET) && *ivalp == 0 &&
- !isnone && prop == ZFS_PROP_QUOTA) {
+ if ((type & ZFS_TYPE_DATASET) && *ivalp == 0 && !isnone &&
+ (prop == ZFS_PROP_QUOTA || prop == ZFS_PROP_REFQUOTA)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
- "use 'none' to disable quota"));
+ "use 'none' to disable quota/refquota"));
goto error;
}
break;
case PROP_TYPE_INDEX:
- switch (datatype) {
- case DATA_TYPE_STRING:
- (void) nvpair_value_string(elem, &value);
- break;
-
- case DATA_TYPE_BOOLEAN_VALUE:
- (void) nvpair_value_boolean_value(elem, &boolval);
- if (boolval)
- value = "on";
- else
- value = "off";
- break;
-
- default:
+ if (datatype != DATA_TYPE_STRING) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"'%s' must be a string"), nvpair_name(elem));
goto error;
}
+ (void) nvpair_value_string(elem, &value);
+
if (zprop_string_to_index(prop, value, ivalp, type) != 0) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"'%s' must be one of '%s'"), propname,
diff --git a/usr/src/lib/libzfs_jni/common/libzfs_jni_property.c b/usr/src/lib/libzfs_jni/common/libzfs_jni_property.c
index a43594bae5..98352849cf 100644
--- a/usr/src/lib/libzfs_jni/common/libzfs_jni_property.c
+++ b/usr/src/lib/libzfs_jni/common/libzfs_jni_property.c
@@ -100,6 +100,8 @@ zfs_prop_t props_long[] = {
ZFS_PROP_RESERVATION,
ZFS_PROP_USED,
ZFS_PROP_VOLSIZE,
+ ZFS_PROP_REFQUOTA,
+ ZFS_PROP_REFRESERVATION,
ZPROP_INVAL
};