pwmarcz / fs-demo

Filesystem demo for Graphene
0 stars 0 forks source link

Filesystem demo

This is a mock-up exploring a concept of a distributed filesystem for Graphene.

Source overview

Running the demos

See demo.py for the source of the demos.

Assumptions

Filesystem architecture

We use two main objects:

In addition, there are:

Sync handles

We use an abstraction of a sync handle, which is a kind of a distributed lock. A sync handle has:

The handle is not released immediately after use (that is, after lock is dropped), but asynchronously, when another thread needs it. This way, if a handle is not contested by other processes, it can be held indefinitely.

See sync_client.py for details of usage, and sync_server.py for server implementation and protocol details.

states.png

Example: dentry cache

Here is a detailed example of two processes accessing a file. As long as the file is only viewed, a shared handle can be held. However, when modifying a file (e.g. truncate), we need to tell the other clients to drop the handle, because their cached data will need to be re-acquired.

dentry.png

Example: writing to a file

In this example, two processes write to the same file handle (duplicated using fork). We need to accurately track the file position, so a sync handle has to be acquired in exclusive mode before writing.

Note that while we require two IPC round-trips per write, that happens only when multiple processes try writing to a file handle. If a file handle is mostly used by one process, there will be no overhead.

dentry.png

Other questions

Here are some open questions and things missing from this demo: