mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-02-21 17:56:42 +08:00

If available FICLONE and copy_file_range will be tried in addition to sendfile when copying data between two files. The fallback is a tradition read/write loop. On systems that support these it should improve performance.
41 lines
1.3 KiB
C++
41 lines
1.3 KiB
C++
/*
|
|
ISC License
|
|
|
|
Copyright (c) 2018, Antonio SJ Musumeci <trapexit@spawn.link>
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <cstddef>
|
|
|
|
namespace fs
|
|
{
|
|
ssize_t
|
|
copy_file_range(const int fd_in_,
|
|
loff_t *off_in_,
|
|
const int fd_out_,
|
|
loff_t *off_out_,
|
|
const size_t len_,
|
|
const unsigned int flags_);
|
|
|
|
ssize_t
|
|
copy_file_range(const int fd_in_,
|
|
const int fd_out_,
|
|
const size_t len_,
|
|
const unsigned int flags_ = 0);
|
|
}
|