|
53 | 53 | #include "zfs_namecheck.h"
|
54 | 54 | #include "zfs_prop.h"
|
55 | 55 |
|
| 56 | +/* |
| 57 | + * This controls if we verify the ZVOL quota or not. |
| 58 | + * Currently, quotas are not implemented for ZVOLs. |
| 59 | + * The quota size is the size of the ZVOL. |
| 60 | + * The size of the volume already implies the ZVOL size quota. |
| 61 | + * The quota mechanism can introduce a significant performance drop. |
| 62 | + */ |
| 63 | +static int zvol_enforce_quotas = B_TRUE; |
| 64 | + |
56 | 65 | /*
|
57 | 66 | * Filesystem and Snapshot Limits
|
58 | 67 | * ------------------------------
|
@@ -1311,7 +1320,9 @@ dsl_dir_tempreserve_impl(dsl_dir_t *dd, uint64_t asize, boolean_t netfree,
|
1311 | 1320 | * If this transaction will result in a net free of space,
|
1312 | 1321 | * we want to let it through.
|
1313 | 1322 | */
|
1314 |
| - if (ignorequota || netfree || dsl_dir_phys(dd)->dd_quota == 0) |
| 1323 | + if (ignorequota || netfree || dsl_dir_phys(dd)->dd_quota == 0 || |
| 1324 | + (dmu_objset_type(tx->tx_objset) == DMU_OST_ZVOL && |
| 1325 | + zvol_enforce_quotas == B_FALSE)) |
1315 | 1326 | quota = UINT64_MAX;
|
1316 | 1327 | else
|
1317 | 1328 | quota = dsl_dir_phys(dd)->dd_quota;
|
@@ -1399,10 +1410,9 @@ dsl_dir_tempreserve_impl(dsl_dir_t *dd, uint64_t asize, boolean_t netfree,
|
1399 | 1410 | ignorequota = (dsl_dir_phys(dd)->dd_head_dataset_obj == 0);
|
1400 | 1411 | first = B_FALSE;
|
1401 | 1412 | goto top_of_function;
|
1402 |
| - |
1403 |
| - } else { |
1404 |
| - return (0); |
1405 | 1413 | }
|
| 1414 | + |
| 1415 | + return (0); |
1406 | 1416 | }
|
1407 | 1417 |
|
1408 | 1418 | /*
|
@@ -2483,3 +2493,7 @@ dsl_dir_cancel_waiters(dsl_dir_t *dd)
|
2483 | 2493 | EXPORT_SYMBOL(dsl_dir_set_quota);
|
2484 | 2494 | EXPORT_SYMBOL(dsl_dir_set_reservation);
|
2485 | 2495 | #endif
|
| 2496 | + |
| 2497 | +/* CSTYLED */ |
| 2498 | +ZFS_MODULE_PARAM(zfs, , zvol_enforce_quotas, INT, ZMOD_RW, |
| 2499 | + "Enable strict ZVOL quota enforcment"); |
0 commit comments