svn commit: r213044 - head/usr.bin/gzip

Xin LI delphij at FreeBSD.org
Thu Sep 23 01:24:33 UTC 2010


Author: delphij
Date: Thu Sep 23 01:24:33 2010
New Revision: 213044
URL: http://svn.freebsd.org/changeset/base/213044

Log:
  In the past gunzip(1) write()'s after each inflate return.  This is
  not optimal from a performance standpoint since the write buffer is
  not necessarily be filled up when the inflate rountine reached the
  end of input buffer and it's not the end of file.
  
  This problem gets uncovered by trying to pipe gunzip -c output to
  a GEOM device directly, which enforces the writes be multiple of
  sector size.
  
  Sponsored by:	iXsystems, Inc.
  Reported by:	jpaetzel
  MFC after:	2 weeks

Modified:
  head/usr.bin/gzip/gzip.c

Modified: head/usr.bin/gzip/gzip.c
==============================================================================
--- head/usr.bin/gzip/gzip.c	Thu Sep 23 01:19:31 2010	(r213043)
+++ head/usr.bin/gzip/gzip.c	Thu Sep 23 01:24:33 2010	(r213044)
@@ -916,6 +916,8 @@ gz_uncompress(int in, int out, char *pre
 			switch (error) {
 			/* Z_BUF_ERROR goes with Z_FINISH... */
 			case Z_BUF_ERROR:
+				if (z.avail_out > 0 && !done_reading)
+					continue;
 			case Z_STREAM_END:
 			case Z_OK:
 				break;


More information about the svn-src-head mailing list