Skip to content

Commit

Permalink
Cleanup: metaslab_alloc_dva() should not NULL check mg->mg_next
Browse files Browse the repository at this point in the history
This is a circularly linked list. mg->mg_next can never be NULL.

This caused 3 defect reports in Coverity.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes openzfs#14042
  • Loading branch information
ryao authored and andrewc12 committed Oct 21, 2022
1 parent 62440a2 commit 22e3085
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions module/zfs/metaslab.c
Original file line number Diff line number Diff line change
Expand Up @@ -5131,8 +5131,7 @@ metaslab_alloc_dva(spa_t *spa, metaslab_class_t *mc, uint64_t psize,
if (vd != NULL && vd->vdev_mg != NULL) {
mg = vdev_get_mg(vd, mc);

if (flags & METASLAB_HINTBP_AVOID &&
mg->mg_next != NULL)
if (flags & METASLAB_HINTBP_AVOID)
mg = mg->mg_next;
} else {
mg = mca->mca_rotor;
Expand Down

0 comments on commit 22e3085

Please sign in to comment.