Refactor path resolution
Currently, path resolution is using lstat()
to ensure that each path component exists. This can add unnecessary overhead, especially when the mount point is located under a long path within a parallel file system like Lustre.
The requirements for path checking:
- Detect paths within GekkoFS and pass them (without prefix) to GekkoFS
- No system calls for checking of path component existence.
- When a path is not within GekkoFS, the unmodified path is passed to the kernel, except a GekkoFS path is part of the path which must be removed first.
Therefore, the following features/changes are necessary:
- A prefix is a defined as the absolute path to the GekkoFS mountpoint. E.g., for
/tmp/gkfs_mount/foofile
the prefix is/tmp/gkfs_mount
. - No system call like
lstat()
should be called - Path checking is done by prefix matching. Therefore a non-absolute path first needs to be resolved:
- if the middle of the path uses
..
, the path needs to be resolved for prefix checking (similar to now) - relative paths (based on the current working directory) also need to be resolved for prefix checking
- if the middle of the path uses
- If a path is not within GekkoFS, the path should be passed to the kernel unmodified.
- When part of the GekkoFS namespace is in the middle of a path and then undone via
..
, the path needs to be resolved before passing it to the kernel as the kernel is unaware of GekkoFS - This also applies to relative paths
- When part of the GekkoFS namespace is in the middle of a path and then undone via
- If a path is within GekkoFS, the prefix is cut from the path and passed to GekkoFS.
Part of these improvements are included but unfinished in this branch
Edited by Marc Vef