-
Notifications
You must be signed in to change notification settings - Fork 260
RFC: Dentry cleanup #2321
Comments
Isn't I agree with all your other points. (Though I'm not very well-versed in Graphene's FS subsystem.) |
+1 to removing
|
Hmm, I think I don't get this point. Could you show an example of both cases? Also, isn't such a check inherently racy? How will you lock on this "can be created" property?
A bit off-topic, but could we change this "negative"/"positive" naming for dentries to something more intuitive? Each time I stumble upon this I have no idea what's the meaning of them both in a context of a dentry. |
Agreed, I will look closer into it. Usually we need the absolute path anyway, not
The dentries are a cache. They are not guaranteed to contain all files, even for filesystems "purely in Graphene" (such as
Right now we assume that the filesystem doesn't change without us noticing. And of course, that assumption is reasonable for OS with total control over its filesystem, but not for Graphene. I think that later we should introduce some cache invalidation (which would clear On the other hand, maybe removing
Yes. It's needed for mounts because mount semantics are kind of bad. Later, I want to remove it and require that a mountpoint always exists. For now, maybe a better name would be
Imagine If The current semantics of the lookup functions is that they return
Yes, I imagine there should be a lock. Probably the negative dentry itself has to be returned locked? And whoever wants to create the file, has to lock its dentry first. But to be honest, I'm not sure about how to do locking yet. The current code depends on a global lock ( My initial idea (see the draft) was that basically filesystem operations on dentries have to be protected by a more fine-grained lock on the dentry itself. However, that sounds complicated: what if we want to operate on more than one file? We first need to look up both of them somehow, without causing a deadlock...
How about a "empty" (and non-empty)? The flag would be called |
I like this name, but also could be
I was actually fine with "negative", but "empty" also sounds fine.
Do you mean cases like |
Ok, I get it now. So, this point IMO makes sense.
Yup, something like this, I guess. But it still be tricky with multiple processes which may remove a directory in the meantime. Or maybe you mean taking a multi-process (IPC/sync-engine-based) lock for this?
Sounds much better!
If we want to go this way then I'd prefer something like |
What, why? Where do we need the absolute path and why? Doesn't sound right...
My point was that we don't even notice changes from other Graphene processes, so this flag sounds super useless. I guess it could make some sense, but that would require dentry invalidation.
Sounds good.
Actually I've never had problems with "negative" in dentries context as well and I prefer the old name than the "empty". |
See all the usages of But yes, I see the mount-relative path is also needed in some places, mostly related to specific filesystems. So maybe it won't be so easy to remove. |
These we can ignore
This should probably traverse fs on each call
What kind of information? Other than cwd etc (which fall in the above category)
What does that have to do with fs? Or if you mean named unix domain sockets, why we need a full path for them?
But the path comes from caller not from dentry. |
So what's the point here? There are places in Graphene that need an absolute path, they use |
Sorry, I've misunderstood you want to change the |
This is now mostly implemented, and the rest is outdated, so I'm closing this issue. Thanks for all the feedback. |
Master issue: #1803
I started looking at the filesystem and want to do the following cleanup. It is intended to be a clear improvement, but a much smaller effort than a complete rewrite of all filesystems.
This issue is me asking for a sanity check: is there anything that sounds like a bad idea, or will turn out to be impossible on closer look?
Summary
Get rid of the hashes from the API, at least for now. This is an (only partially implemented) optimization that can be added later.
Introduce proper locking discipline for the data stored in dentry:
dcache_lock
for modifying the actual tree structure,dent->lock
for operations on a file. Keep it simple; we might think about optimizations later, but for now let's make sure this is correct.Trim down the list of flags:
DENTRY_ISLINK
,DENTRY_ISDIRECTORY
, andDENTRY_MOUNTPOINT
are reduntant with the already-present dentry fields (type
andmounted
).Do not split off an
inode
structure yet; this might be useful, but is too big a change yet. I am aware this will complicate implementation of several features (hardlinks, renaming, unlinking an open file).Refactor the "lookup" API, and change it so that it distinguishes between "file does not exist but can be created" (return 0 and a negative dentry) and "file does not exist and cannot be created" (return
-ENOENT
).Make sure the reference counting is correct, and we at least delete unused non-positive dentries. Later we might want to also delete positive dentries, but the tmpfs filesystem stores data in them, so they need to persist for now.
Keep the current mount semantics for now (creating synthetic directories whenever necessary), but make sure the mount points actually appear; currently
readdir("/")
doesn't show/lib
,/proc
, etc.Later, we might want to get rid of the synthetic directories, and instead make the root-level filesystem a tmpfs. This will bring the semantics closer to normal Linux.
Fix lookup flags: there is
LOOKUP_FOLLOW
(disabled most of the time), but actually it means following symlinks along the path to target, whereas LinuxO_NOFOLLOW
andlstat
are only concerned with whether the target file (at the end of the path) is a symlink or notAPI draft
The text was updated successfully, but these errors were encountered: