Due 3/30/2012 [start of section]
Consider a highly-simplified version of the log-structured file system (LFS). You are supposed to write some code that models the cleaner. Specifically, go through each update in a segment and figure out whether the update has a *live inode* n it. If you find a live inode, print "LIVE", otherwise print "DEAD."
Here are some data structure definitions to help you out:
// The inode map: records (tnumber) -> (disk address) mapping. // Assume disk address stored here is in bytes. unsigned int imap[MAX_INODES]; typedef struct __inode_t { int direct[10]; // just 10 direct pointers } inode_t; typedef struct __update_t { int inumber; // inode number of the inode in this update (in bytes) inode_t inode; // the inode int offset; // offset of data block in file, from 0 ... 9 char data[4096]; // the data block } update_t; typedef struct __segment_t { int disk_addr; // disk address of this segment (in bytes) update_t updates[MAX_UPDATES]; // the updates in this segment // (assume all MAX_UPDATES are used) } segment_t; segment_t *segment; // start with this pointer to the segment in question
Write code to process a segment. Assume you are given a pointer to a segment_t (called 'segment'). Then go through each update in the segment, figure out whether the inode referred to in that update is live or not, printing "LIVE" or "DEAD" as you go.
Some RAID code has been lost. You have to write it!
Assume you have a RAID-4 (parity-based RAID + a single parity disk), with a 4KB chunk size, and 5 disks total as follows:
DISK-0 DISK-1 DISK-2 DISK-3 DISK-4 block0 block1 block2 block3 parity(0..3) block4 block5 block6 block7 parity(4..7) ... ... ... ... ...
// SMALLWRITE() // // This routine takes a logical block number 'block' and writes // the single block of 4KB referred to by 'data' to it. // // It may have to use these existing underlying primitives: // READ(int disk, int offset, char *data); // WRITE(int disk, int offset, char *data); // XOR(char *source1, char *source2, char *dest); void SMALLWRITE(int block, char *data){ }
Derive and write the equation for the mean time to data loss {\em MTTDL_system_doubly_redundant} for a doubly-redundant system with {\em N} total disks arranged in groups of {\em G} disks where any block can be read from a group as long as no more than 2 disks per group have failed. (It is OK to assume that {\em N} is evenly divisible by {\em G} for simplicity.)
MTTDL_system_doubly_redundant =