Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kvdb
rocksdb
提交
2889df84
R
rocksdb
项目概览
kvdb
/
rocksdb
12 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rocksdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2889df84
编写于
10月 28, 2015
作者:
S
sdong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Avoid to reply on ROCKSDB_FALLOCATE_PRESENT in include/posix/io_posix.h"
This reverts commit
c37223c0
.
上级
28c8758a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
18 deletion
+13
-18
include/posix/io_posix.h
include/posix/io_posix.h
+8
-0
util/env_test.cc
util/env_test.cc
+1
-1
util/io_posix.cc
util/io_posix.cc
+4
-17
未找到文件。
include/posix/io_posix.h
浏览文件 @
2889df84
...
...
@@ -68,8 +68,10 @@ class PosixWritableFile : public WritableFile {
const
std
::
string
filename_
;
int
fd_
;
uint64_t
filesize_
;
#ifdef ROCKSDB_FALLOCATE_PRESENT
bool
allow_fallocate_
;
bool
fallocate_with_keep_size_
;
#endif
public:
PosixWritableFile
(
const
std
::
string
&
fname
,
int
fd
,
...
...
@@ -87,9 +89,11 @@ class PosixWritableFile : public WritableFile {
virtual
bool
IsSyncThreadSafe
()
const
override
;
virtual
uint64_t
GetFileSize
()
override
;
virtual
Status
InvalidateCache
(
size_t
offset
,
size_t
length
)
override
;
#ifdef ROCKSDB_FALLOCATE_PRESENT
virtual
Status
Allocate
(
off_t
offset
,
off_t
len
)
override
;
virtual
Status
RangeSync
(
off_t
offset
,
off_t
nbytes
)
override
;
virtual
size_t
GetUniqueId
(
char
*
id
,
size_t
max_size
)
const
override
;
#endif
};
class
PosixMmapReadableFile
:
public
RandomAccessFile
{
...
...
@@ -119,8 +123,10 @@ class PosixMmapFile : public WritableFile {
char
*
dst_
;
// Where to write next (in range [base_,limit_])
char
*
last_sync_
;
// Where have we synced up to
uint64_t
file_offset_
;
// Offset of base_ in file
#ifdef ROCKSDB_FALLOCATE_PRESENT
bool
allow_fallocate_
;
// If false, fallocate calls are bypassed
bool
fallocate_with_keep_size_
;
#endif
// Roundup x to a multiple of y
static
size_t
Roundup
(
size_t
x
,
size_t
y
)
{
return
((
x
+
y
-
1
)
/
y
)
*
y
;
}
...
...
@@ -150,7 +156,9 @@ class PosixMmapFile : public WritableFile {
virtual
Status
Fsync
()
override
;
virtual
uint64_t
GetFileSize
()
override
;
virtual
Status
InvalidateCache
(
size_t
offset
,
size_t
length
)
override
;
#ifdef ROCKSDB_FALLOCATE_PRESENT
virtual
Status
Allocate
(
off_t
offset
,
off_t
len
)
override
;
#endif
};
class
PosixDirectory
:
public
Directory
{
...
...
util/env_test.cc
浏览文件 @
2889df84
...
...
@@ -18,7 +18,6 @@
#include <list>
#ifdef OS_LINUX
#include <fcntl.h>
#include <linux/fs.h>
#include <stdlib.h>
#include <sys/stat.h>
...
...
@@ -27,6 +26,7 @@
#ifdef ROCKSDB_FALLOCATE_PRESENT
#include <errno.h>
#include <fcntl.h>
#endif
#include "rocksdb/env.h"
...
...
util/io_posix.cc
浏览文件 @
2889df84
...
...
@@ -477,8 +477,8 @@ Status PosixMmapFile::InvalidateCache(size_t offset, size_t length) {
#endif
}
Status
PosixMmapFile
::
Allocate
(
off_t
offset
,
off_t
len
)
{
#ifdef ROCKSDB_FALLOCATE_PRESENT
Status
PosixMmapFile
::
Allocate
(
off_t
offset
,
off_t
len
)
{
TEST_KILL_RANDOM
(
"PosixMmapFile::Allocate:0"
,
rocksdb_kill_odds
);
int
alloc_status
=
0
;
if
(
allow_fallocate_
)
{
...
...
@@ -490,10 +490,8 @@ Status PosixMmapFile::Allocate(off_t offset, off_t len) {
}
else
{
return
IOError
(
filename_
,
errno
);
}
#else
return
Status
::
NotSupported
(
"PosixMmapFile::Allocate() not supported."
);
#endif
}
#endif
/*
* PosixWritableFile
...
...
@@ -607,8 +605,8 @@ Status PosixWritableFile::InvalidateCache(size_t offset, size_t length) {
#endif
}
Status
PosixWritableFile
::
Allocate
(
off_t
offset
,
off_t
len
)
{
#ifdef ROCKSDB_FALLOCATE_PRESENT
Status
PosixWritableFile
::
Allocate
(
off_t
offset
,
off_t
len
)
{
TEST_KILL_RANDOM
(
"PosixWritableFile::Allocate:0"
,
rocksdb_kill_odds
);
IOSTATS_TIMER_GUARD
(
allocate_nanos
);
int
alloc_status
=
0
;
...
...
@@ -621,31 +619,20 @@ Status PosixWritableFile::Allocate(off_t offset, off_t len) {
}
else
{
return
IOError
(
filename_
,
errno
);
}
#else
return
Status
::
NotSupported
(
"PosixWritableFile::Allocate() not supported."
);
#endif
}
Status
PosixWritableFile
::
RangeSync
(
off_t
offset
,
off_t
nbytes
)
{
#ifdef ROCKSDB_FALLOCATE_PRESENT
if
(
sync_file_range
(
fd_
,
offset
,
nbytes
,
SYNC_FILE_RANGE_WRITE
)
==
0
)
{
return
Status
::
OK
();
}
else
{
return
IOError
(
filename_
,
errno
);
}
#else
return
Status
::
NotSupported
(
"PosixWritableFile::RangeSync() not supported."
);
#endif
}
size_t
PosixWritableFile
::
GetUniqueId
(
char
*
id
,
size_t
max_size
)
const
{
#ifdef ROCKSDB_FALLOCATE_PRESENT
return
GetUniqueIdFromFile
(
fd_
,
id
,
max_size
);
#else
// What we should do with it?
return
0
;
#endif
}
#endif
PosixDirectory
::~
PosixDirectory
()
{
close
(
fd_
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录