summaryrefslogtreecommitdiffstats
path: root/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2014-08-23 14:58:31 +0000
committermelifaro <melifaro@FreeBSD.org>2014-08-23 14:58:31 +0000
commitcf94663e69b2c927e4a44dcb922c93483f11bc29 (patch)
treef43a461c97f3db054606f6367939a61652f0db97 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
parent2e65f120c886a9d09b274b1953783df2b995e799 (diff)
parent19be009a4f8eb0d239ec3e465b0a9b2a2947dcf8 (diff)
downloadFreeBSD-src-cf94663e69b2c927e4a44dcb922c93483f11bc29.zip
FreeBSD-src-cf94663e69b2c927e4a44dcb922c93483f11bc29.tar.gz
Sync to HEAD@r270409.
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
index a378601..55bf895 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
@@ -69,33 +69,35 @@ dbuf_compare(const void *x1, const void *x2)
if (d1->db_level < d2->db_level) {
return (-1);
- } else if (d1->db_level > d2->db_level) {
+ }
+ if (d1->db_level > d2->db_level) {
return (1);
}
if (d1->db_blkid < d2->db_blkid) {
return (-1);
- } else if (d1->db_blkid > d2->db_blkid) {
+ }
+ if (d1->db_blkid > d2->db_blkid) {
return (1);
}
- /*
- * If a dbuf is being evicted while dn_dbufs_mutex is not held, we set
- * the db_state to DB_EVICTING but do not remove it from dn_dbufs. If
- * another thread creates a dbuf of the same blkid before the dbuf is
- * removed from dn_dbufs, we can reach a state where there are two
- * dbufs of the same blkid and level in db_dbufs. To maintain the avl
- * invariant that there cannot be duplicate items, we distinguish
- * between these two dbufs based on the time they were created.
- */
- if (d1->db_creation < d2->db_creation) {
+ if (d1->db_state < d2->db_state) {
return (-1);
- } else if (d1->db_creation > d2->db_creation) {
+ }
+ if (d1->db_state > d2->db_state) {
return (1);
- } else {
- ASSERT3P(d1, ==, d2);
- return (0);
}
+
+ ASSERT3S(d1->db_state, !=, DB_SEARCH);
+ ASSERT3S(d2->db_state, !=, DB_SEARCH);
+
+ if ((uintptr_t)d1 < (uintptr_t)d2) {
+ return (-1);
+ }
+ if ((uintptr_t)d1 > (uintptr_t)d2) {
+ return (1);
+ }
+ return (0);
}
/* ARGSUSED */
OpenPOWER on IntegriCloud