summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-01-27 17:30:08 +0100
committerJim Meyering <meyering@redhat.com>2011-01-30 20:44:12 +0100
commit3953f7523e560fa8afc21a82d845dbe2e2fbe1b0 (patch)
treeca3fa3b5bbedbfab2d6d932de89f45745d2f8fb1 /src
parentcfbeeafd4ad2a16a10fa9702c6576ca8b2a1c859 (diff)
downloadcoreutils-3953f7523e560fa8afc21a82d845dbe2e2fbe1b0.tar.xz
fiemap copy: avoid a performance hit due to very small buffer
* src/copy.c (extent_copy): Don't let what should have been a temporary reduction of buf_size (to handle a short ext_len) become permanent and thus impact the performance of all further iterations.
Diffstat (limited to 'src')
-rw-r--r--src/copy.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/copy.c b/src/copy.c
index ab18a76b4..9a3a8f7a6 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -270,9 +270,8 @@ extent_copy (int src_fd, int dest_fd, char *buf, size_t buf_size,
{
/* Don't read from a following hole if EXT_LEN
is smaller than the buffer size. */
- buf_size = MIN (ext_len, buf_size);
-
- ssize_t n_read = read (src_fd, buf, buf_size);
+ size_t b_size = MIN (ext_len, buf_size);
+ ssize_t n_read = read (src_fd, buf, b_size);
if (n_read < 0)
{
#ifdef EINTR