> HW9 > released: 04/14, 9:00 > due: 04/20, 23:59 > > Answer the following questions. > Submit your answers to Canvas assignments. There is an entry for this homework. > > > CS5600 File System (fs5600) > > These questions are intended to reinforce fs5600. > > > 1. Suppose fs5600 has a file "/dir1/dir2/file1". > When a process read the file's information, namely executing: > """ > struct stat; > fs_getattr("/dir1/dir2/file1", &stat) > """ > > Question (3 points): [updated 04/26: was "2 points"] > How many block reads to disk ("block_read") does fs5600 perform? > And what are they (what info stored in these blocks)? > (assume buffer cache is empty, meaning you have to read information from disk) > [Answer: 7 read root inode read root data read dir1 indoe read dir1 data read dir2 indoe read dir2 data read file1 inode note: no need to read bitmap or file1's data because this is "fs_getatt" which only reads (so no need to touch bitmap) and only reads file metadata (so no need to touch file data blocks). ] > > > 2. Suppose fs5600 has a file "/file1" and the file has 16KB of contents. > When a process read 4KB from offset 2KB, namely executing: > > """ > char buf[4096]; > fs_read("/file1", buf, 4096, 2048, NULL); > """ > > Question (3 points): [updated 04/26: was "2 points"] > How many block reads ("block_read") does fs5600 perform? > And what are they (what info stored in these blocks)? > (assume buffer-cache is empty, meaning you have to read information from disk) > > [ Answer: 5 read root inode read root data read file1 inode read file1 data[0] read file1 data[1] ] > > 3. Suppose a new file system fs5600+ has an inode as follows: > > """ > struct fs_inode2 { > uint16_t uid; > uint16_t gid; > uint32_t mode; > uint32_t ctime; /* time of last file status change */ > uint32_t mtime; /* time of last data modification */ > int32_t size; > uint32_t ptrs[1018]; > uint32_t indirect_ptr; /* inode = 4096 bytes */ > }; > """ > > And the "indirect_ptr" is the indirect pointer in a Unix inode. > It points to a block (4KB) that contains pointers (uint32_t) to actual data blocks. > > Questions: > > (a) how many pointers (uint32_t) can one block store? (1 point) > > > (b) what is the max number of data block pointers in an fs5600+ inode? (1 point) > [note: this number includes both pointers in "fs_inode2" > and the ones in the indirect block (the block > that indirect pointer--"indirect_ptr"---points to).] > > (c) what's the maximum file size of an fs5600+ file? (2 points) > [ Answer: (a) 4096 / 4 = 1024 (b) (1024+1018) (c) (1024+1018) * 4KB ]