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

[PATCH 4/4] dpkg: Use fdatasync instead of fsync



It is not important to get metadata such as modification time of files
right immediately during an upgrade; that can wait for a later sync().

The result is a small but appreciable performance improvement (~1% when
testing on a laptop hard disk on ext4).

Suggested-by: Ted Ts'o <tytso@mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
That's the end of the series.

I don't like the feeling of voodoo in patches 2 and 3.  Is there a
simple way to observe their effect?  If so, is there a way to achieve
that that is easier to explain?

 src/archives.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/archives.c b/src/archives.c
index ed00ce7..7b5b475 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -932,7 +932,7 @@ tar_deferred_extract(struct fileinlist *files, struct pkginfo *pkg)
       fd = open(fnamenewvb.buf, O_WRONLY);
       if (fd < 0)
         ohshite(_("unable to open '%.255s'"), fnamenewvb.buf);
-      if (fsync(fd))
+      if (fdatasync(fd))
         ohshite(_("unable to sync file '%.255s'"), fnamenewvb.buf);
       if (close(fd))
         ohshite(_("error closing/writing `%.255s'"), fnamenewvb.buf);
-- 
1.7.2.3


Reply to: