mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
port async unlinked drain from illumos-nexenta
This patch is an async implementation of the existing sync zfs_unlinked_drain() function. This function is called at mount time and is responsible for freeing znodes that we didn't get to freeing before. We don't have to hold mounting of the dataset until the unlinked list is fully drained as is done now. Since we can process the unlinked set asynchronously this results in a better user experience when mounting a dataset with entries in the unlinked set. Reviewed by: Jorgen Lundman <lundman@lundman.net> Reviewed by: Tom Caputi <tcaputi@datto.com> Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Matt Ahrens <mahrens@delphix.com> Reviewed by: Paul Dagnelie <pcd@delphix.com> Signed-off-by: Alek Pinchuk <apinchuk@datto.com> Closes #8142
This commit is contained in:
+10
-1
@@ -91,6 +91,12 @@ static kmem_cache_t *znode_cache = NULL;
|
||||
static kmem_cache_t *znode_hold_cache = NULL;
|
||||
unsigned int zfs_object_mutex_size = ZFS_OBJ_MTX_SZ;
|
||||
|
||||
/*
|
||||
* This is used by the test suite so that it can delay znodes from being
|
||||
* freed in order to inspect the unlinked set.
|
||||
*/
|
||||
int zfs_unlink_suspend_progress = 0;
|
||||
|
||||
/*
|
||||
* This callback is invoked when acquiring a RL_WRITER or RL_APPEND lock on
|
||||
* z_rangelock. It will modify the offset and length of the lock to reflect
|
||||
@@ -1339,7 +1345,7 @@ zfs_zinactive(znode_t *zp)
|
||||
*/
|
||||
if (zp->z_unlinked) {
|
||||
ASSERT(!zfsvfs->z_issnap);
|
||||
if (!zfs_is_readonly(zfsvfs)) {
|
||||
if (!zfs_is_readonly(zfsvfs) && !zfs_unlink_suspend_progress) {
|
||||
mutex_exit(&zp->z_lock);
|
||||
zfs_znode_hold_exit(zfsvfs, zh);
|
||||
zfs_rmnode(zp);
|
||||
@@ -2214,4 +2220,7 @@ EXPORT_SYMBOL(zfs_obj_to_path);
|
||||
/* CSTYLED */
|
||||
module_param(zfs_object_mutex_size, uint, 0644);
|
||||
MODULE_PARM_DESC(zfs_object_mutex_size, "Size of znode hold array");
|
||||
module_param(zfs_unlink_suspend_progress, int, 0644);
|
||||
MODULE_PARM_DESC(zfs_unlink_suspend_progress, "Set to prevent async unlinks "
|
||||
"(debug - leaks space into the unlinked set)");
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user