Skip to content

Commit

Permalink
Experiment: Make dmu_free_long_range configurably yield the floor
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaniel Wesley Filardo committed Sep 3, 2015
1 parent 0282c41 commit 66dbeba
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions module/zfs/dmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
*/
int zfs_nopwrite_enabled = 1;

/*
* Enable artificial yields when freeing a large range
*/
int zfs_dmu_free_long_range_yield = 0;

const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES] = {
{ DMU_BSWAP_UINT8, TRUE, "unallocated" },
{ DMU_BSWAP_ZAP, TRUE, "object directory" },
Expand Down Expand Up @@ -647,6 +652,7 @@ dmu_free_long_range_impl(objset_t *os, dnode_t *dn, uint64_t offset,
{
uint64_t object_size;
int err;
int chunks = 0;

if (dn == NULL)
return (SET_ERROR(EINVAL));
Expand Down Expand Up @@ -683,6 +689,20 @@ dmu_free_long_range_impl(objset_t *os, dnode_t *dn, uint64_t offset,
dmu_tx_commit(tx);

length -= chunk_end - chunk_begin;

/*
* If we are asked to do so, occasionally wait for the next txg.
* This should let other threads that want to use the disk in!
*/
if(zfs_dmu_free_long_range_yield > 0) {
if (chunks++ == zfs_dmu_free_long_range_yield) {
dsl_dir_t *dd = os->os_dsl_dataset->ds_dir;
if(dd != NULL) {
txg_wait_open(dd->dd_pool, 0);
}
chunks = 0;
}
}
}
return (0);
}
Expand Down Expand Up @@ -2178,4 +2198,6 @@ MODULE_PARM_DESC(zfs_mdcomp_disable, "Disable meta data compression");
module_param(zfs_nopwrite_enabled, int, 0644);
MODULE_PARM_DESC(zfs_nopwrite_enabled, "Enable NOP writes");

module_param(zfs_dmu_free_long_range_yield, int, 0644);
MODULE_PARM_DESC(zfs_dmu_free_long_range_yield, "Enable extra waits when freeing long ranges");
#endif

0 comments on commit 66dbeba

Please sign in to comment.