[MPlayer-dev-eng] [PATCH] Use posix_fadvise in stream_file if available
Tobias Diedrich
ranma at tdiedrich.de
Sun Nov 8 14:30:56 CET 2009
Reimar Döffinger wrote:
> static int fill_buffer(stream_t *s, char* buffer, int max_len){
> int r = read(s->fd,buffer,max_len);
> +#ifdef POSIX_FADV_WILLNEED
> + off_t pos = lseek(s->fd, 0, SEEK_CUR);
AFAICS the lseek is not necessary, pos should be (s->pos + max_len)...
stream_fill_buffer() in stream.c seems to be the only place where
stream->fill_buffer() gets called and it always adds the returned
length to s->pos.
> + posix_fadvise(s->fd, pos, PREFETCH_LEN, POSIX_FADV_WILLNEED | POSIX_FADV_NOREUSE);
Unfortunately combining advises doesn't work und causes
posix_fadvise to fail.
The attached modified patch uses only POSIX_FADV_WILLNEED and works
fine for me.
--
Tobias PGP: http://8ef7ddba.uguu.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fadvise.patch
Type: text/x-diff
Size: 1163 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20091108/5ad9339e/attachment.patch>
More information about the MPlayer-dev-eng
mailing list