… | |
… | |
975 | my @stat = stat $src_fh; # hmm, might block over nfs? |
975 | my @stat = stat $src_fh; # hmm, might block over nfs? |
976 | |
976 | |
977 | aioreq_pri $pri; |
977 | aioreq_pri $pri; |
978 | add $grp aio_open $dst, O_CREAT | O_WRONLY | O_TRUNC, 0200, sub { |
978 | add $grp aio_open $dst, O_CREAT | O_WRONLY | O_TRUNC, 0200, sub { |
979 | if (my $dst_fh = $_[0]) { |
979 | if (my $dst_fh = $_[0]) { |
|
|
980 | |
|
|
981 | # best-effort preallocate |
|
|
982 | aioreq_pri $pri; |
|
|
983 | add $grp aio_allocate $dst_fh, IO::AIO::FALLOC_FL_KEEP_SIZE, 0, $stat[7], sub { }; |
|
|
984 | |
980 | aioreq_pri $pri; |
985 | aioreq_pri $pri; |
981 | add $grp aio_sendfile $dst_fh, $src_fh, 0, $stat[7], sub { |
986 | add $grp aio_sendfile $dst_fh, $src_fh, 0, $stat[7], sub { |
982 | if ($_[0] == $stat[7]) { |
987 | if ($_[0] == $stat[7]) { |
983 | $grp->result (0); |
988 | $grp->result (0); |
984 | close $src_fh; |
989 | close $src_fh; |