Commit 8c589dd5 authored by Julius Plenz's avatar Julius Plenz

Move advice NOREUSE to store_pageinfo()

parent b947ea15
......@@ -77,7 +77,6 @@ int open(const char *pathname, int flags, mode_t mode)
int fd;
if((fd = _original_open(pathname, flags, mode)) != -1) {
store_pageinfo(fd);
fadv_noreuse(fd, 0, 0);
}
return fd;
}
......@@ -87,7 +86,6 @@ int creat(const char *pathname, int flags, mode_t mode)
int fd;
if((fd = _original_creat(pathname, flags, mode)) != -1) {
store_pageinfo(fd);
fadv_noreuse(fd, 0, 0);
}
return fd;
}
......@@ -97,7 +95,6 @@ int openat(int dirfd, const char *pathname, int flags, mode_t mode)
int fd;
if((fd = _original_openat(dirfd, pathname, flags, mode)) != -1) {
store_pageinfo(fd);
fadv_noreuse(fd, 0, 0);
}
return fd;
}
......@@ -121,6 +118,10 @@ static void store_pageinfo(int fd)
if(!S_ISREG(st.st_mode))
return;
/* Hint we'll be using this file only once;
* the Linux kernel will currently ignore this */
fadv_noreuse(fd, 0, 0);
/* check if there's space to store the info */
pthread_mutex_lock(&lock);
for(i = 0; i < _MAX_FDS && fds[i].fd != -1; i++)
......
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