- permissions
- name
- owner
- timestamp
- disk (SSD nowadays)
- driver
- file system interface (vfs on Unix)
- kernel
- OS
- standard library
- application
- FAT32
- NTFS
- ext4
- HFS+
- APFS
- disk (SSD nowadays)
- driver
- file system interface (vfs on Unix)
- network
- socket
- disk
A distributed file system should be:
- Fast
- Reliable
- Concurrency-safe (handle race conditions)
- maintaining State
- file descriptors
- the file pointer: the location where a process left off in a open file
- buffer
- Idempotent: we get the same result no matter how many times we try something
- UFIDs (Unique File ID) are like inodes
- anytime a client requests a file from a server, it returns the file’s UFID
The NFS Layer maps file descriptions to UFIDs
The NFS Layer maps file descriptions to UFIDs
Local Linux System
fd = open("filepath")
read(fd, buf, 1024)
read(fd, buf, 1024)
close(fd) // nothing to do on server
NFS System
ufid = LOOKUP("filepath")
READ(ufid, buf, 1024, 0) // last argument is offset
READ(ufid, buf, 1024, 1)
Local Linux System
fd = open("filepath")
write(fd, buf, 1024)
write(fd, buf, 1024)
close(fd) // nothing to do on server
store all the write calls and when the file is closed sending the server one aggragated nfs WRITE call
NFS System
ufid = LOOKUP("filepath")
WRITE(ufid, buf, 2048)
- What if the server is dead while we’re trying to write to the server?
- When
close(fd)
is called, NFS keeps trying to write/close over and over again
- When