server: Implement file access hints using posix_fadvise.
Signed-off-by: Luke Deller <luke@deller.id.au> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7d54682ffc
commit
a87bafc5b9
|
@ -18010,6 +18010,7 @@ for ac_func in \
|
|||
pipe2 \
|
||||
poll \
|
||||
port_create \
|
||||
posix_fadvise \
|
||||
prctl \
|
||||
pread \
|
||||
proc_pidinfo \
|
||||
|
|
|
@ -2186,6 +2186,7 @@ AC_CHECK_FUNCS(\
|
|||
pipe2 \
|
||||
poll \
|
||||
port_create \
|
||||
posix_fadvise \
|
||||
prctl \
|
||||
pread \
|
||||
proc_pidinfo \
|
||||
|
|
|
@ -513,6 +513,9 @@
|
|||
/* Define to 1 if you have the <port.h> header file. */
|
||||
#undef HAVE_PORT_H
|
||||
|
||||
/* Define to 1 if you have the `posix_fadvise' function. */
|
||||
#undef HAVE_POSIX_FADVISE
|
||||
|
||||
/* Define to 1 if you have the `prctl' function. */
|
||||
#undef HAVE_PRCTL
|
||||
|
||||
|
|
13
server/fd.c
13
server/fd.c
|
@ -2026,6 +2026,19 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
|
|||
free( closed_fd );
|
||||
fd->cacheable = 1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_POSIX_FADVISE
|
||||
switch (options & (FILE_SEQUENTIAL_ONLY | FILE_RANDOM_ACCESS))
|
||||
{
|
||||
case FILE_SEQUENTIAL_ONLY:
|
||||
posix_fadvise( fd->unix_fd, 0, 0, POSIX_FADV_SEQUENTIAL );
|
||||
break;
|
||||
case FILE_RANDOM_ACCESS:
|
||||
posix_fadvise( fd->unix_fd, 0, 0, POSIX_FADV_RANDOM );
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (root_fd != -1) fchdir( server_dir_fd ); /* go back to the server dir */
|
||||
return fd;
|
||||
|
||||
|
|
Loading…
Reference in New Issue