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
This commit is contained in:
Xin LI 2010-09-23 01:24:33 +00:00
parent ff7e67ac1c
commit fb2924e4ac
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=213044

View File

@ -916,6 +916,8 @@ gz_uncompress(int in, int out, char *pre, size_t prelen, off_t *gsizep,
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;