From d97579c39936dad5028a38ce05e4700bf91f82b2 Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Sun, 8 Nov 2015 17:30:52 -0800 Subject: Add MmapFlags option for MAP_POPULATE (unix) This adds MmapFlags to DB.Options in case we need syscall.MAP_POPULATE flag in Linux 2.6.23+ to do the sequential read-ahead, as discussed in [1]. --- [1]: https://github.com/coreos/etcd/issues/3786 --- bolt_unix_solaris.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bolt_unix_solaris.go') diff --git a/bolt_unix_solaris.go b/bolt_unix_solaris.go index f480ee7..214009b 100644 --- a/bolt_unix_solaris.go +++ b/bolt_unix_solaris.go @@ -1,4 +1,3 @@ - package bolt import ( @@ -7,6 +6,7 @@ import ( "syscall" "time" "unsafe" + "golang.org/x/sys/unix" ) @@ -68,7 +68,7 @@ func mmap(db *DB, sz int) error { } // Map the data file to memory. - b, err := unix.Mmap(int(db.file.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED) + b, err := unix.Mmap(int(db.file.Fd()), 0, sz, syscall.PROT_READ, syscall.MAP_SHARED|db.MmapFlags) if err != nil { return err } -- cgit v1.2.3