Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Apr 2010 12:25:40 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r206794 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201004181225.o3ICPenT077684@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Sun Apr 18 12:25:40 2010
New Revision: 206794
URL: http://svn.freebsd.org/changeset/base/206794

Log:
  Extend locks scope to match OpenSolaris.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Sun Apr 18 12:21:52 2010	(r206793)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Sun Apr 18 12:25:40 2010	(r206794)
@@ -1106,8 +1106,6 @@ add_reference(arc_buf_hdr_t *ab, kmutex_
 		mutex_enter(lock);
 		ASSERT(list_link_active(&ab->b_arc_node));
 		list_remove(list, ab);
-		mutex_exit(lock);
-
 		if (GHOST_STATE(ab->b_state)) {
 			ASSERT3U(ab->b_datacnt, ==, 0);
 			ASSERT3P(ab->b_buf, ==, NULL);
@@ -1116,6 +1114,7 @@ add_reference(arc_buf_hdr_t *ab, kmutex_
 		ASSERT(delta > 0);
 		ASSERT3U(*size, >=, delta);
 		atomic_add_64(size, -delta);
+		mutex_exit(lock);
 		/* remove the prefetch flag if we get a reference */
 		if (ab->b_flags & ARC_PREFETCH)
 			ab->b_flags &= ~ARC_PREFETCH;
@@ -1138,15 +1137,13 @@ remove_reference(arc_buf_hdr_t *ab, kmut
 		kmutex_t *lock;
 
 		get_buf_info(ab, state, &list, &lock);
-
 		ASSERT(!MUTEX_HELD(lock));
 		mutex_enter(lock);
 		ASSERT(!list_link_active(&ab->b_arc_node));
 		list_insert_head(list, ab);
-		mutex_exit(lock);
-
 		ASSERT(ab->b_datacnt > 0);
 		atomic_add_64(size, ab->b_size * ab->b_datacnt);
+		mutex_exit(lock);
 	}
 	return (cnt);
 }



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