mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 02:49:02 -04:00
Adds a missing fadvise() for sequential access in parity creation.
This commit is contained in:
parent
14039c1a63
commit
94ba44c0e7
1 changed files with 10 additions and 0 deletions
10
parity.c
10
parity.c
|
|
@ -97,6 +97,7 @@ int parity_create(struct snapraid_parity* parity, const char* path, data_off_t*
|
|||
pathcpy(parity->path, sizeof(parity->path), path);
|
||||
|
||||
/* opening in sequential mode in Windows */
|
||||
/* O_SEQUENTIAL: opening in sequential mode in Windows */
|
||||
parity->f = open(parity->path, O_RDWR | O_CREAT | O_BINARY | O_SEQUENTIAL, 0600);
|
||||
if (parity->f == -1) {
|
||||
fprintf(stderr, "Error opening parity file '%s'. %s.\n", parity->path, strerror(errno));
|
||||
|
|
@ -110,6 +111,15 @@ int parity_create(struct snapraid_parity* parity, const char* path, data_off_t*
|
|||
goto bail;
|
||||
}
|
||||
|
||||
#if HAVE_POSIX_FADVISE
|
||||
/* advise sequential access */
|
||||
ret = posix_fadvise(parity->f, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Error advising parity file '%s'. %s.\n", parity->path, strerror(ret));
|
||||
goto bail;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* get the size of the existing data */
|
||||
parity->valid_size = parity->st.st_size;
|
||||
*out_size = parity->st.st_size;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue