Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Oct 2013 01:38:25 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r256132 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201310080138.r981cPcT048197@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Tue Oct  8 01:38:24 2013
New Revision: 256132
URL: http://svnweb.freebsd.org/changeset/base/256132

Log:
  Improve lzjb decompress performance by reorganizing the code
  to tighten the copy loop.
  
  Submitted by:	Denis Ahrens <denis h3q com>
  MFC after:	2 weeks
  Approved by:	re (gjb)

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c	Mon Oct  7 22:30:03 2013	(r256131)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c	Tue Oct  8 01:38:24 2013	(r256132)
@@ -117,7 +117,9 @@ lzjb_decompress(void *s_start, void *d_s
 			src += 2;
 			if ((cpy = dst - offset) < (uchar_t *)d_start)
 				return (-1);
-			while (--mlen >= 0 && dst < d_end)
+			if (mlen > (d_end - dst))
+				mlen = d_end - dst;
+			while (--mlen >= 0)
 				*dst++ = *cpy++;
 		} else {
 			*dst++ = *src++;



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