summaryrefslogtreecommitdiff
path: root/util/mmap_posix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'util/mmap_posix.cpp')
-rw-r--r--util/mmap_posix.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/util/mmap_posix.cpp b/util/mmap_posix.cpp
index 25deb871f92..5acedf1f752 100644
--- a/util/mmap_posix.cpp
+++ b/util/mmap_posix.cpp
@@ -49,7 +49,7 @@ namespace mongo {
#define O_NOATIME 0
#endif
- void* MemoryMappedFile::map(const char *filename, long &length) {
+ void* MemoryMappedFile::map(const char *filename, long &length, int options) {
// length may be updated by callee.
theFileAllocator().allocateAsap( filename, length );
len = length;
@@ -76,9 +76,16 @@ namespace mongo {
}
return 0;
}
+
+ if ( options & SEQUENTIAL ){
+ if ( madvise( view , length , MADV_SEQUENTIAL ) ){
+ out() << " madvise failed for " << filename << " " << errno << endl;
+ }
+ }
+
return view;
}
-
+
void MemoryMappedFile::flush(bool sync) {
if ( view == 0 || fd == 0 )
return;