Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Nov 2009 01:29:10 +0000 (UTC)
From:      Kip Macy <kmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r199503 - user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <200911190129.nAJ1TAlb089896@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kmacy
Date: Thu Nov 19 01:29:10 2009
New Revision: 199503
URL: http://svn.freebsd.org/changeset/base/199503

Log:
  invalidate older buffer on first free

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	Thu Nov 19 01:27:22 2009	(r199502)
+++ user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Thu Nov 19 01:29:10 2009	(r199503)
@@ -1328,23 +1328,24 @@ arc_bgetvp(arc_buf_t *buf)
 		BUF_LOCK(bp, LK_EXCLUSIVE | LK_INTERLOCK, BO_MTX(bo));
 		bremfree(bp);
 		/*
-		 * buffer is usable for this mapping
+		 * buffer is not valid or is older
 		 */
-		if (((bp->b_flags & (B_CACHE|B_INVAL)) == B_CACHE) &&
-		    (bp->b_birth > hdr->b_birth)) {
-			brelse(bp);
-		} else {
+		if (((bp->b_flags & (B_CACHE|B_INVAL)) != B_CACHE) ||
+		    (bp->b_birth <= hdr->b_birth)) {
 			bp->b_flags |= B_INVAL;
 			bp->b_birth = 0;
-			brelse(bp);
-			if (!(hdr->b_flags & ARC_IO_ERROR) &&
-			    (newbp->b_flags & (B_INVAL|B_CACHE)) == B_CACHE) {
-				BO_LOCK(bo);
-				bgetvp(vp, newbp);
-				BO_UNLOCK(bo);
-			}
 		} 
-	} else 	if (!(hdr->b_flags & ARC_IO_ERROR) &&
+		brelse(bp);
+
+		if ((hdr->b_datacnt == 1) &&
+		    !(hdr->b_flags & ARC_IO_ERROR) &&
+		    (newbp->b_flags & (B_INVAL|B_CACHE)) == B_CACHE) {
+			BO_LOCK(bo);
+			bgetvp(vp, newbp);
+			BO_UNLOCK(bo);
+		}
+	} else 	if ((hdr->b_datacnt == 1) &&
+	    !(hdr->b_flags & ARC_IO_ERROR) &&
 	    (newbp->b_flags & (B_INVAL|B_CACHE)) == B_CACHE) {
 		bgetvp(vp, newbp);
 		BO_UNLOCK(bo);
@@ -1419,12 +1420,10 @@ arc_brelse(arc_buf_t *buf, void *data, s
 		return;
 	}
 
-	if (hdr->b_datacnt == 1) {
-		arc_bgetvp(buf);
-		CTR4(KTR_SPARE2, "arc_brelse() bp=%p flags %X"
-		    " size %ld blkno=%ld",
-		    bp, bp->b_flags, size, bp->b_blkno);
-	}
+	arc_bgetvp(buf);
+	CTR4(KTR_SPARE2, "arc_brelse() bp=%p flags %X"
+	    " size %ld blkno=%ld",
+	    bp, bp->b_flags, size, bp->b_blkno);
 
 	brelse(bp);
 }



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