]> Sergey Matveev's repositories - nnn.git/commitdiff
Seek advantage of kernel readahead()
authorArun Prakash Jana <engineerarun@gmail.com>
Mon, 18 Nov 2019 14:24:14 +0000 (19:54 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Mon, 18 Nov 2019 14:24:14 +0000 (19:54 +0530)
References:
1. http://man7.org/linux/man-pages/man2/posix_fadvise.2.html
2. https://www.oreilly.com/library/view/linux-system-programming/9781449341527/ch04.html

src/nnn.c

index a26799476a1c427a860cd28e1b6347805ada0850..4a7f7e36cfd93b800476b371cc537a11b0446d02 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -3512,6 +3512,8 @@ static int dentfill(char *path, struct entry **dents)
                        open_max = max_openfds();
        }
 
+       posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL);
+
        dp = readdir(dirp);
        if (!dp)
                goto exit;