@ -478,12 +478,15 @@ Status PosixMmapFile::InvalidateCache(size_t offset, size_t length) {
}
}
# ifdef ROCKSDB_FALLOCATE_PRESENT
# ifdef ROCKSDB_FALLOCATE_PRESENT
Status PosixMmapFile : : Allocate ( off_t offset , off_t len ) {
Status PosixMmapFile : : Allocate ( uint64_t offset , uint64_t len ) {
assert ( offset < = std : : numeric_limits < off_t > : : max ( ) ) ;
assert ( len < = std : : numeric_limits < off_t > : : max ( ) ) ;
TEST_KILL_RANDOM ( " PosixMmapFile::Allocate:0 " , rocksdb_kill_odds ) ;
TEST_KILL_RANDOM ( " PosixMmapFile::Allocate:0 " , rocksdb_kill_odds ) ;
int alloc_status = 0 ;
int alloc_status = 0 ;
if ( allow_fallocate_ ) {
if ( allow_fallocate_ ) {
alloc_status = fallocate (
alloc_status = fallocate (
fd_ , fallocate_with_keep_size_ ? FALLOC_FL_KEEP_SIZE : 0 , offset , len ) ;
fd_ , fallocate_with_keep_size_ ? FALLOC_FL_KEEP_SIZE : 0 ,
static_cast < off_t > ( offset ) , static_cast < off_t > ( len ) ) ;
}
}
if ( alloc_status = = 0 ) {
if ( alloc_status = = 0 ) {
return Status : : OK ( ) ;
return Status : : OK ( ) ;
@ -606,13 +609,16 @@ Status PosixWritableFile::InvalidateCache(size_t offset, size_t length) {
}
}
# ifdef ROCKSDB_FALLOCATE_PRESENT
# ifdef ROCKSDB_FALLOCATE_PRESENT
Status PosixWritableFile : : Allocate ( off_t offset , off_t len ) {
Status PosixWritableFile : : Allocate ( uint64_t offset , uint64_t len ) {
assert ( offset < = std : : numeric_limits < off_t > : : max ( ) ) ;
assert ( len < = std : : numeric_limits < off_t > : : max ( ) ) ;
TEST_KILL_RANDOM ( " PosixWritableFile::Allocate:0 " , rocksdb_kill_odds ) ;
TEST_KILL_RANDOM ( " PosixWritableFile::Allocate:0 " , rocksdb_kill_odds ) ;
IOSTATS_TIMER_GUARD ( allocate_nanos ) ;
IOSTATS_TIMER_GUARD ( allocate_nanos ) ;
int alloc_status = 0 ;
int alloc_status = 0 ;
if ( allow_fallocate_ ) {
if ( allow_fallocate_ ) {
alloc_status = fallocate (
alloc_status = fallocate (
fd_ , fallocate_with_keep_size_ ? FALLOC_FL_KEEP_SIZE : 0 , offset , len ) ;
fd_ , fallocate_with_keep_size_ ? FALLOC_FL_KEEP_SIZE : 0 ,
static_cast < off_t > ( offset ) , static_cast < off_t > ( len ) ) ;
}
}
if ( alloc_status = = 0 ) {
if ( alloc_status = = 0 ) {
return Status : : OK ( ) ;
return Status : : OK ( ) ;
@ -621,8 +627,11 @@ Status PosixWritableFile::Allocate(off_t offset, off_t len) {
}
}
}
}
Status PosixWritableFile : : RangeSync ( off_t offset , off_t nbytes ) {
Status PosixWritableFile : : RangeSync ( uint64_t offset , uint64_t nbytes ) {
if ( sync_file_range ( fd_ , offset , nbytes , SYNC_FILE_RANGE_WRITE ) = = 0 ) {
assert ( offset < = std : : numeric_limits < off_t > : : max ( ) ) ;
assert ( nbytes < = std : : numeric_limits < off_t > : : max ( ) ) ;
if ( sync_file_range ( fd_ , static_cast < off_t > ( offset ) ,
static_cast < off_t > ( nbytes ) , SYNC_FILE_RANGE_WRITE ) = = 0 ) {
return Status : : OK ( ) ;
return Status : : OK ( ) ;
} else {
} else {
return IOError ( filename_ , errno ) ;
return IOError ( filename_ , errno ) ;