changeset 982:9bc5c1db9740

6345547 assertion failed: tempreserve < arc.c/4 from zfs_rename 6354299 Disable metadata compression, at least temporarily
author maybee
date Wed, 23 Nov 2005 07:16:54 -0800
parents e6bfffd6f3be
children 95a37567bb52
files usr/src/uts/common/fs/zfs/arc.c usr/src/uts/common/fs/zfs/dbuf.c usr/src/uts/common/fs/zfs/dmu_objset.c
diffstat 3 files changed, 23 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/arc.c	Wed Nov 23 03:08:29 2005 -0800
+++ b/usr/src/uts/common/fs/zfs/arc.c	Wed Nov 23 07:16:54 2005 -0800
@@ -1891,18 +1891,24 @@
 		return (ERESTART);
 	}
 #endif
+	if (tempreserve > arc.c/4 && !arc.no_grow)
+		arc.c = MIN(arc.c_max, tempreserve * 4);
+	if (tempreserve > arc.c)
+		return (ENOMEM);
+
 	/*
-	 * XXX This is kind of hacky.  The limit should be adjusted
-	 * dynamically to keep the time to sync a dataset fixed (around
-	 * 1-5 seconds?).
-	 * Maybe should have some sort of locking?  If two requests come
-	 * in concurrently, we might let them both succeed, when one of
-	 * them should fail.  Not a huge deal.
+	 * Throttle writes when the amount of dirty data in the cache
+	 * gets too large.  We try to keep the cache less than half full
+	 * of dirty blocks so that our sync times don't grow too large.
+	 * Note: if two requests come in concurrently, we might let them
+	 * both succeed, when one of them should fail.  Not a huge deal.
+	 *
+	 * XXX The limit should be adjusted dynamically to keep the time
+	 * to sync a dataset fixed (around 1-5 seconds?).
 	 */
 
-	ASSERT3U(tempreserve, <, arc.c/4); /* otherwise we'll loop forever */
-
-	if (arc_tempreserve + tempreserve + arc.anon->size > arc.c / 4) {
+	if (tempreserve + arc_tempreserve + arc.anon->size > arc.c / 2 &&
+	    arc_tempreserve + arc.anon->size > arc.c / 4) {
 		dprintf("failing, arc_tempreserve=%lluK anon=%lluK "
 		    "tempreserve=%lluK arc.c=%lluK\n",
 		    arc_tempreserve>>10, arc.anon->lsize>>10,
@@ -1932,9 +1938,9 @@
 	arc.c = MIN(arc.c, vmem_size(heap_arena, VMEM_ALLOC | VMEM_FREE) / 8);
 #endif
 
-	/* use at least 1/32 of all memory, or 32MB, whichever is more */
+	/* set min cache to 1/32 of all memory, or 64MB, whichever is more */
 	arc.c_min = MAX(arc.c / 4, 64<<20);
-	/* use at most 3/4 of all memory, or all but 1GB, whichever is more */
+	/* set max to 3/4 of all memory, or all but 1GB, whichever is more */
 	if (arc.c * 8 >= 1<<30)
 		arc.c_max = (arc.c * 8) - (1<<30);
 	else
--- a/usr/src/uts/common/fs/zfs/dbuf.c	Wed Nov 23 03:08:29 2005 -0800
+++ b/usr/src/uts/common/fs/zfs/dbuf.c	Wed Nov 23 07:16:54 2005 -0800
@@ -1847,7 +1847,8 @@
 			 * that specializes in arrays of bps.
 			 */
 			checksum = ZIO_CHECKSUM_FLETCHER_4;
-			compress = ZIO_COMPRESS_LZJB;
+			/* XXX - disable compresssion for now */
+			compress = ZIO_COMPRESS_OFF;
 		} else {
 			/*
 			 * Allow dnode settings to override objset settings,
--- a/usr/src/uts/common/fs/zfs/dmu_objset.c	Wed Nov 23 03:08:29 2005 -0800
+++ b/usr/src/uts/common/fs/zfs/dmu_objset.c	Wed Nov 23 07:16:54 2005 -0800
@@ -166,8 +166,9 @@
 		ASSERT(err == 0);
 	} else {
 		/* It's the meta-objset. */
+		/* XXX - turn off metadata compression temporarily */
 		osi->os_checksum = ZIO_CHECKSUM_FLETCHER_4;
-		osi->os_compress = ZIO_COMPRESS_LZJB;
+		osi->os_compress = ZIO_COMPRESS_OFF;
 	}
 
 	/*
@@ -184,7 +185,8 @@
 	else
 		osi->os_md_checksum = ZIO_CHECKSUM_FLETCHER_4;
 
-	osi->os_md_compress = ZIO_COMPRESS_LZJB;
+	/* XXX - turn off metadata compression temporarily */
+	osi->os_md_compress = ZIO_COMPRESS_OFF;
 
 	for (i = 0; i < TXG_SIZE; i++) {
 		list_create(&osi->os_dirty_dnodes[i], sizeof (dnode_t),