Re: dpkg 1.15.6 is slow as hell
On Fri, 12 Mar 2010, Raphael Hertzog wrote:
> Other possibility would be to use the loop afterwards to reopen all
> installed files and call fsync() on them. The disadvantage of sync() is
> obviously when unrelated disk activity happens in parallel to dpkg, it
> will have to wait more due to this.
My guess is that doing fsync in a loop afterwards will have the same
impact as doing fsync during the unpack phase. I think the main problem
here is that of I/O reordering not happening when you do fsync, and if
the files are not ordered in an advantageous way on the disk compared to
the order they are unpacked, the resulting seeks can have a disastrous
impact on performance.
So, IMHO, what you really want to do is unpack, sync everything, and
then rename. Unfortunately, there exists nothing that permits to sync
only a set of files, and as was said in this thread, sync() doesn't
necessarily guarantees all writes happened once it returns, though that
might be true on Linux.
One could think of using FIEMAP to reorder the fsyncs, but there are
chances that this wouldn't work on ext4 and other fs that use delayed
allocation, in which case you'll probably only get
PS: I'm not subscribed, please Cc me.