Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Dec 2014 13:06:45 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r275609 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201412081306.sB8D6jab097725@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Mon Dec  8 13:06:44 2014
New Revision: 275609
URL: https://svnweb.freebsd.org/changeset/base/275609

Log:
  MFC r274628: l2arc: restore correct rounding up of asize of compressed data

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Mon Dec  8 12:30:40 2014	(r275608)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Mon Dec  8 13:06:44 2014	(r275609)
@@ -5329,12 +5329,6 @@ l2arc_compress_buf(l2arc_buf_hdr_t *l2hd
 	csize = zio_compress_data(ZIO_COMPRESS_LZ4, l2hdr->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);
@@ -5343,11 +5337,19 @@ l2arc_compress_buf(l2arc_buf_hdr_t *l2hd
 		l2hdr->b_tmp_cdata = NULL;
 		ARCSTAT_BUMP(arcstat_l2_compress_zeros);
 		return (B_TRUE);
-	} else if (csize > 0 && csize < len) {
+	}
+
+	rounded = P2ROUNDUP(csize,
+	    (size_t)1 << l2hdr->b_dev->l2ad_vdev->vdev_ashift);
+	if (rounded < 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;
+		}
 		l2hdr->b_compress = ZIO_COMPRESS_LZ4;
 		l2hdr->b_asize = csize;
 		l2hdr->b_tmp_cdata = cdata;



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