From 6281b5c4882f12655c9485eebb681665b7422bef Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Sat, 4 Mar 2023 18:42:01 -0500 Subject: [PATCH] Add missing increment to dsl_deadlist_move_bpobj() dc5c8006f684b1df3f2d4b6b8c121447d2db0017 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 Reviewed-by: Alexander Motin Signed-off-by: Richard Yao Closes #14573 --- module/zfs/dsl_deadlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/dsl_deadlist.c b/module/zfs/dsl_deadlist.c index 1b2d8b92f2..d5fe2ee568 100644 --- a/module/zfs/dsl_deadlist.c +++ b/module/zfs/dsl_deadlist.c @@ -936,7 +936,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. * 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); pdle = AVL_NEXT(&dl->dl_tree, pdle); }