[vdr] Patch to avoid file system buffer trashing

Marko Mäkelä marko.makela at hut.fi
Tue Aug 23 20:19:18 CEST 2005


On Mon, Aug 22, 2005 at 11:17:21AM +0200, Ralf Müller wrote:
> The day before I tried to find out if somebody ever had implemented 
> something to prevent vdr to trash the file system buffers. I did this 
> because I hate to wait 20 seconds for vdr to re-read my recordings 
> list.

Thanks, this is very much appreciated.  I applied this patch on my
vdr-1.3.30 today, and I hope it will remove the regular spin-ups of
other video disks while playing back recordings from one disk (caused
by some housekeeping task, perhaps related to timers, EPG or purging
deleted recordings).

> So I read about the usage of O_DIRECT and the trouble with it. 

Is there a summary of the problems somewhere?  I've heard of Linux
file system corruption in heavy database use (MySQL/InnoDB), but I'm
not sure if there have been cases that have been tracked down to
the use of O_DIRECT.  I guess O_DIRECT won't work on NFS, but it
would be a very bad idea to run a database on NFS anyway.

> While googling about O_DIRECT I found the function posix_fadvise - 
> which I had never heard about before - can help to do something similar 
> without to have such an impact on the current programming scheme.
> 
> Using this function I wrote a little patch for vdr 1.3.30 - if you are 
> interested have a look here:
> 
> http://vdr.unetz.com/download/patches/vdr-avoidTrashing-0.2.0-plain-1.3.30.diff.gz

Hmm, is there a reason why your WriteStream function doesn't simply do
posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED)?  That would simplify the
logic, and if I understood correctly, it should work equally well,
except with some early 2.5 kernels.  I understand that you will need to
keep track on the offsets in ReadStream because of read-ahead.

	Marko



More information about the vdr mailing list