mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-29 11:26:48 -05:00
Adds --test-skip-sequential to disable the sequential hint for the disk cache.
This commit is contained in:
parent
a85aa08276
commit
aeb167bb16
13 changed files with 114 additions and 65 deletions
12
util.c
12
util.c
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue