]> err.no Git - systemd/commitdiff
readahead: put limit on files we read ahead
authorLennart Poettering <lennart@poettering.net>
Thu, 23 Sep 2010 15:35:16 +0000 (17:35 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 23 Sep 2010 15:35:16 +0000 (17:35 +0200)
src/readahead-collect.c
src/readahead-common.h

index 5ff3711068ab3acdcfba02b442e5751a47d51c14..3699c3db8130345272216c0d29044a38af52e212 100644 (file)
@@ -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)
index da6a74ea0350fdb336962a95206f551f03654dd2..5d8f1a34fa26b9e3e97988eaaeebd7149d0eaee3 100644 (file)
@@ -25,6 +25,7 @@
 #include <sys/stat.h>
 
 #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);