diff options
author | Ludovic Courtès <ludo@gnu.org> | 2025-04-08 18:51:11 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2025-04-14 17:31:50 +0200 |
commit | dfac0a5a9526805334bd7f72926b77b5d46f59db (patch) | |
tree | 33dd1bd944108541b60fc863436210212d1110d3 | |
parent | 3271843122d501668f566d4e5c11497b96d28afd (diff) | |
download | guix-dfac0a5a9526805334bd7f72926b77b5d46f59db.tar.gz guix-dfac0a5a9526805334bd7f72926b77b5d46f59db.zip |
guix: Avoid ‘fdatasync’ call for caches and regular files.
Fixes <https://issues.guix.gnu.org/77606>.
Calling ‘fdatasync’ for each and every narinfo file created by ‘guix
substitute’ proved to be too expensive on spinning HDDs and/or under
load (from 0.1s to 1.3s for the ‘fdatasync’ call alone).
* guix/git-authenticate.scm (cache-authenticated-commit): Pass #:sync? #f.
* guix/http-client.scm (http-fetch/cached): Likewise.
* guix/scripts/discover.scm (write-publish-file): Likewise.
* guix/scripts/style.scm (format-whole-file): Likewise.
* guix/substitutes.scm (cache-narinfo!): Likewise.
Reported-by: Christopher Baines <mail@cbaines.net>
Change-Id: I82297eae737bc5aae8a3f7604119e9f3d4b625bf
-rw-r--r-- | guix/git-authenticate.scm | 5 | ||||
-rw-r--r-- | guix/http-client.scm | 5 | ||||
-rw-r--r-- | guix/scripts/discover.scm | 3 | ||||
-rw-r--r-- | guix/scripts/style.scm | 5 | ||||
-rw-r--r-- | guix/substitutes.scm | 3 |
5 files changed, 13 insertions, 8 deletions
diff --git a/guix/git-authenticate.scm b/guix/git-authenticate.scm index 37c69d0880..3cd1175c32 100644 --- a/guix/git-authenticate.scm +++ b/guix/git-authenticate.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2019, 2020, 2021, 2022 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2019-2022, 2025 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -344,7 +344,8 @@ authenticated (only COMMIT-ID is written to cache, though)." (chmod port #o600) (display ";; List of previously-authenticated commits.\n\n" port) - (pretty-print lst port)))))) + (pretty-print lst port))) + #:sync? #f))) ;;; diff --git a/guix/http-client.scm b/guix/http-client.scm index 9138a627ac..4e0cc59e91 100644 --- a/guix/http-client.scm +++ b/guix/http-client.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012-2018, 2020-2022 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2012-2018, 2020-2022, 2025 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2012, 2015 Free Software Foundation, Inc. ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr> @@ -346,7 +346,8 @@ Write information about redirects to LOG-PORT." (when cache-port (close-port cache-port)) (with-atomic-file-output file - (cut write-cache port <>)) + (cut write-cache port <>) + #:sync? #f) (close-port port) (open-input-file file)))) diff --git a/guix/scripts/discover.scm b/guix/scripts/discover.scm index 32bf6085a5..cbe01638f5 100644 --- a/guix/scripts/discover.scm +++ b/guix/scripts/discover.scm @@ -87,7 +87,8 @@ lock on FILE to synchronize with any potential readers." (format port "http://~a:~a~%" (avahi-service-address service) (avahi-service-port service))) - %publish-services))) + %publish-services)) + #:sync? #f) (chmod file #o644)) (define* (read-substitute-urls #:key (file (%publish-file))) diff --git a/guix/scripts/style.scm b/guix/scripts/style.scm index 4801529f7e..c45bdd4458 100644 --- a/guix/scripts/style.scm +++ b/guix/scripts/style.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2021-2024 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2021-2025 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2024 Herman Rimm <herman@rimm.ee> ;;; ;;; This file is part of GNU Guix. @@ -554,7 +554,8 @@ are put in alphabetical order." (apply pretty-print-with-comments/splice port lst #:format-comment canonicalize-comment #:format-vertical-space canonicalize-vertical-space - rest)))))) + rest)) + #:sync? #f)))) ;;; diff --git a/guix/substitutes.scm b/guix/substitutes.scm index 9edce5b2f8..24b7873ce2 100644 --- a/guix/substitutes.scm +++ b/guix/substitutes.scm @@ -127,7 +127,8 @@ indicates that PATH is unavailable at CACHE-URL." (mkdir-p (dirname file)) (with-atomic-file-output file (lambda (out) - (write (cache-entry cache-url narinfo) out)))) + (write (cache-entry cache-url narinfo) out)) + #:sync? #f)) narinfo) |