Skip to content

Commit

Permalink
quota: extend quota for dataset
Browse files Browse the repository at this point in the history
This patch relax the quota limitation for dataset by around 3%.
What this means is that user can write more data then the quota is
set to. However thanks to that we can get more stable bandwidth, in
case when we are overwriting data in-place, and not consuming any
additional space.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Allan Jude <[email protected]>
Signed-off-by: Mariusz Zaborski <[email protected]>
Sponsored-by: Zededa Inc.
Sponsored-by: Klara Inc.
Closes #13839
  • Loading branch information
oshogbo authored and behlendorf committed Nov 1, 2022
1 parent 1d2b056 commit 186e39f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion module/zfs/dsl_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,7 @@ dsl_dir_tempreserve_impl(dsl_dir_t *dd, uint64_t asize, boolean_t netfree,
uint64_t quota;
struct tempreserve *tr;
int retval;
uint64_t ext_quota;
uint64_t ref_rsrv;

top_of_function:
Expand Down Expand Up @@ -1337,7 +1338,16 @@ dsl_dir_tempreserve_impl(dsl_dir_t *dd, uint64_t asize, boolean_t netfree,
* on-disk is over quota and there are no pending changes
* or deferred frees (which may free up space for us).
*/
if (used_on_disk + est_inflight >= quota) {
ext_quota = quota >> 5;
if (quota == UINT64_MAX)
ext_quota = 0;

if (used_on_disk >= quota) {
/* Quota exceeded */
mutex_exit(&dd->dd_lock);
DMU_TX_STAT_BUMP(dmu_tx_quota);
return (retval);
} else if (used_on_disk + est_inflight >= quota + ext_quota) {
if (est_inflight > 0 || used_on_disk < quota) {
retval = SET_ERROR(ERESTART);
} else {
Expand Down

0 comments on commit 186e39f

Please sign in to comment.