1 / 15

Project 5 Roadmap

Project 5 Roadmap. Logical disk layout. Directory Entry. flags. GOSFS_Dir_Entry. GOSFS_Dir_Entry. GOSFS_Dir_Entry. GOSFS_Dir_Entry. GOSFS_Dir_Entry. GOSFS_Dir_Entry. GOSFS_Dir_Entry. GOSFS_Dir_Entry. blockList[10]. size. filename[128]. acl[10]. data blocks. Directory.

duy
Télécharger la présentation

Project 5 Roadmap

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Project 5 Roadmap

  2. Logical disk layout

  3. Directory Entry flags GOSFS_Dir_Entry GOSFS_Dir_Entry GOSFS_Dir_Entry GOSFS_Dir_Entry GOSFS_Dir_Entry GOSFS_Dir_Entry GOSFS_Dir_Entry GOSFS_Dir_Entry blockList[10] size filename[128] acl[10] data blocks Directory MAX_FILES_PER_DIR Directory Block

  4. 8 9 7 6 3 4 5 Data storage –Direct Mapping Data storage – Direct Mapping GOSFS_Dir_Entry.blockList[10] 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.blockList[10] 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. 0 0 1 2 3 4 . . . 1022 1023 Data storage –Double Indirect Data storage – Double Indirect GOSFS_Dir_Entry.blockList[10] 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 2 2 8 4KB data block 3 3 4 4 9 . . . . . . 1022 1022 4KB data block 1023 1023 4136KB file depicted double indirect block single 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 • Don’t 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.c:GOSFS_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 • <0, if failure • >=0 , # 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->filePos 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()

More Related