Skip to content
Snippets Groups Projects
Commit d0f22e2b authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

Implemented madvise() for journal mapped entries.

Used SEQUENTIAL advise.
parent ba5dc40c
No related branches found
No related tags found
No related merge requests found
......@@ -159,7 +159,7 @@ AC_DEFINE([DSFMT_MEXP], [521], [DSFMT parameters.])
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MMAP
AC_CHECK_FUNCS([gethostbyname gettimeofday clock_gettime memalign memmove memset munmap regcomp pselect select socket sqrt strcasecmp strchr strdup strerror strncasecmp strtol strtoul poll epoll_wait kqueue setgroups sendmmsg])
AC_CHECK_FUNCS([gethostbyname gettimeofday clock_gettime memalign memmove memset munmap regcomp pselect select socket sqrt strcasecmp strchr strdup strerror strncasecmp strtol strtoul poll epoll_wait kqueue setgroups sendmmsg madvise])
AC_CONFIG_FILES([Makefile
samples/Makefile
......
......@@ -14,6 +14,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
......@@ -775,6 +776,10 @@ int journal_map(journal_t *journal, uint64_t id, char **dst, size_t size)
return KNOTD_ERROR;
}
/* Advise usage of memory. */
#ifdef HAVE_MADVISE
madvise(*dst, n->len + ps_delta, MADV_SEQUENTIAL);
#endif
/* Correct dst pointer to alignment. */
*dst += ps_delta;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment