Some comments about the use of posix_advise().

This commit is contained in:
Andrea Mazzoleni 2011-03-29 18:27:25 +02:00
parent 81f14d1dfb
commit 637789d11b
3 changed files with 20 additions and 3 deletions

View file

@ -256,6 +256,11 @@ int handle_read(struct snapraid_handle* handle, struct snapraid_block* block, un
return -1;
}
/* Here isn't needed to call posix_fadvise(..., POSIX_FADV_DONTNEED) because */
/* we already advised sequential access with POSIX_FADV_SEQUENTIAL. */
/* In Linux 2.6.33 it's enough to ensure that data is not kept in the cache. */
/* Better to do nothing and save a syscall for each block. */
return read_size;
}
@ -284,6 +289,9 @@ int handle_write(struct snapraid_handle* handle, struct snapraid_block* block, u
return -1;
}
/* Here doesn't make sense to call posix_fadvise(..., POSIX_FADV_DONTNEED) because */
/* at this time the data is still in not yet written and it cannot be discharged. */
return 0;
}