|
|
@ -14,15 +14,10 @@ |
|
|
|
#include <sys/ioctl.h> |
|
|
|
#include <sys/ioctl.h> |
|
|
|
#include <sys/mman.h> |
|
|
|
#include <sys/mman.h> |
|
|
|
#include <sys/stat.h> |
|
|
|
#include <sys/stat.h> |
|
|
|
#ifdef __APPLE__ |
|
|
|
|
|
|
|
#include <sys/param.h> |
|
|
|
|
|
|
|
#include <sys/mount.h> |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
#include <sys/statfs.h> |
|
|
|
#include <sys/statfs.h> |
|
|
|
#include <sys/vfs.h> |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
#include <sys/time.h> |
|
|
|
#include <sys/time.h> |
|
|
|
#include <sys/types.h> |
|
|
|
#include <sys/types.h> |
|
|
|
|
|
|
|
#include <sys/vfs.h> |
|
|
|
#include <time.h> |
|
|
|
#include <time.h> |
|
|
|
#include <unistd.h> |
|
|
|
#include <unistd.h> |
|
|
|
#if defined(OS_LINUX) |
|
|
|
#if defined(OS_LINUX) |
|
|
@ -131,9 +126,7 @@ class PosixSequentialFile: public SequentialFile { |
|
|
|
if (!use_os_buffer_) { |
|
|
|
if (!use_os_buffer_) { |
|
|
|
// we need to fadvise away the entire range of pages because
|
|
|
|
// we need to fadvise away the entire range of pages because
|
|
|
|
// we do not want readahead pages to be cached.
|
|
|
|
// we do not want readahead pages to be cached.
|
|
|
|
#ifndef __APPLE__ |
|
|
|
|
|
|
|
posix_fadvise(fd_, 0, 0, POSIX_FADV_DONTNEED); // free OS pages
|
|
|
|
posix_fadvise(fd_, 0, 0, POSIX_FADV_DONTNEED); // free OS pages
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return s; |
|
|
|
return s; |
|
|
|
} |
|
|
|
} |
|
|
@ -173,9 +166,7 @@ class PosixRandomAccessFile: public RandomAccessFile { |
|
|
|
if (!use_os_buffer_) { |
|
|
|
if (!use_os_buffer_) { |
|
|
|
// we need to fadvise away the entire range of pages because
|
|
|
|
// we need to fadvise away the entire range of pages because
|
|
|
|
// we do not want readahead pages to be cached.
|
|
|
|
// we do not want readahead pages to be cached.
|
|
|
|
#ifndef __APPLE__ |
|
|
|
|
|
|
|
posix_fadvise(fd_, 0, 0, POSIX_FADV_DONTNEED); // free OS pages
|
|
|
|
posix_fadvise(fd_, 0, 0, POSIX_FADV_DONTNEED); // free OS pages
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return s; |
|
|
|
return s; |
|
|
|
} |
|
|
|
} |
|
|
@ -210,7 +201,6 @@ class PosixRandomAccessFile: public RandomAccessFile { |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
virtual void Hint(AccessPattern pattern) { |
|
|
|
virtual void Hint(AccessPattern pattern) { |
|
|
|
#ifndef __APPLE__ |
|
|
|
|
|
|
|
switch(pattern) { |
|
|
|
switch(pattern) { |
|
|
|
case NORMAL: |
|
|
|
case NORMAL: |
|
|
|
posix_fadvise(fd_, 0, 0, POSIX_FADV_NORMAL); |
|
|
|
posix_fadvise(fd_, 0, 0, POSIX_FADV_NORMAL); |
|
|
@ -231,7 +221,6 @@ class PosixRandomAccessFile: public RandomAccessFile { |
|
|
|
assert(false); |
|
|
|
assert(false); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|