-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spa_taskq_dispatch_ent: simplify arguments
This renames it to spa_taskq_dispatch(), and reduces and simplifies its arguments based on these observations from its two call sites: - arg is always the zio, so it can be typed that way, and we don't need to provide it twice; - ent is always &zio->io_tqent, and zio is always provided, so we can use it directly; - the only flag used is TQ_FRONT, which can just be a bool; - zio != NULL was part of the "use allocator" test, but it never would have got that far, because that arg was only set to NULL in the reexecute path, which is forced to type CLAIM, so the condition would fail at t == WRITE anyway. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <[email protected]>
- Loading branch information
Showing
3 changed files
with
19 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ | |
* Copyright (c) 2017, Intel Corporation. | ||
* Copyright (c) 2021, Colm Buckley <[email protected]> | ||
* Copyright (c) 2023 Hewlett Packard Enterprise Development LP. | ||
* Copyright (c) 2024, Klara Inc. | ||
*/ | ||
|
||
/* | ||
|
@@ -1485,26 +1486,34 @@ spa_taskq_write_param(ZFS_MODULE_PARAM_ARGS) | |
* on the taskq itself. | ||
*/ | ||
void | ||
spa_taskq_dispatch_ent(spa_t *spa, zio_type_t t, zio_taskq_type_t q, | ||
task_func_t *func, void *arg, uint_t flags, taskq_ent_t *ent, | ||
zio_t *zio) | ||
spa_taskq_dispatch(spa_t *spa, zio_type_t t, zio_taskq_type_t q, | ||
task_func_t *func, zio_t *zio, boolean_t cutinline) | ||
{ | ||
spa_taskqs_t *tqs = &spa->spa_zio_taskq[t][q]; | ||
taskq_t *tq; | ||
|
||
ASSERT3P(tqs->stqs_taskq, !=, NULL); | ||
ASSERT3U(tqs->stqs_count, !=, 0); | ||
|
||
/* | ||
* NB: We are assuming that the zio can only be dispatched | ||
* to a single taskq at a time. It would be a grievous error | ||
* to dispatch the zio to another taskq at the same time. | ||
*/ | ||
ASSERT(zio); | ||
ASSERT(taskq_empty_ent(&zio->io_tqent)); | ||
|
||
if (tqs->stqs_count == 1) { | ||
tq = tqs->stqs_taskq[0]; | ||
} else if ((t == ZIO_TYPE_WRITE) && (q == ZIO_TASKQ_ISSUE) && | ||
(zio != NULL) && ZIO_HAS_ALLOCATOR(zio)) { | ||
ZIO_HAS_ALLOCATOR(zio)) { | ||
tq = tqs->stqs_taskq[zio->io_allocator % tqs->stqs_count]; | ||
} else { | ||
tq = tqs->stqs_taskq[((uint64_t)gethrtime()) % tqs->stqs_count]; | ||
} | ||
|
||
taskq_dispatch_ent(tq, func, arg, flags, ent); | ||
taskq_dispatch_ent(tq, func, zio, cutinline ? TQ_FRONT : 0, | ||
&zio->io_tqent); | ||
} | ||
|
||
static void | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters