vm: Use "cache=loose" for all 9p mounts.
authorLudovic Courtès <ludo@gnu.org>
Sun, 23 Sep 2018 21:31:52 +0000 (23:31 +0200)
committerLudovic Courtès <ludo@gnu.org>
Sun, 23 Sep 2018 21:34:17 +0000 (23:34 +0200)
This significantly improves read throughput when running things like
"guix hash -r ...".

* gnu/system/vm.scm (%linux-vm-file-systems): Add 'flags' for "store".
Add "cache=loose" to every file system.

gnu/system/vm.scm

index 435501d..a1b595d 100644 (file)
           (device "store")
           (type "9p")
           (needed-for-boot? #t)
-          (options "trans=virtio")
+          (flags '(read-only))
+          (options "trans=virtio,cache=loose")
           (check? #f))
+
+        ;; The 9p documentation says that cache=loose is "intended for
+        ;; exclusive, read-only mounts", without additional details.  In
+        ;; practice it seems to work well for these, and it's much faster than
+        ;; the default cache=none, especially when copying and registering
+        ;; store items.
         (file-system
           (mount-point "/xchg")
           (device "xchg")
           (type "9p")
           (needed-for-boot? #t)
-          (options "trans=virtio")
+          (options "trans=virtio,cache=loose")
           (check? #f))
         (file-system
           (mount-point "/tmp")
           (device "tmp")
           (type "9p")
           (needed-for-boot? #t)
-          (options "trans=virtio")
+          (options "trans=virtio,cache=loose")
           (check? #f))))
 
 (define not-config?