coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] cp: use a bigger buffer size when writing zeros


From: Pádraig Brady
Subject: [PATCH] cp: use a bigger buffer size when writing zeros
Date: Mon, 31 Jan 2011 22:10:28 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

Another buglet:

commit 4a64fd8efe00629b0424bb59c8ec8d9d3ef4542f
Author: Pádraig Brady <address@hidden>
Date:   Mon Jan 31 22:04:35 2011 +0000

    cp: use a bigger buffer size when writing zeros

    * src/copy.c (write_zeros): This bug caused 4 or 8 bytes to
    be written at a time which is very inefficient.  One could
    trigger the issue with `cp --sparse=never sparse non-sparse`
    on a file system that supports fiemap.

diff --git a/src/copy.c b/src/copy.c
index 4e73e1b..65c18f4 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -291,7 +291,7 @@ write_zeros (int fd, uint64_t n_bytes)

   while (n_bytes)
     {
-      uint64_t n = MIN (sizeof nz, n_bytes);
+      uint64_t n = MIN (nz, n_bytes);
       if ((full_write (fd, zeros, n)) != n)
         return false;
       n_bytes -= n;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]