Browse Source

Merge pull request #599 from trapexit/clonefile

fall back to other file copy methods in clonefile
pull/601/head
trapexit 6 years ago
committed by GitHub
parent
commit
46be946672
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      src/fs_clonefile.cpp

17
src/fs_clonefile.cpp

@ -37,22 +37,23 @@ copydata(const int src_fd_,
{
int rv;
fs::fadvise_willneed(src_fd_,0,count_);
fs::fadvise_sequential(src_fd_,0,count_);
fs::fallocate(dst_fd_,0,0,count_);
fs::ftruncate(dst_fd_,count_);
rv = fs::ftruncate(dst_fd_,count_);
if(rv == -1)
return -1;
rv = fs::ficlone(src_fd_,dst_fd_);
if((rv != -1) || ((rv == -1) && (errno != EOPNOTSUPP)))
if(rv != -1)
return rv;
fs::fadvise_willneed(src_fd_,0,count_);
fs::fadvise_sequential(src_fd_,0,count_);
rv = fs::copy_file_range(src_fd_,dst_fd_,count_);
if((rv != -1) || ((rv == -1) && (errno != EOPNOTSUPP)))
if(rv != -1)
return rv;
rv = fs::sendfile(src_fd_,dst_fd_,count_);
if((rv != -1) || ((rv == -1) && (errno != EINVAL) && (errno != ENOSYS)))
if(rv != -1)
return rv;
return fs::copyfile(src_fd_,dst_fd_);

Loading…
Cancel
Save