Re: [PATCH v5 0/6] fs/dcache: Track & limit # of negative dentries

From: Linus Torvalds
Date: Mon Jul 02 2018 - 18:54:21 EST


On Mon, Jul 2, 2018 at 3:34 PM James Bottomley
<James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> wrote:
>
> There are still a lot of applications that keep looking up non-existent
> files, so I think it's still beneficial to keep them. Apparently
> apache still looks for a .htaccess file in every directory it
> traverses, for instance.

.. or git looking for ".gitignore" files in every directory, or any
number of similar things.

Lookie here, for example:

[torvalds@i7 linux]$ strace -e trace=%file -c git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
73.23 0.009066 2 4056 6 open
23.33 0.002888 2 1294 1189 openat
1.60 0.000198 13 15 8 access
0.80 0.000099 2 36 31 lstat
0.53 0.000066 1 40 6 stat
0.27 0.000033 8 4 getcwd
0.11 0.000014 14 1 execve
0.11 0.000014 14 1 chdir
0.02 0.000003 3 1 1 readlink
0.00 0.000000 0 1 unlink
------ ----------- ----------- --------- --------- ----------------
100.00 0.012381 5449 1241 total

so almost a quarter (1241 of 5449) of the file accesses resulted in
errors (and I think they are all ENOENT).

Negative lookups are *not* some unusual thing.

Linus