From: Chris Tallon Date: Tue, 25 Mar 2008 20:08:40 +0000 (+0000) Subject: Update to advise Linux about FS caching X-Git-Tag: r0-3-0~20 X-Git-Url: https://git.vomp.tv/gitweb/?a=commitdiff_plain;h=ddda0dc539979f3c4ddfdbae48042d840bdf05e0;p=vompserver.git Update to advise Linux about FS caching --- diff --git a/recplayer.c b/recplayer.c index 6647589..3c550ef 100644 --- a/recplayer.c +++ b/recplayer.c @@ -20,6 +20,9 @@ #include "recplayer.h" +#define _XOPEN_SOURCE 600 +#include + RecPlayer::RecPlayer(cRecording* rec) { log = Log::getInstance(); @@ -163,7 +166,10 @@ unsigned long RecPlayer::getBlock(unsigned char* buffer, ULLONG position, unsign filePosition = currentPosition - segments[segmentNumber]->start; fseek(file, filePosition, SEEK_SET); if (fread(&buffer[got], getFromThisSegment, 1, file) != 1) return 0; // umm, big problem. - + + // Tell linux not to bother keeping the data in the FS cache + posix_fadvise(file->_fileno, filePosition, getFromThisSegment, POSIX_FADV_DONTNEED); + got += getFromThisSegment; currentPosition += getFromThisSegment; yetToGet -= getFromThisSegment;