diff options
author | delphij <delphij@FreeBSD.org> | 2013-10-08 01:38:24 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2013-10-08 01:38:24 +0000 |
commit | 038b37b9522d8aa260ec22d631faf6337ff7ff9a (patch) | |
tree | cbf8ea4e3527849e841f6893dfd39ae9c7dea90c /sys/cddl/contrib/opensolaris/uts | |
parent | 2b5c0ebf70d799370817138e0a561f29398d7ac7 (diff) | |
download | FreeBSD-src-038b37b9522d8aa260ec22d631faf6337ff7ff9a.zip FreeBSD-src-038b37b9522d8aa260ec22d631faf6337ff7ff9a.tar.gz |
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)
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c index f8d3061..699373a 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c @@ -117,7 +117,9 @@ lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n) 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++; |