[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Pre-approval request for dpkg sync() changes for squeeze



On 10/22/2010 5:35 AM, Guillem Jover wrote:
>   1) Switch back from sync() to fsync() before rename() (while keeping

Don't you WANT to use sync?  If you fsync every file that is going to be
rather slow since it forces a disk write for every file, rather than
allowing writes between each file to be combined and batched.  Ideally
you want to unpack all files from all packages being installed/upgraded,
then issue one big sync(), and finally all of the rename()s, with one
final sync(), don't you?

To throw out some numbers, it seems like it can easily take 60ms or more
for an fsync(), between writing the file data, writing the journal,
writing inode, writing the directory entry, then finally the journal
again.  If you are replacing 1000 files then you are spending 60 seconds
just on the fsync calls.  If you only use a single sync, then the whole
thing could easily write all of the file data, adjacent inodes, journal
commits, etc in 1-2 seconds with only 2-3 seeks.


Reply to: