Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jan 2015 18:39:26 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r277588 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201501231839.t0NIdQhU026050@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Fri Jan 23 18:39:26 2015
New Revision: 277588
URL: https://svnweb.freebsd.org/changeset/base/277588

Log:
  MFC r275922: MFV r275914:
  
  As of r270383, the dbuf_compare comparator compares the dbuf
  attributes in the following order:
  
        db_level (indirect level)
        db_blkid (block number)
        db_state (current state)
        the address of the element
  
  Because db_state is being considered before the element's state,
  changing of db_state would affect balancedness of the AVL tree,
  even when the address of element compares differently.  For
  instance, in dbuf_create, db_state may be altered after the
  node is inserted into the AVL tree and may break AVL tree
  balancedness.
  
  Instead of using db_state as a comparision critera (introduced
  in r270383), consider it only when we are doing a lookup, that
  is one of the two dbuf pointers contains DB_SEARCH.
  
  Illumos issue:
      5422 preserve AVL invariants in dn_dbufs

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c	Fri Jan 23 18:36:21 2015	(r277587)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c	Fri Jan 23 18:39:26 2015	(r277588)
@@ -81,16 +81,14 @@ dbuf_compare(const void *x1, const void 
 		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);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501231839.t0NIdQhU026050>