[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch version-1.4.0 updated: deduplicate: Use 'sendfile' for small file
From: |
guix-commits |
Subject: |
branch version-1.4.0 updated: deduplicate: Use 'sendfile' for small file copies. |
Date: |
Sat, 10 Dec 2022 04:59:31 -0500 |
This is an automated email from the git hooks/post-receive script.
civodul pushed a commit to branch version-1.4.0
in repository guix.
The following commit(s) were added to refs/heads/version-1.4.0 by this push:
new b129026e2e deduplicate: Use 'sendfile' for small file copies.
b129026e2e is described below
commit b129026e2e242e9068158ae6e6fcd8d7c5ea092e
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Dec 10 10:56:48 2022 +0100
deduplicate: Use 'sendfile' for small file copies.
* guix/store/deduplication.scm (dump-file/deduplicate): Use 'sendfile'
instead of 'dump-port'.
* tests/store-deduplication.scm ("copy-file/deduplicate, below
%deduplication-minimum-size"):
New test.
---
guix/store/deduplication.scm | 4 ++--
tests/store-deduplication.scm | 17 ++++++++++++++++-
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/guix/store/deduplication.scm b/guix/store/deduplication.scm
index ab982e3b3d..9953675319 100644
--- a/guix/store/deduplication.scm
+++ b/guix/store/deduplication.scm
@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Caleb Ristvedt <caleb.ristvedt@cune.org>
-;;; Copyright © 2018-2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018-2022 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -262,7 +262,7 @@ down the road."
(deduplicate file (dump-and-compute-hash) #:store store)
(call-with-output-file file
(lambda (output)
- (dump-port input output size)))))
+ (sendfile output input size 0)))))
(define* (copy-file/deduplicate source target
#:key (store (%store-directory)))
diff --git a/tests/store-deduplication.scm b/tests/store-deduplication.scm
index 2950fbc1a3..f1845035d8 100644
--- a/tests/store-deduplication.scm
+++ b/tests/store-deduplication.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2018, 2020-2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018, 2020-2022 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -136,6 +136,21 @@
(cons (apply = (map (compose stat:ino stat) identical))
(map (compose stat:nlink stat) identical))))))
+(test-assert "copy-file/deduplicate, below %deduplication-minimum-size"
+ (call-with-temporary-directory
+ (lambda (store)
+ (let ((source (string-append store "/input")))
+ (call-with-output-file source
+ (lambda (port)
+ (display "Hello!\n" port)))
+ (copy-file/deduplicate source
+ (string-append store "/a")
+ #:store store)
+ (and (not (directory-exists? (string-append store "/.links")))
+ (file=? source (string-append store "/a"))
+ (not (= (stat:ino (stat (string-append store "/a")))
+ (stat:ino (stat source)))))))))
+
(test-assert "copy-file/deduplicate"
(call-with-temporary-directory
(lambda (store)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch version-1.4.0 updated: deduplicate: Use 'sendfile' for small file copies.,
guix-commits <=