Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Aug 2015 13:43:12 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r286776 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201508141343.t7EDhCJ5058696@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Fri Aug 14 13:43:12 2015
New Revision: 286776
URL: https://svnweb.freebsd.org/changeset/base/286776

Log:
  Remove some random accumulated diff from Illumos.
  
  Submitted by:	avg (partially)

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Fri Aug 14 13:39:55 2015	(r286775)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Fri Aug 14 13:43:12 2015	(r286776)
@@ -2413,6 +2413,7 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr)
 
 	if (!BUF_EMPTY(hdr))
 		buf_discard_identity(hdr);
+
 	if (hdr->b_freeze_cksum != NULL) {
 		kmem_free(hdr->b_freeze_cksum, sizeof (zio_cksum_t));
 		hdr->b_freeze_cksum = NULL;
@@ -4655,8 +4656,6 @@ arc_release(arc_buf_t *buf, void *tag)
 {
 	arc_buf_hdr_t *hdr = buf->b_hdr;
 
-	ASSERT(HDR_HAS_L1HDR(hdr));
-
 	/*
 	 * It would be nice to assert that if it's DMU metadata (level >
 	 * 0 || it's the dnode file), then it must be syncing context.
@@ -4664,6 +4663,9 @@ arc_release(arc_buf_t *buf, void *tag)
 	 */
 
 	mutex_enter(&buf->b_evict_lock);
+
+	ASSERT(HDR_HAS_L1HDR(hdr));
+
 	/*
 	 * We don't grab the hash lock prior to this check, because if
 	 * the buffer's header is in the arc_anon state, it won't be
@@ -5894,6 +5896,7 @@ top:
 			/*
 			 * Error - drop L2ARC entry.
 			 */
+			list_remove(buflist, hdr);
 			trim_map_free(hdr->b_l2hdr.b_dev->l2ad_vdev,
 			    hdr->b_l2hdr.b_daddr, hdr->b_l2hdr.b_asize, 0);
 			hdr->b_flags &= ~ARC_FLAG_HAS_L2HDR;
@@ -6414,14 +6417,6 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
 		buf_sz = hdr->b_l2hdr.b_asize;
 
 		/*
-		 * If the data has not been compressed, then clear b_tmp_cdata
-		 * to make sure that it points only to a temporary compression
-		 * buffer.
-		 */
-		if (!L2ARC_IS_VALID_COMPRESS(HDR_GET_COMPRESS(hdr)))
-			hdr->b_l1hdr.b_tmp_cdata = NULL;
-
-		/*
 		 * We need to do this regardless if buf_sz is zero or
 		 * not, otherwise, when this l2hdr is evicted we'll
 		 * remove a reference that was never added.
@@ -6514,6 +6509,12 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr)
 	csize = zio_compress_data(ZIO_COMPRESS_LZ4, hdr->b_l1hdr.b_tmp_cdata,
 	    cdata, l2hdr->b_asize);
 
+	rounded = P2ROUNDUP(csize, (size_t)SPA_MINBLOCKSIZE);
+	if (rounded > csize) {
+		bzero((char *)cdata + csize, rounded - csize);
+		csize = rounded;
+	}
+
 	if (csize == 0) {
 		/* zero block, indicate that there's nothing to write */
 		zio_data_buf_free(cdata, len);
@@ -6522,19 +6523,11 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr)
 		hdr->b_l1hdr.b_tmp_cdata = NULL;
 		ARCSTAT_BUMP(arcstat_l2_compress_zeros);
 		return (B_TRUE);
-	}
-
-	rounded = P2ROUNDUP(csize,
-	    (size_t)1 << l2hdr->b_dev->l2ad_vdev->vdev_ashift);
-	if (rounded < len) {
+	} else if (csize > 0 && csize < len) {
 		/*
 		 * Compression succeeded, we'll keep the cdata around for
 		 * writing and release it afterwards.
 		 */
-		if (rounded > csize) {
-			bzero((char *)cdata + csize, rounded - csize);
-			csize = rounded;
-		}
 		HDR_SET_COMPRESS(hdr, ZIO_COMPRESS_LZ4);
 		l2hdr->b_asize = csize;
 		hdr->b_l1hdr.b_tmp_cdata = cdata;
@@ -6651,6 +6644,7 @@ l2arc_release_cdata_buf(arc_buf_hdr_t *h
 		    hdr->b_size);
 		hdr->b_l1hdr.b_tmp_cdata = NULL;
 	}
+
 }
 
 /*



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