From: Avery Pennarun Date: Fri, 12 Mar 2010 21:49:32 +0000 (-0500) Subject: save-cmd: open files with O_NOATIME on OSes that support it. X-Git-Tag: bup-0.12a~4 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=bup.git;a=commitdiff_plain;h=49611a965cc436095e257d572d51528477bcf52d save-cmd: open files with O_NOATIME on OSes that support it. Backing up files normally changes their atime, which is bad for two reasons. First, the files haven't really been "accessed" in a useful sense; the fact that we backed them up isn't an indication that, say, they're any more frequently used than they were before. Secondly, when reading a file updates its atime, the kernel has to enqueue an atime update (disk write) for every file we back up. For programs that read the same files repeatedly, this is no big deal, since the atime just gets flushed out occasionally (after a lot of updates). But since bup accesses *every* file only once, you end up with a huge atime backlog, and this can wastefully bog down your disks during a big backup. Of course, mounting your filesystem with noatime would work too, but not everybody does that. So let's help them out. --- diff --git a/cmd/save-cmd.py b/cmd/save-cmd.py index 1c4b6dd..cdae7f6 100755 --- a/cmd/save-cmd.py +++ b/cmd/save-cmd.py @@ -199,7 +199,7 @@ for (transname,ent) in r.filter(extra, wantrecurse=wantrecurse_during): else: if stat.S_ISREG(ent.mode): try: - f = open(ent.name) + f = hashsplit.open_noatime(ent.name) except IOError, e: add_error(e) lastskip_name = ent.name diff --git a/lib/bup/_hashsplit.c b/lib/bup/_hashsplit.c index cde9201..c8a3cde 100644 --- a/lib/bup/_hashsplit.c +++ b/lib/bup/_hashsplit.c @@ -1,6 +1,7 @@ #include #include #include +#include #define BLOBBITS (13) #define BLOBSIZE (1<