From: Lennart Poettering Date: Thu, 23 Sep 2010 15:35:16 +0000 (+0200) Subject: readahead: put limit on files we read ahead X-Git-Tag: v11~91 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e3eb5ba18172ed965e6b91fd7fc05de6c86f739;p=systemd readahead: put limit on files we read ahead --- diff --git a/src/readahead-collect.c b/src/readahead-collect.c index 5ff37110..3699c3db 100644 --- a/src/readahead-collect.c +++ b/src/readahead-collect.c @@ -255,6 +255,9 @@ static int collect(const char *root) { ssize_t n; struct fanotify_event_metadata *m; + if (hashmap_size(files) > READAHEAD_FILES_MAX) + break; + if (poll(pollfd, _FD_MAX, -1) < 0) { if (errno == EINTR) diff --git a/src/readahead-common.h b/src/readahead-common.h index da6a74ea..5d8f1a34 100644 --- a/src/readahead-common.h +++ b/src/readahead-common.h @@ -25,6 +25,7 @@ #include #define READAHEAD_FILE_SIZE_MAX (128*1024*1024) +#define READAHEAD_FILES_MAX (16*1024) int file_verify(int fd, const char *fn, struct stat *st);