|
|
Log in / Subscribe / Register

Why list negative children?

Why list negative children?

Posted Jul 4, 2026 20:10 UTC (Sat) by neilbrown (subscriber, #359)
Parent article: Limiting negative dentries

I thought keeping negatives at the end of the child list would be good too, until I looked at the code.
The children list is an hlist so there is only a pointer to head, not to tail. So you can only add to the head.

So next thought: why put negative dentries on the children list at all? I cannot think of any good reason.

Leaving them off wouldn't solve all the problems, but it would solve one important one.


to post comments

Why list negative children?

Posted Jul 4, 2026 21:10 UTC (Sat) by willy (subscriber, #9762) [Link] (2 responses)

When you rm a directory, you can delete all its negative dentry children too

Why list negative children?

Posted Jul 4, 2026 21:52 UTC (Sat) by sdalley (subscriber, #18550) [Link]

Does this happen automatically on directory deletion these days? Or is there a simple step one can take from user space to ensure it?

Why list negative children?

Posted Jul 4, 2026 22:27 UTC (Sat) by neilbrown (subscriber, #359) [Link]

> When you rm a directory, you can delete all its negative dentry children too

Yes, that is a slight advantage of listing the negative children, but is it worth the cost?

I imagine that the sibling linkage would be used to keep negative dentries on a per-superblock list which allows them to be purged at unmount time. This could also serve as an lru list which might be purged more proactively.
Most of the dentries on this list are uninteresting, but we cannot be sure which. Certainly the children of a deleted parent are definitely uninteresting so the proactive purge would get rid of them more forcefully, but do we need more than that.

I can imagine removing a directory tree might create a great many negative dentries which might tip the balance. We could get an approximate count of these based on the remaining refcount on a directory when it is deleted, and use that to expedite the purge.

Or we could possibly keep the negative-children chain in the directory inode, possibly unioned with i_devices and i_linklen.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds