HW8 released: 12/8, 9:00 > 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: > How many block reads ("block_read") does fs5600 perform? And what are they? > (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: > How many block reads ("block_read") does fs5600 perform? And what are they? > (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 can one block store? > > (b) how many data block pointers in total (including both direct and indirect ones) > can an fs5600+ inode have? > > (c) what's the maximum file size of an fs5600+ file? [ Answer: (a) 4096 / 4 = 1024 (b) (1024+1018) (c) (1024+1018) * 4KB ]