Add missing increment to dsl_deadlist_move_bpobj()

dc5c8006f6 was recently merged to prefetch
up to 128 deadlists. Unfortunately, a loop was missing an increment,
such that it will prefetch all deadlists. The performance properties of
that patch probably should be re-evaluated.

This was caught by CodeQL's cpp/constant-comparison check in an
experimental branch where I am testing the security-and-extended
queries. It complained about the `i < 128` part of the loop condition
always evaluating to the same thing. The standard CodeQL configuration
we use missed this because it does not include that check.

Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14573
This commit is contained in:
Richard Yao 2023-03-04 18:42:01 -05:00 committed by Brian Behlendorf
parent 8846139b45
commit b79e7114bb

View File

@ -943,7 +943,7 @@ dsl_deadlist_move_bpobj(dsl_deadlist_t *dl, bpobj_t *bpo, uint64_t mintxg,
* Prefetch up to 128 deadlists first and then more as we progress. * Prefetch up to 128 deadlists first and then more as we progress.
* The limit is a balance between ARC use and diminishing returns. * The limit is a balance between ARC use and diminishing returns.
*/ */
for (pdle = dle, i = 0; pdle && i < 128; ) { for (pdle = dle, i = 0; pdle && i < 128; i++) {
bpobj_prefetch_subobj(bpo, pdle->dle_bpobj.bpo_object); bpobj_prefetch_subobj(bpo, pdle->dle_bpobj.bpo_object);
pdle = AVL_NEXT(&dl->dl_tree, pdle); pdle = AVL_NEXT(&dl->dl_tree, pdle);
} }