aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-01-22 12:36:03 +0100
committerJim Meyering <meyering@redhat.com>2011-01-22 12:36:03 +0100
commit237c2325b3d11e1b1a576978b884df3423a075b1 (patch)
tree9f58fffdfb70d1d3e5b76a23d8538326378bc8ad
parent* src/copy.c (copy_reg): Remove useless else-after-goto. (diff)
downloadcoreutils-237c2325b3d11e1b1a576978b884df3423a075b1.tar.gz
coreutils-237c2325b3d11e1b1a576978b884df3423a075b1.zip
copy: call extent_copy also when make_holes is false, ...
so that we benefit from using extents also when reading a sparse input file with --sparse=never. * src/copy.c (copy_reg): Remove erroneous test of "make_holes" so that we call extent_copy also when make_holes is false. Otherwise, what's the point of that parameter?
-rw-r--r--src/copy.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/copy.c b/src/copy.c
index 71da00d74..be7fdba7b 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -868,23 +868,20 @@ copy_reg (char const *src_name, char const *dst_name,
#endif
}
- if (make_holes)
+ bool require_normal_copy;
+ /* Perform efficient extent copy for sparse file, fall back to the
+ standard copy only if the initial extent scan fails. If the
+ '--sparse=never' option was specified, we writing all data but
+ use extent copy if available to efficiently read. */
+ if (extent_copy (source_desc, dest_desc, buf_size,
+ src_open_sb.st_size, make_holes,
+ src_name, dst_name, &require_normal_copy))
+ goto preserve_metadata;
+
+ if (! require_normal_copy)
{
- bool require_normal_copy;
- /* Perform efficient extent copy for sparse file, fall back to the
- standard copy only if the initial extent scan fails. If the
- '--sparse=never' option was specified, we writing all data but
- use extent copy if available to efficiently read. */
- if (extent_copy (source_desc, dest_desc, buf_size,
- src_open_sb.st_size, make_holes,
- src_name, dst_name, &require_normal_copy))
- goto preserve_metadata;
-
- if (! require_normal_copy)
- {
- return_val = false;
- goto close_src_and_dst_desc;
- }
+ return_val = false;
+ goto close_src_and_dst_desc;
}
/* If not making a sparse file, try to use a more-efficient