Skip to content

Commit 066f51a

Browse files
committed
Fix marker iteration logic
Signed-off-by: Ameer Hamza <[email protected]>
1 parent a4fb298 commit 066f51a

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

module/zfs/arc.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9549,6 +9549,8 @@ l2arc_process_sublist(spa_t *spa, l2arc_dev_t *dev, multilist_sublist_t *mls,
95499549
if (hdr == multilist_sublist_head(mls))
95509550
scan_from_head = B_TRUE;
95519551

9552+
prev_hdr = hdr;
9553+
95529554
while (hdr != NULL) {
95539555
kmutex_t *hash_lock;
95549556
abd_t *to_write = NULL;
@@ -9721,10 +9723,7 @@ l2arc_process_sublist(spa_t *spa, l2arc_dev_t *dev, multilist_sublist_t *mls,
97219723
* Position persistent marker for next iteration
97229724
*/
97239725
if (save_position) {
9724-
if (prev_hdr != NULL)
9725-
multilist_sublist_insert_before(mls, prev_hdr, marker);
9726-
else
9727-
multilist_sublist_insert_head(mls, marker);
9726+
multilist_sublist_insert_before(mls, prev_hdr, marker);
97289727
} else {
97299728
multilist_sublist_insert_tail(mls, marker);
97309729
}
@@ -9834,21 +9833,13 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
98349833
skip_sublist = B_TRUE;
98359834
} else if (save_position) {
98369835
hdr = multilist_sublist_prev(mls, marker);
9837-
if (hdr != NULL)
9838-
multilist_sublist_remove(mls, marker);
9839-
else
9840-
hdr = multilist_sublist_tail(mls);
9836+
ASSERT3P(hdr, !=, NULL);
9837+
multilist_sublist_remove(mls, marker);
98419838
} else {
98429839
multilist_sublist_remove(mls, marker);
98439840
hdr = arc_warm ? multilist_sublist_tail(mls) :
98449841
multilist_sublist_head(mls);
9845-
if (arc_warm) {
9846-
multilist_sublist_insert_tail(mls,
9847-
marker);
9848-
} else {
9849-
multilist_sublist_insert_head(mls,
9850-
marker);
9851-
}
9842+
ASSERT3P(hdr, !=, NULL);
98529843
}
98539844

98549845
if (!skip_sublist) {

0 commit comments

Comments
 (0)