Project 5 Roadmap - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

Project 5 Roadmap

Description:

Data storage Direct Mapping. Data storage Single Indirect. 4KB data block ... Simply copy verbatim from GOSFS_Dir_Entry. SYS_SEEK. Seek(int fd, int offset) ... – PowerPoint PPT presentation

Number of Views:95
Avg rating:3.0/5.0
Slides: 16
Provided by: Csu48
Category:

less

Transcript and Presenter's Notes

Title: Project 5 Roadmap


1
Project 5 Roadmap
2
Logical disk layout
3
Directory Entry
GOSFS_Dir_Entry
blockList10
size
filename128
acl10
data blocks
Directory
MAX_FILES_PER_DIR
Directory Block
4
Data storage Direct Mapping
Data storage Direct Mapping
GOSFS_Dir_Entry.blockList10
DISK
0
1
4KB data block
2
4KB data block
4KB data block
used
12KB file depicted
5
Data storage Single Indirect
Data storage Single Indirect
GOSFS_Dir_Entry.blockList10
DISK
0
0
1
4KB data block
2
3
4
.
4KB data block
5
6
4KB data block
7
single indirect block
8
4KB data block
9
0
0
1
2
3
4KB data block
4
.
.
40KB file depicted
.
1022
1023
6
Data storage Double Indirect
Data storage Double Indirect
GOSFS_Dir_Entry.blockList10
DISK
0
0
1
4KB data block
single indirect block
2
3
4
4KB data block
.
5
6
4KB data block
7
0
0
0
0
1
1
8
2
2
4KB data block
3
3
4
4
9
.
.
.
.
.
.
1022
1022
4KB data block
1023
1023
4136KB file depicted
single indirect block
double indirect block
7
Data storage - overview
  • 0,32KB use direct mapped blocks only
  • (32KB,4128KB use direct mapped blocks single
    indirect blocks
  • (4128KB,32MB use direct mapped blocks single
    indirect blocks double indirect blocks

8
Format
  • SYS_FORMAT
  • Format(char dev, char fstype)
  • Original Disk Layout
  • Dont have to do it in init, will be called from
    user space
  • Only for GOSFS, not for PFAT

9
Mount
  • SYS_MOUNT
  • vsf.c Mount(char devname, char pathPrefix,
    char fstype)
  • gosfs.cGOSFS_Mount(struct Mount_Point
    mountPoint)
  • Steps
  • check superblock validity
  • fill out mountPoint
  • might consider using an instance
    (see PFAT_Instance in pfat.c)
  • Make sure it works, so that we can test the rest
    of your project

10
Syscalls
  • SYS_OPEN
  • Open(char name, int mode)
  • Not allowed for directories
  • Create files when appropriate
  • SYS_OPENDIRECTORY
  • OpenDirectory(char path)
  • Not allowed for files
  • SYS_CLOSE
  • Close(int fd)
  • SYS_DELETE
  • Delete(char path)
  • If path is a non-empty directory and not empty,
    forbid !

11
Syscalls
  • SYS_READ
  • Read(int fd, char buffer, int length)
  • Not allowed for directories
  • return value
  • lt0, if failure
  • gt0 , bytes available
  • SYS_WRITE
  • Write(int fd, char buffer, int length)
  • Not allowed for directories
  • Grow on write - allocate blocks on the fly if
    past end of file
  • Grow minimum needed a random seek to the
    middle of an empty file and a write result in
    only one allocated block
  • Synchronous
  • SYS_READ/SYS_WRITE increase the offset with
    bytes read/written

12
Syscalls
  • SYS_READENTRY
  • ReadEntry(int fd,VFS_Dir_Entry entry)
  • Read and return information about a single file
    in a directory
  • Advance one file entry at a time, return 1 when
    the directory ends
  • Use File-gtfilePos to remember current entry
  • Seek specifies number of entries to skip (i.e.
    seek(5) would then read the 5th entry)
  • Not allowed for files

13
Syscalls
  • SYS_STAT
  • Stat(char path, VFS_File_Stat stat)
  • Works on an unopened file
  • Simply copy verbatim from GOSFS_Dir_Entry
  • SYS_FSTAT
  • FStat(int fd, VFS_File_Stat stat)
  • Works on an open file
  • Simply copy verbatim from GOSFS_Dir_Entry
  • SYS_SEEK
  • Seek(int fd, int offset)
  • Implement only absolute semantics for offset
  • Allowed to past end of file

14
Syscalls
  • SYS_CREATEDIR
  • CreateDirectory(char name)
  • Should NOT go recursively
  • e.g. CreateDirectory("/d/d1/d2/d3/d4)
  • SYS_SYNC
  • Sync(void)
  • Should synchronize any outstanding data to disk

15
The Buffer Cache
  • idea keep some disk blocks in memory (buffers)
    memory is much faster to read/write than disk
  • buffer life cycle
  • Get - Modify - Release
  • bufcache.c
  • Create_FS_Buffer_Cache(struct Block_Device
    dev,)
  • Get_FS_Buffer()
  • Modify_FS_Buffer()
  • Sync_FS_Buffer()
  • Release_FS_Buffer()
Write a Comment
User Comments (0)
About PowerShow.com