mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
quota: disable quota check for ZVOL
The quota for ZVOLs is set to the size of the volume. When the quota reaches the maximum, there isn't an excellent way to check if the new writers are overwriting the data or if they are inserting a new one. Because of that, when we reach the maximum quota, we wait till txg is flushed. This is causing a significant fluctuation in bandwidth. In the case of ZVOL, the quota is enforced by the volsize, so we can omit it. This commit adds a sysctl thats allow to control if the quota mechanism should be enforced or not. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Mariusz Zaborski <mariusz.zaborski@klarasystems.com> Sponsored-by: Zededa Inc. Sponsored-by: Klara Inc. Closes #13838
This commit is contained in:
parent
e197bb24f1
commit
945b407486
@ -15,7 +15,7 @@
|
||||
.\" own identifying information:
|
||||
.\" Portions Copyright [yyyy] [name of copyright owner]
|
||||
.\"
|
||||
.Dd June 1, 2021
|
||||
.Dd November 7, 2022
|
||||
.Dt ZFS 4
|
||||
.Os
|
||||
.
|
||||
@ -2386,6 +2386,10 @@ Defines zvol block devices behaviour when
|
||||
.It Sy 3
|
||||
.No equivalent to Sy none
|
||||
.El
|
||||
.
|
||||
.It Sy zvol_enforce_quotas Ns = Ns Sy 0 Ns | Ns 1 Pq uint
|
||||
Enable strict ZVOL quota enforcement.
|
||||
The strict quota enforcement may have a performance impact.
|
||||
.El
|
||||
.
|
||||
.Sh ZFS I/O SCHEDULER
|
||||
|
@ -53,6 +53,15 @@
|
||||
#include "zfs_namecheck.h"
|
||||
#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");
|
||||
|
Loading…
Reference in New Issue
Block a user