summaryrefslogtreecommitdiffstats
path: root/sys/cddl
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2014-12-08 13:06:44 +0000
committeravg <avg@FreeBSD.org>2014-12-08 13:06:44 +0000
commitc07a7147dfe34345d865f4505c5ed1b54f7561d5 (patch)
tree3502d53646deb7fd3e5972c6b22d84e5734a384a /sys/cddl
parent379a1af59c365113790e2fd338afb17fce738940 (diff)
downloadFreeBSD-src-c07a7147dfe34345d865f4505c5ed1b54f7561d5.zip
FreeBSD-src-c07a7147dfe34345d865f4505c5ed1b54f7561d5.tar.gz
MFC r274628: l2arc: restore correct rounding up of asize of compressed data
Diffstat (limited to 'sys/cddl')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
index e7a2948..247e603 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
@@ -5329,12 +5329,6 @@ l2arc_compress_buf(l2arc_buf_hdr_t *l2hdr)
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 *l2hdr)
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;
OpenPOWER on IntegriCloud