

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


1. The text, starting on page 7-35, discusses a technique known as soft updates. It mentions on page 7-38 that FFS using soft updates may require more disk writes than Async FFS. Give an example in which more disk writes would occur with soft updates than with Async FFS. Consider a disk block containing two inodes. The first is that of directory A. The first and only entry of the second data block of directory A refers to file B, which is represented by the second inode of our original disk block. When B was created, its inode was constrained to be written to disk before the directory entry (of A) referring to it (constraint 1 on page 7-37). However, when B’s directory entry is created in A, a new direct block is allocated that is pointed to by A’s disk map. Thus (again by constraint 1 on page 7-37), this direct block must be written to disk before A’s inode is. So we have the circular constraint that the block containing B’s inode must be written out before the block containing the second direct block of A, but this block must be written out before the block containing A’s inode — but the two inodes are in the same block. In Async FFS there would be no ordering constraints and the disk block containing the two inodes would simply be written once. However, with soft updates, the block would be written twice: the first time it would contain the newly initialized inode for B (and the value of A’s inode before B was created); the second time it would contain both the newly initialized inode for B and the updated inode for A. 2. NTFS uses a combination of both redo and undo journaling. Explain why both are used (and not just one). The advantage of undo journaling is that it allows cached file-system pages to be freed before transactions involving them commit: once the cached page is checkpointed, i.e., written to disk, updating the file system, the cache entry can be freed. If the system crashes before the commit, the undo entries in the journal are used to undo all the uncommitted changes. However, suppose the system crashes after the commit, but before checkpointing has completed. If only undo journaling is done, then the entire transaction must be undone, since no information is available to complete it. With redo journaling, the transaction can be completed during file- system recovery. 3. One feature of RAID-Z is that the stripes are of variable width — each block has at least one parity sector associated just with it. However, to determine what the block boundaries are, one must traverse the file-system metadata (the shadow-page tree). In a RAID-4 system, one knows that parity information resides exclusively on one disk. Suppose that we lose a disk in a RAID- system and a RAID-Z system. a. Explain what must be done in each case to recover. In a RAID-4 system, one must examine each stripe and compute the contents of the stripe unit that would have resided on the failed disk. The computation is straightforward: simply XOR the corresponding bits of the non-failed stripe units; the bits of the stripe unit on the failed disk are either the result (if parity is zero) or the complement of the result (if parity is one). Since each stripe spans all the disks, each stripe starts on disk 1 and ends on disk N, where N is the number of disks.
For a RAID-Z system, one does essentially the same thing, except that one must traverse the shadow-page tree to identify the blocks. For each block that includes a sector on the failed disk, that sector’s contents must be recomputed as explained above. b. Under what circumstances is recovery faster in the RAID-4 system? (No need for exact details — just explain the principle.) Recovering from a failure in a RAID-4 system is more straightforward than in a RAID-Z system — there’s no need to traverse the shadow-page tree. However, since all stripes must be recovered completely — many of them will correspond to free blocks (whose contents we don’t need to recover) and many of the stripes will be partially free. With RAID-Z, only stripes that correspond to blocks containing live data (or metadata) will actually be recovered. Free blocks will be ignored. Thus, when the file system is close to capacity, recovery on a RAID-4 system will involve less disk I/O than recovery on a RAID-Z system. Otherwise recover will be faster on the RAID-Z system.
4. An issue with ZFS is reclamation of data blocks. With multiple snapshots in use for each file system, it’s not necessarily trivial to determine which blocks are actually free. For example, there might be, in addition to the current version of the file system, three snapshots of it. If we delete the snapshot that’s neither the most recent nor the least recent, how can we determine which blocks must be deleted and which must remain? To answer this question, let’s go through the following steps. a. Explain why reference counts are not part of the solution. (Hint: consider efficiency.) Blocks do not have reference counts. Adding them would add greatly to the cost of creating a snapshot, making it infeasible. b. Suppose each block pointer, in addition to containing a checksum, also contains the time at which the block was created, known as the block’s birth time (note that blocks are never modified in place, thus the creation time for a particular file-system block on disk doesn’t change). Explain how this information can be used to determine that a block was created after a particular snapshot. (Hint: might timestamps be associated with other things as well?) Let’s assume that each snapshot also has a creation time associated with it. If a block’s birth time is later than that of a snapshot, then it must have been created after the snapshot. c. Suppose a block is freed from the current file system (but might still be referenced by a snapshot). Explain how it can be determined whether there exists a snapshot that is referring to it. If the block’s birth time is earlier than that of the most recent snapshot, then some snapshot must be referring to it. d. If a block being freed cannot be reclaimed because some snapshot is referring to it, a reference to it is appended to the file-system’s dead list. When a new snapshot is created, its dead list is set to be that of the current file system, and the current file-system’s dead list is set to empty. Let’s assume no snapshots have ever been deleted. We say that a snapshot is responsible for the existence of a block if the block’s birth time is later than the birth time of the previous snapshot, and the block was freed before the birth time of the next snapshot (or of the file system if this is the most recent snapshot). In other words, the only reason the block cannot be reclaimed is because this snapshot exists. Are all