git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] Remove now unnecessary 'sync()' calls

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
May 30, 2008, 16:11 UTC
Message-ID
<alpine.LFD.1.10.0805300908200.3141@woody.linux-foundation.org>
In-Reply-To
<alpine.LFD.1.10.0805300905080.3141@woody.linux-foundation.org>
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Fri, 30 May 2008 08:54:46 -0700

Since the pack-files are now always created stably on disk, there is no need to sync() before pruning lose objects or old stale pack-files.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---

This literally just removes the syncs. The only thing they wanted to protect were the pack-files, that are now created stably.

Yes, you can screw this up by doing direct filesystem operations on the pack-files (ie rsync/http walkers etc), but let's face it - those operations are pretty much fundamentally more problematic than anything we can do anyway, so I canno bring myself to care.

Also, maybe I missed some case where we should fsync. I think this is all good, but having other people look at and think about this would be better still.

 builtin-prune-packed.c |    1 -
 builtin-prune.c        |    1 -
 git-repack.sh          |    1 -
 3 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/builtin-prune-packed.c b/builtin-prune-packed.c
index 23faf31..241afbb 100644
--- a/builtin-prune-packed.c
+++ b/builtin-prune-packed.c
@@ -85,7 +85,6 @@ int cmd_prune_packed(int argc, const char **argv, const char *prefix)
 		/* Handle arguments here .. */
 		usage(prune_packed_usage);
 	}
-	sync();
 	prune_packed_objects(opts);
 	return 0;
 }
diff --git a/builtin-prune.c b/builtin-prune.c
index 25f9304..bd3d2f6 100644
--- a/builtin-prune.c
+++ b/builtin-prune.c
@@ -156,7 +156,6 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
 	mark_reachable_objects(&revs, 1);
 	prune_object_dir(get_object_directory());
 
-	sync();
 	prune_packed_objects(show_only);
 	remove_temporary_files();
 	return 0;
diff --git a/git-repack.sh b/git-repack.sh
index 10f735c..072d1b4 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -125,7 +125,6 @@ then
 	# We know $existing are all redundant.
 	if [ -n "$existing" ]
 	then
-		sync
 		( cd "$PACKDIR" &&
 		  for e in $existing
 		  do
-- 
1.5.6.rc0.48.g5eea
Previous: Linus TorvaldsNext: Nicolas Pitre
Message 12 of 15 in “reducing prune sync()s”
  1. Frank Ch. EiglerMay 29, 2008
  2. Linus TorvaldsMay 30, 2008
  3. Linus TorvaldsMay 30, 2008
  4. Frank Ch. EiglerMay 30, 2008
  5. Florian WeimerMay 30, 2008
  6. David DillowMay 30, 2008
  7. Linus TorvaldsMay 30, 2008
  8. Linus TorvaldsMay 30, 2008
  9. Frank Ch. EiglerMay 30, 2008
  10. Linus TorvaldsMay 30, 2008
  11. 1/2 Make pack creation always fsync() the resultLinus Torvalds, May 30, 2008
  12. 2/2 Remove now unnecessary 'sync()' callsLinus Torvalds, May 30, 2008
  13. Nicolas PitreMay 30, 2008
  14. Frank Ch. EiglerMay 31, 2008
  15. Linus TorvaldsJun 2, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.