Adds --test-skip-sequential to disable the sequential hint for the disk cache.

This commit is contained in:
Andrea Mazzoleni 2013-04-04 22:52:56 +02:00
parent a85aa08276
commit aeb167bb16
13 changed files with 114 additions and 65 deletions

12
util.c
View file

@ -49,6 +49,7 @@ static unsigned strdecset[256] =
STREAM* sopen_read(const char* file)
{
int ret;
STREAM* s = malloc_nofail(sizeof(STREAM));
s->handle_size = 1;
@ -62,6 +63,17 @@ STREAM* sopen_read(const char* file)
return 0;
}
#if HAVE_POSIX_FADVISE
/* advise sequential access */
ret = posix_fadvise(s->handle[0].f, 0, 0, POSIX_FADV_SEQUENTIAL);
if (ret != 0) {
close(s->handle[0].f);
free(s->handle);
free(s);
return 0;
}
#endif
s->buffer = malloc_nofail(STREAM_SIZE);
s->pos = s->buffer;
s->end = s->buffer;