Skip to content

Commit

Permalink
Use system_delay_taskq for spa_deadman and zpl_posix_acl_free
Browse files Browse the repository at this point in the history
Signed-off-by: Chunwei Chen <[email protected]>
  • Loading branch information
Chunwei Chen committed Nov 30, 2016
1 parent 616fa7c commit 63d9fd8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions include/sys/zfs_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ typedef struct taskq {
#define TASKQID_INVALID ((taskqid_t)0)

extern taskq_t *system_taskq;
extern taskq_t *system_delay_taskq;

extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t);
#define taskq_create_proc(a, b, c, d, e, p, f) \
Expand Down
5 changes: 5 additions & 0 deletions lib/libzpool/taskq.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

int taskq_now;
taskq_t *system_taskq;
taskq_t *system_delay_taskq;

#define TASKQ_ACTIVE 0x00010000

Expand Down Expand Up @@ -353,11 +354,15 @@ system_taskq_init(void)
{
system_taskq = taskq_create("system_taskq", 64, maxclsyspri, 4, 512,
TASKQ_DYNAMIC | TASKQ_PREPOPULATE);
system_delay_taskq = taskq_create("system_taskq", 4, maxclsyspri, 4,
512, TASKQ_DYNAMIC | TASKQ_PREPOPULATE);
}

void
system_taskq_fini(void)
{
taskq_destroy(system_taskq);
system_taskq = NULL; /* defensive */
taskq_destroy(system_delay_taskq);
system_delay_taskq = NULL;
}
8 changes: 4 additions & 4 deletions module/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ spa_deactivate(spa_t *spa)
list_destroy(&spa->spa_evicting_os_list);
list_destroy(&spa->spa_state_dirty_list);

taskq_cancel_id(system_taskq, spa->spa_deadman_tqid);
taskq_cancel_id(system_delay_taskq, spa->spa_deadman_tqid);

for (t = 0; t < ZIO_TYPES; t++) {
for (q = 0; q < ZIO_TASKQ_TYPES; q++) {
Expand Down Expand Up @@ -6517,8 +6517,8 @@ spa_sync(spa_t *spa, uint64_t txg)
tx = dmu_tx_create_assigned(dp, txg);

spa->spa_sync_starttime = gethrtime();
taskq_cancel_id(system_taskq, spa->spa_deadman_tqid);
spa->spa_deadman_tqid = taskq_dispatch_delay(system_taskq,
taskq_cancel_id(system_delay_taskq, spa->spa_deadman_tqid);
spa->spa_deadman_tqid = taskq_dispatch_delay(system_delay_taskq,
spa_deadman, spa, TQ_SLEEP, ddi_get_lbolt() +
NSEC_TO_TICK(spa->spa_deadman_synctime));

Expand Down Expand Up @@ -6706,7 +6706,7 @@ spa_sync(spa_t *spa, uint64_t txg)
}
dmu_tx_commit(tx);

taskq_cancel_id(system_taskq, spa->spa_deadman_tqid);
taskq_cancel_id(system_delay_taskq, spa->spa_deadman_tqid);
spa->spa_deadman_tqid = 0;

/*
Expand Down
2 changes: 1 addition & 1 deletion module/zfs/spa_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ spa_deadman(void *arg)
if (zfs_deadman_enabled)
vdev_deadman(spa->spa_root_vdev);

spa->spa_deadman_tqid = taskq_dispatch_delay(system_taskq,
spa->spa_deadman_tqid = taskq_dispatch_delay(system_delay_taskq,
spa_deadman, spa, TQ_SLEEP, ddi_get_lbolt() +
NSEC_TO_TICK(spa->spa_deadman_synctime));
}
Expand Down
1 change: 1 addition & 0 deletions module/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1922,6 +1922,7 @@ zfs_fini(void)
/*
* we don't use outstanding because zpl_posix_acl_free might add more.
*/
taskq_wait(system_delay_taskq);
taskq_wait(system_taskq);
unregister_filesystem(&zpl_fs_type);
zfs_znode_fini();
Expand Down
8 changes: 4 additions & 4 deletions module/zfs/zpl_xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1511,8 +1511,8 @@ zpl_posix_acl_free(void *arg)
}

if (refire)
taskq_dispatch_delay(system_taskq, zpl_posix_acl_free, NULL,
TQ_SLEEP, new_time);
taskq_dispatch_delay(system_delay_taskq, zpl_posix_acl_free,
NULL, TQ_SLEEP, new_time);

while (freelist) {
a = freelist;
Expand All @@ -1537,7 +1537,7 @@ zpl_posix_acl_release_impl(struct posix_acl *acl)
*prev = a;
/* if it was empty before, schedule the free task */
if (prev == &acl_rel_head)
taskq_dispatch_delay(system_taskq, zpl_posix_acl_free, NULL,
TQ_SLEEP, ddi_get_lbolt() + ACL_REL_SCHED);
taskq_dispatch_delay(system_delay_taskq, zpl_posix_acl_free,
NULL, TQ_SLEEP, ddi_get_lbolt() + ACL_REL_SCHED);
}
#endif

0 comments on commit 63d9fd8

Please sign in to comment.