Illumos 5422 - preserve AVL invariants in dn_dbufs

Author: Alex Reece <alex@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <paul.dagnelie@delphix.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Albert Lee <trisk@nexenta.com>
Approved by: Dan McDonald <danmcd@omniti.com>

References:
  https://www.illumos.org/issues/5422
  https://github.com/illumos/illumos-gate/commit/a846f19

Ported-by: Chris Dunlop <chris@onthe.net.au>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3381
This commit is contained in:
Alex Reece 2015-05-07 03:08:25 +10:00 committed by Brian Behlendorf
parent e48533383b
commit 7224c67fea
1 changed files with 4 additions and 6 deletions

View File

@ -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);
}