[vlc-devel] commit: mmap: Use fnctl to set the READAHEAD flag when supported. This should speedup the mmap performance (Derk-Jan Hartman )

git version control git at videolan.org
Sat Sep 20 00:30:37 CEST 2008


vlc | branch: 0.9-bugfix | Derk-Jan Hartman <hartman at videolan.org> | Fri Sep 19 23:38:29 2008 +0200| [748b303ed9fbbed7469e6c96387f67ed8674f16c] | committer: Jean-Baptiste Kempf 

mmap: Use fnctl to set the READAHEAD flag when supported. This should speedup the mmap performance
(cherry picked from commit 7ac6c94720ed2d32dde51299824475b27ff1edc1)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=748b303ed9fbbed7469e6c96387f67ed8674f16c
---

 modules/access/mmap.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/modules/access/mmap.c b/modules/access/mmap.c
index 887c0bc..703fdea 100644
--- a/modules/access/mmap.c
+++ b/modules/access/mmap.c
@@ -119,6 +119,13 @@ static int Open (vlc_object_t *p_this)
         goto error;
     }
 
+# if defined(HAVE_FCNTL_H) && defined(F_FDAHEAD) && defined(F_NOCACHE)
+    /* We'd rather use any available memory for reading ahead
+     * than for caching what we've already mmap'ed */
+    fcntl (fd, F_RDAHEAD, 1);
+    fcntl (fd, F_NOCACHE, 1);
+# endif
+
     /* Autodetect mmap() support */
     if (st.st_size > 0)
     {




More information about the vlc-devel mailing list