diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c index e1ea165aa..6865cd01e 100644 --- a/module/zfs/dnode.c +++ b/module/zfs/dnode.c @@ -83,16 +83,14 @@ dbuf_compare(const void *x1, const void *x2) return (1); } - if (d1->db_state < d2->db_state) { + if (d1->db_state == DB_SEARCH) { + ASSERT3S(d2->db_state, !=, DB_SEARCH); return (-1); - } - if (d1->db_state > d2->db_state) { + } else if (d2->db_state == DB_SEARCH) { + ASSERT3S(d1->db_state, !=, DB_SEARCH); return (1); } - ASSERT3S(d1->db_state, !=, DB_SEARCH); - ASSERT3S(d2->db_state, !=, DB_SEARCH); - if ((uintptr_t)d1 < (uintptr_t)d2) { return (-1); }