Fast Dedup: Dedup Quota
Motivation and Context
Dedup tables can grow unbounded, which lets them consume an entire dedup vdev and so spill into the main pool, or grow too big to fit in RAM, hurting performance. This change adds options to allow the administrator to set a quota, which when reached will effectively disable dedup for new blocks.
Description
This adds two new pool properties:
dedup_table_size, the total size of all DDTs on the pool; anddedup_table_quota, the maximum possible size of all DDTs in the pool
When set, quota will be enforced by checking when a new entry is about to be created. If the pool is over its dedup quota, the entry won't be created, and the corresponding write will be converted to a regular non-dedup write. Note that existing entries can be updated (ie their refcounts changed), as that reuses the space rather than requiring more.
dedup_table_quota can be set to auto, which will set it based on the size of the devices backing the "dedup" allocation class. This makes it possible to limit the DDTs to the size of a dedup vdev only, such that when the device fills, no new blocks are deduplicated.
This replaces #10169
How Has This Been Tested?
Test added.
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Performance enhancement (non-breaking change which improves efficiency)
- [ ] Code cleanup (non-breaking change which makes code smaller or more readable)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
- [x] Documentation (a change to man pages or other documentation)
Checklist:
- [x] My code follows the OpenZFS code style requirements.
- [x] I have updated the documentation accordingly.
- [x] I have read the contributing document.
- [x] I have added tests to cover my changes.
- [x] I have run the ZFS Test Suite with this change applied.
- [x] All commit messages are properly formatted and contain
Signed-off-by.
Addressed review feedback and rebased to fix merge conflicts
Fixed dedup quota test for Redhat distros
rebased after zap shrinking was landed
[Fast dedup stack rebased to master c98295eed]
Last push just tightens up a number parse in the dedup_quota test a little, but no other changes.
dedup_table_quota can be set to auto, which will set it based on the size of the devices backing the "dedup" allocation class.
I assume if you set it to auto and you don't have an alloc class device, then it doesn't place a limit on the DDT size (basically the old dedup behavior)?
If you have a special device but no dedup device, does auto set the DDT size to the special device size, since those can handle dedup allocations?
dedup_table_quota can be set to auto, which will set it based on the size of the devices backing the "dedup" allocation class.
I assume if you set it to
autoand you don't have an alloc class device, then it doesn't place a limit on the DDT size (basically the old dedup behavior)?If you have a
specialdevice but nodedupdevice, doesautoset the DDT size to thespecialdevice size, since those can handle dedup allocations?
If you set it to auto and have no dedup vdev, but do have a special vdev AND have zfs_ddt_data_is_special set (the default), then yes, it will use the special device size, respecting the same limits.
/*
* For automatic quota, table size is limited by dedup or special class
*/
if (ddt_special_over_quota(spa, spa_dedup_class(spa)))
return (B_TRUE);
else if (spa_special_has_ddt(spa) &&
ddt_special_over_quota(spa, spa_special_class(spa)))
return (B_TRUE);
return (B_FALSE);
I haven't worked much with the dedup code, but I don't see any major issues.
If you can fix the minor setup.ksh and cleanup.ksh stuff, then I think we can start wrapping this up.