From owner-svn-src-head@FreeBSD.ORG Tue Oct 8 01:38:25 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 89224D0A; Tue, 8 Oct 2013 01:38:25 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 76B4F259E; Tue, 8 Oct 2013 01:38:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r981cPeg048198; Tue, 8 Oct 2013 01:38:25 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r981cPcT048197; Tue, 8 Oct 2013 01:38:25 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201310080138.r981cPcT048197@svn.freebsd.org> From: Xin LI Date: Tue, 8 Oct 2013 01:38:25 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Oct 2013 01:38:25 -0000 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 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++;