Browse Source

fall back to other file copy methods in clonefile

pull/599/head
Antonio SJ Musumeci 6 years ago
parent
commit
2a075ead92
  1. 17
      src/fs_clonefile.cpp

17
src/fs_clonefile.cpp

@ -37,22 +37,23 @@ copydata(const int src_fd_,
{ {
int rv; 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_); rv = fs::ficlone(src_fd_,dst_fd_);
if((rv != -1) || ((rv == -1) && (errno != EOPNOTSUPP)))
if(rv != -1)
return rv; 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_); rv = fs::copy_file_range(src_fd_,dst_fd_,count_);
if((rv != -1) || ((rv == -1) && (errno != EOPNOTSUPP)))
if(rv != -1)
return rv; return rv;
rv = fs::sendfile(src_fd_,dst_fd_,count_); rv = fs::sendfile(src_fd_,dst_fd_,count_);
if((rv != -1) || ((rv == -1) && (errno != EINVAL) && (errno != ENOSYS)))
if(rv != -1)
return rv; return rv;
return fs::copyfile(src_fd_,dst_fd_); return fs::copyfile(src_fd_,dst_fd_);

Loading…
Cancel
Save