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;
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to