On Sat, Oct 26, 2013 at 08:06:45PM +0300, Lasse Collin wrote: > > - For reasons I don't understand, both regular xzcat and pxzcat cause > > the output file to be flushed to disk after the program exits. This > > causes any program which consumes the output of the file to slow down. > > I have no idea. I see you committed something that seems to be related > to this after your email. With a quick reading I don't understand it > well, it seems to be working around some issue with ftruncate() with > ext4.
That's right. It turned out to be a misfeature in ext4: if you truncate a file from a non-zero size down to a zero size, ext4 flags the file and flushes it on close. ("Truncate" includes both O_TRUNC and ftruncate). This can be disabled with the noauto_da_alloc mount option, but of course that is not the default. As you already saw I have added this tedious workaround (several iterations because I wanted it to work correctly if the output is a block device as well as a regular file): http://git.annexia.org/?p=pxzcat.git;a=commitdiff;h=68640d56b2ea96401a1355ab56603b0837058d21 http://git.annexia.org/?p=pxzcat.git;a=commitdiff;h=05f0de58de6cbcbdc40f5a661d406b3fbe5a9060 http://git.annexia.org/?p=pxzcat.git;a=commitdiff;h=8b88d6a25dccb0e086f3d2b1d3cab99d722912aa Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org