aboutsummaryrefslogtreecommitdiff
path: root/module/zfs/dsl_dir.c
diff options
context:
space:
mode:
authorMariusz Zaborski <oshogbo@vexillium.org>2022-11-08 20:40:22 +0000
committerGitHub <noreply@github.com>2022-11-08 20:40:22 +0000
commit945b407486a0072ec7dd117a0bde2f72d52eb445 (patch)
tree34b4bc8e55f8ef316fbedf6cb5d4e466975e00fb /module/zfs/dsl_dir.c
parente197bb24f1857c823b44c2175b2318c472d79731 (diff)
downloadsrc-945b407486a0072ec7dd117a0bde2f72d52eb445.tar.gz
src-945b407486a0072ec7dd117a0bde2f72d52eb445.zip
Diffstat (limited to 'module/zfs/dsl_dir.c')
-rw-r--r--module/zfs/dsl_dir.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c
index 9af760177445..486f50108bfa 100644
--- a/module/zfs/dsl_dir.c
+++ b/module/zfs/dsl_dir.c
@@ -54,6 +54,15 @@
#include "zfs_prop.h"
/*
+ * This controls if we verify the ZVOL quota or not.
+ * Currently, quotas are not implemented for ZVOLs.
+ * The quota size is the size of the ZVOL.
+ * The size of the volume already implies the ZVOL size quota.
+ * The quota mechanism can introduce a significant performance drop.
+ */
+static int zvol_enforce_quotas = B_TRUE;
+
+/*
* Filesystem and Snapshot Limits
* ------------------------------
*
@@ -1311,7 +1320,9 @@ top_of_function:
* If this transaction will result in a net free of space,
* we want to let it through.
*/
- if (ignorequota || netfree || dsl_dir_phys(dd)->dd_quota == 0)
+ if (ignorequota || netfree || dsl_dir_phys(dd)->dd_quota == 0 ||
+ (dmu_objset_type(tx->tx_objset) == DMU_OST_ZVOL &&
+ zvol_enforce_quotas == B_FALSE))
quota = UINT64_MAX;
else
quota = dsl_dir_phys(dd)->dd_quota;
@@ -1399,10 +1410,9 @@ top_of_function:
ignorequota = (dsl_dir_phys(dd)->dd_head_dataset_obj == 0);
first = B_FALSE;
goto top_of_function;
-
- } else {
- return (0);
}
+
+ return (0);
}
/*
@@ -2483,3 +2493,7 @@ dsl_dir_cancel_waiters(dsl_dir_t *dd)
EXPORT_SYMBOL(dsl_dir_set_quota);
EXPORT_SYMBOL(dsl_dir_set_reservation);
#endif
+
+/* CSTYLED */
+ZFS_MODULE_PARAM(zfs, , zvol_enforce_quotas, INT, ZMOD_RW,
+ "Enable strict ZVOL quota enforcment");