Date: Wed, 18 Nov 2009 04:07:16 +0000 (UTC) From: Kip Macy <kmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r199467 - user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200911180407.nAI47Gh4057186@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kmacy Date: Wed Nov 18 04:07:16 2009 New Revision: 199467 URL: http://svn.freebsd.org/changeset/base/199467 Log: only cache buffers that have been read from or written to disk 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 Wed Nov 18 01:43:11 2009 (r199466) +++ user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Nov 18 04:07:16 2009 (r199467) @@ -1315,6 +1315,10 @@ arc_bgetvp(arc_buf_t *buf) return; newbp = buf->b_bp; + + if ((newbp->b_flags & (B_INVAL|B_CACHE)) != B_CACHE) + return; + newbp->b_offset = newbp->b_birth = hdr->b_birth; newbp->b_blkno = newbp->b_lblkno = blkno; @@ -1341,9 +1345,6 @@ arc_bgetvp(arc_buf_t *buf) bp->b_birth = 0; brelse(bp); - newbp->b_flags |= B_CACHE; - newbp->b_flags &= ~B_INVAL; - BO_LOCK(bo); bgetvp(vp, newbp); BO_UNLOCK(bo); @@ -1423,8 +1424,7 @@ arc_brelse(arc_buf_t *buf, void *data, s return; } - if (hdr->b_datacnt == 1) - arc_bgetvp(buf); + 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); @@ -2702,8 +2702,11 @@ arc_read_done(zio_t *zio) if (HDR_IN_HASH_TABLE(hdr)) buf_hash_remove(hdr); freeable = refcount_is_zero(&hdr->b_refcnt); + } else if (buf->b_bp != NULL) { + buf->b_bp->b_flags |= B_CACHE; + buf->b_bp->b_flags &= ~B_INVAL; } - + /* * Broadcast before we drop the hash_lock to avoid the possibility * that the hdr (and hence the cv) might be freed before we get to @@ -3415,7 +3418,10 @@ arc_write_done(zio_t *zio) arc_hdr_destroy(exists); exists = buf_hash_insert(hdr, &hash_lock); ASSERT3P(exists, ==, NULL); - } + } else if (buf->b_bp != NULL) { + buf->b_bp->b_flags |= B_CACHE; + buf->b_bp->b_flags &= ~B_INVAL; + } hdr->b_flags &= ~ARC_IO_IN_PROGRESS; /* if it's not anon, we are doing a scrub */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911180407.nAI47Gh4057186>