Commit 07728270 authored by Julius Plenz's avatar Julius Plenz

Only do multi-fadvise if previous call was successful

Reported-by: 's avatarReda Noushi <reda@logzilla.pro> > one remark: what should nocache do if a non-zero value is returned by posix_fadvise()? > 1. is it okay to continue executing it and returning the last value? > 2. or stop execution and return the last non-zero value of fadv()?
parent 097ecc4b
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
int fadv_dontneed(int fd, off_t offset, off_t len, int n) int fadv_dontneed(int fd, off_t offset, off_t len, int n)
{ {
int i, ret; int i, ret;
for(i = 0; i < n; i++) for(i = 0, ret = 0; i < n && ret == 0; i++)
ret = posix_fadvise(fd, offset, len, POSIX_FADV_DONTNEED); ret = posix_fadvise(fd, offset, len, POSIX_FADV_DONTNEED);
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment