From 8894c11397f3b2a22cf163f1da9708bba30e4933 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 25 Oct 2018 21:16:47 +0200 Subject: fs-util: increase start buffer size in readlinkat_malloc() I noticed while profiling journald that we invoke readlinkat() a ton on open /proc/self/fd/, and that the returned paths are more often than not longer than the 99 chars used before, when we look at archived journal files. This means for these cases we generally need to execute two rather than one syscalls. Let's increase the buffer size a tiny bit, so that we reduce the number of syscalls executed. This is really a low-hanging fruit of optimization. (cherry picked from commit 8e060ec225b74bbf22e5bdbacd604efcc73294c0) --- src/basic/fs-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index 562fe8277..0518c2012 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -134,7 +134,7 @@ int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char #endif // 0 int readlinkat_malloc(int fd, const char *p, char **ret) { - size_t l = 100; + size_t l = FILENAME_MAX+1; int r; assert(p); -- cgit v1.2.3