On Thursday 03,March,2011 02:45 PM, Marius Vollmer wrote: > ext Chow Loong Jin <hyperair@ubuntu.com> writes: > >> Could we somehow avoid using sync()? sync() syncs all mounted filesystems, which >> isn't exactly very friendly when you have a few slow-syncing filesystems like >> btrfs (or even NFS) mounted. > > Hmm, right. We could keep a list of all files that need fsyncing, and > then fsync them all just before writing the checkpoint. I remember seeing there being some list of files to be fsynced in one of the older dpkgs. It's probably that which led to the ext4 slowdown -- you'd get the same effect of one sync() per file on systems with an ext4 root. If you had a process doing heavy I/O in the background, each of those fsync()s will take a considerable amount of time. > Half of that is already done (for the content of the packages), we would > need to add it for the files in /var/lib/dpkg/, or we could just fsync > the whole directory. > > But then again, I would argue that the sync() is actually necessary > always, for correct semantics: You also want to sync everything that the > postinst script has done before recording that a package is fully > installed. Yes, you're right. I completely forgot about that. I don't think most postinst scripts sync when done. I suppose the best that can be done is to batch the stuff as best as can be done to reduce the number of sync()s needed. -- Kind regards, Loong Jin
Attachment:
signature.asc
Description: OpenPGP digital signature