Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Nov 2009 05:47:53 +0000 (UTC)
From:      Kip Macy <kmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r199691 - user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <200911230547.nAN5lrfP041818@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kmacy
Date: Mon Nov 23 05:47:53 2009
New Revision: 199691
URL: http://svn.freebsd.org/changeset/base/199691

Log:
  assert that a buffers pages are not attached to the object

Modified:
  user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c

Modified: user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Mon Nov 23 05:16:35 2009	(r199690)
+++ user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Mon Nov 23 05:47:53 2009	(r199691)
@@ -1491,24 +1491,37 @@ arc_getblk(arc_buf_t *buf)
 
 	if (newbp != NULL) {
 		BUF_KERNPROC(newbp);
-		KASSERT(newbp->b_pages[0]->object == NULL,
-		    "newbp page not removed");
+#ifdef INVARIANTS
+		for (i = 0; i < newbp->b_npages; i++)
+			KASSERT(newbp->b_pages[i]->object == NULL,
+			    "newbp page not removed");
+#endif	
 	}
 	buf->b_bp = newbp;
 	buf->b_data = data;
 }
 
-static void
+void
+arc_brelse(arc_buf_t *buf, void *data, size_t size);
+
+void
 arc_brelse(arc_buf_t *buf, void *data, size_t size)
 {
 	struct buf *bp = buf->b_bp;
 	arc_buf_hdr_t *hdr = buf->b_hdr;
-
+#ifdef INVARIANTS
+	int i;
+#endif
+	
 	if (bp == NULL) {
 		zio_buf_free(buf->b_data, size);
 		return;
 	}
-
+#ifdef INVARIANTS
+	for (i = 0; i < bp->b_npages; i++)
+		KASSERT(bp->b_pages[i]->object == NULL,
+		    "newbp page not removed");
+#endif	
 	arc_bcache(buf);
 
 
@@ -1519,10 +1532,6 @@ arc_brelse(arc_buf_t *buf, void *data, s
 		    " size %ld blkno=%ld",
 		    bp, bp->b_flags, size, bp->b_blkno);
 
-	/*
-	 * need to log path through here to determine why we're not ending up on the inactive queue
-	 *
-	 */
 	brelse(bp);
 }
 
@@ -2805,6 +2814,12 @@ arc_read_done(zio_t *zio)
 			buf_hash_remove(hdr);
 		freeable = refcount_is_zero(&hdr->b_refcnt);
 	} else if (buf->b_bp != NULL) {
+#ifdef INVARIANTS
+		int i;
+		for (i = 0; i < buf->b_bp->b_npages; i++)
+			KASSERT(buf->b_bp->b_pages[i]->object == NULL,
+			    "bp page not removed");
+#endif	
 		buf->b_bp->b_flags |= B_CACHE;
 		buf->b_bp->b_flags &= ~B_INVAL;
 	}



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