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

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

Log:
  move buffer invalidation in to zio write functions

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/sys/arc.h
  user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.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 21:47:54 2009	(r199554)
+++ user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Thu Nov 19 21:48:01 2009	(r199555)
@@ -1300,18 +1300,18 @@ arc_buf_add_ref(arc_buf_t *buf, void* ta
 	    data, metadata, hits);
 }
 
-static void
-arc_brelvp(arc_buf_hdr_t *hdr)
+void
+arc_binval(spa_t *spa, dva_t *dva)
 {
-	uint64_t blkno = hdr->b_dva.dva_word[1] & ~(1UL<<63);
-	struct vnode *vp = spa_get_vnode(hdr->b_spa);
+	uint64_t blkno = dva->dva_word[1] & ~(1UL<<63);
+	struct vnode *vp = spa_get_vnode(spa);
 	struct bufobj *bo = &vp->v_bufobj;
 	struct buf *bp;
 
 	if (zfs_page_cache_disable)
 		return;
 
-	if (blkno == 0 || hdr->b_birth == 0)
+	if (blkno == 0)
 		return;
 
 	BO_LOCK(bo);
@@ -2673,7 +2673,6 @@ arc_read_done(zio_t *zio)
 	buf = zio->io_private;
 	hdr = buf->b_hdr;
 
-	arc_brelvp(hdr);
 	/*
 	 * The hdr was inserted into hash-table and removed from lists
 	 * prior to starting I/O.  We should find this header, since
@@ -3406,7 +3405,6 @@ arc_write_done(zio_t *zio)
 	hdr->b_dva = *BP_IDENTITY(zio->io_bp);
 	hdr->b_birth = zio->io_bp->blk_birth;
 	hdr->b_cksum0 = zio->io_bp->blk_cksum.zc_word[0];
-	arc_brelvp(hdr);
 
 	/*
 	 * If the block to be written was all-zero, we may have

Modified: user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h
==============================================================================
--- user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h	Thu Nov 19 21:47:54 2009	(r199554)
+++ user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h	Thu Nov 19 21:48:01 2009	(r199555)
@@ -112,6 +112,7 @@ int arc_tryread(spa_t *spa, 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);
 
+void arc_binval(spa_t *spa, dva_t *dva);
 void arc_flush(spa_t *spa);
 void arc_tempreserve_clear(uint64_t reserve);
 int arc_tempreserve_space(uint64_t reserve, uint64_t txg);

Modified: user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==============================================================================
--- user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Thu Nov 19 21:47:54 2009	(r199554)
+++ user/kmacy/releng_8_fcs_buf/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Thu Nov 19 21:48:01 2009	(r199555)
@@ -25,6 +25,7 @@
 
 #include <sys/zfs_context.h>
 #include <sys/fm/fs/zfs.h>
+#include <sys/arc.h>
 #include <sys/spa.h>
 #include <sys/txg.h>
 #include <sys/spa_impl.h>
@@ -548,6 +549,7 @@ zio_write(zio_t *pio, spa_t *spa, uint64
 	    zp->zp_ndvas <= spa_max_replication(spa));
 	ASSERT(ready != NULL);
 
+	arc_binval(spa, BP_IDENTITY(bp));
 	zio = zio_create(pio, spa, txg, bp, data, size, done, private,
 	    ZIO_TYPE_WRITE, priority, flags, NULL, 0, zb,
 	    ZIO_STAGE_OPEN, ZIO_WRITE_PIPELINE);
@@ -565,6 +567,7 @@ zio_rewrite(zio_t *pio, spa_t *spa, uint
 {
 	zio_t *zio;
 
+	arc_binval(spa, BP_IDENTITY(bp));
 	zio = zio_create(pio, spa, txg, bp, data, size, done, private,
 	    ZIO_TYPE_WRITE, priority, flags, NULL, 0, zb,
 	    ZIO_STAGE_OPEN, ZIO_REWRITE_PIPELINE);



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