bug-coreutils
[Top][All Lists]
Advanced

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

better buffer size for copy


From: Robert Latham
Subject: better buffer size for copy
Date: Fri, 4 Nov 2005 13:13:05 -0600
User-agent: Mutt/1.5.9i

Hi

The thread here 
http://lists.gnu.org/archive/html/bug-coreutils/2003-11/msg00030.html
suggested that copy, instead of using the destination block size,
should use the LCM of the source block size and the destination block
size.

In the time since the above thread was started, there is now an
implementation of lcm in src/system.h.  Would the patch to
src/copy.c below make sense?

Thanks
==rob

Index: src/copy.c
===================================================================
RCS file: /cvsroot/coreutils/coreutils/src/copy.c,v
retrieving revision 1.190
diff -u -w -p -r1.190 copy.c
--- src/copy.c  25 Sep 2005 03:07:33 -0000      1.190
+++ src/copy.c  4 Nov 2005 19:12:23 -0000
@@ -291,7 +291,7 @@ copy_reg (char const *src_name, char con
       goto close_src_and_dst_desc;
     }
 
-  buf_size = ST_BLKSIZE (sb);
+  buf_size = lcm(ST_BLKSIZE (sb), ST_BLKSIZE(src_open_sb));
 
   /* Even with --sparse=always, try to create holes only
      if the destination is a regular file.  */



-- 
Rob Latham
Mathematics and Computer Science Division    A215 0178 EA2D B059 8CDF
Argonne National Labs, IL USA                B29D F333 664A 4280 315B




reply via email to

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