6949730 spurious arc_free() can significantly exacerbate 6948890
authorGeorge Wilson <George.Wilson@Sun.COM>
Fri, 07 May 2010 17:45:58 -0700
changeset 12351 b2bf89333345
parent 12350 cfbd9bc39595
child 12352 7e55397422a9
6949730 spurious arc_free() can significantly exacerbate 6948890
usr/src/uts/common/fs/zfs/arc.c
usr/src/uts/common/fs/zfs/sys/arc.h
usr/src/uts/common/fs/zfs/zio.c
--- a/usr/src/uts/common/fs/zfs/arc.c	Fri May 07 15:32:53 2010 -0700
+++ b/usr/src/uts/common/fs/zfs/arc.c	Fri May 07 17:45:58 2010 -0700
@@ -3308,45 +3308,6 @@
 	return (zio);
 }
 
-void
-arc_free(spa_t *spa, const blkptr_t *bp)
-{
-	arc_buf_hdr_t *ab;
-	kmutex_t *hash_lock;
-	uint64_t guid = spa_guid(spa);
-
-	/*
-	 * If this buffer is in the cache, release it, so it can be re-used.
-	 */
-	ab = buf_hash_find(guid, BP_IDENTITY(bp), BP_PHYSICAL_BIRTH(bp),
-	    &hash_lock);
-	if (ab != NULL) {
-		if (ab->b_state != arc_anon)
-			arc_change_state(arc_anon, ab, hash_lock);
-		if (HDR_IO_IN_PROGRESS(ab)) {
-			/*
-			 * This should only happen when we prefetch.
-			 */
-			ASSERT(ab->b_flags & ARC_PREFETCH);
-			ASSERT3U(ab->b_datacnt, ==, 1);
-			ab->b_flags |= ARC_FREED_IN_READ;
-			if (HDR_IN_HASH_TABLE(ab))
-				buf_hash_remove(ab);
-			ab->b_arc_access = 0;
-			buf_discard_identity(ab);
-			ab->b_buf->b_efunc = NULL;
-			ab->b_buf->b_private = NULL;
-			mutex_exit(hash_lock);
-		} else {
-			ASSERT(refcount_is_zero(&ab->b_refcnt));
-			ab->b_flags |= ARC_FREE_IN_PROGRESS;
-			mutex_exit(hash_lock);
-			arc_hdr_destroy(ab);
-			ARCSTAT_BUMP(arcstat_deleted);
-		}
-	}
-}
-
 static int
 arc_memory_throttle(uint64_t reserve, uint64_t inflight_data, uint64_t txg)
 {
--- a/usr/src/uts/common/fs/zfs/sys/arc.h	Fri May 07 15:32:53 2010 -0700
+++ b/usr/src/uts/common/fs/zfs/sys/arc.h	Fri May 07 17:45:58 2010 -0700
@@ -112,7 +112,6 @@
     blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, const zio_prop_t *zp,
     arc_done_func_t *ready, arc_done_func_t *done, void *private,
     int priority, int zio_flags, const zbookmark_t *zb);
-void arc_free(spa_t *spa, const blkptr_t *bp);
 
 void arc_set_callback(arc_buf_t *buf, arc_evict_func_t *func, void *private);
 int arc_buf_evict(arc_buf_t *buf);
--- a/usr/src/uts/common/fs/zfs/zio.c	Fri May 07 15:32:53 2010 -0700
+++ b/usr/src/uts/common/fs/zfs/zio.c	Fri May 07 17:45:58 2010 -0700
@@ -1031,8 +1031,6 @@
 	if (zio->io_child_type == ZIO_CHILD_LOGICAL) {
 		if (BP_GET_DEDUP(bp))
 			zio->io_pipeline = ZIO_DDT_FREE_PIPELINE;
-		else
-			arc_free(zio->io_spa, bp);
 	}
 
 	return (ZIO_PIPELINE_CONTINUE);