According to Linux man page:
posix_fallocate() returns zero on success, or an error number on failure.
Note that errno is not set.
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
if (g_conf->bluestore_block_preallocate_file) {
#ifdef HAVE_POSIX_FALLOCATE
r = ::posix_fallocate(fd, 0, size);
- if (r < 0) {
- r = -errno;
+ if (r) {
derr << __func__ << " failed to prefallocate " << name << " file to "
<< size << ": " << cpp_strerror(r) << dendl;
VOID_TEMP_FAILURE_RETRY(::close(fd));
- return r;
+ return -r;
}
#else
char data[1024*128];