1 / 12

Week 9

Week 9. March 4, 2004 Adrienne Noble. Important Dates. Homework 9 due Monday, March 8 Project 4 due Wednesday, March 10 Final Exam on Tuesday, March 16, 2:30-4:20pm. Questions?. Lecture Homework 9 Project 4. Review from last week. /foo/hello.c. The VFS.

kaili
Download Presentation

Week 9

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. Week 9 March 4, 2004 Adrienne Noble

  2. Important Dates • Homework 9 due Monday, March 8 • Project 4 due Wednesday, March 10 • Final Exam on Tuesday, March 16, 2:30-4:20pm

  3. Questions? • Lecture • Homework 9 • Project 4

  4. Review from last week • /foo/hello.c

  5. The VFS • Not written in C++, so we can’t use an abstract class • Defines structs for superblocks and inodes • File system must store all this information • Includes an extra field that the file system can use however it wants • Defines a struct with functions that the file system needs to implement • The file system can add additional helper functions

  6. The Buffer Manager • Linux source is large, so these tools can help you find what you need • Cross Referencing Linux: http://lxr.linux.no/source/ • grep • Two pieces of the buffer manager • Data structures (struct buffer_head) • Actual data (pointed to by the b_data field in buffer_head)

  7. For any given disk block, the buffer manager may be • Completely unaware of the block • Aware of the block’s information, but the block is not it memory • Have the block’s information and data in memory

  8. Buffer Manager functions • bh = bread(dev, block, size) • Get the buffer_head for the given disk block, ensuring that the data is in memory and ready for use. Increments the ref count; always pair with a brelse. • bh = getblk(dev, block, size) • Get the buffer_head for the given disk block. Does not guarantee anything about the state of the actual data. Increments ref count; always pair with a brelse. • bh = get_hash_table(dev, block, size) • Find the buffer_head for the given block in the hash table. Does not guarantee anything about the state of the actual data. Increments ref count; always pair with a brelse.

  9. More functions • ll_rw_block(rw, numbufs, bh[]) • Lock buffer, begin IO (either read of write), schedule a callback that will unlock buffer when IO finishes, and return (does not wait for IO completion – see wait_on_buffer). • wait_on_buffer(bh) • Wait for the buffer to be unlocked (e.g. read from disk to complete)

  10. Still More… • mark_buffer_dirty(bh) • Mark the buffer modified • mark_buffer_uptodate(bh) • Indicate that the data pointed to be bh is valid • is_valid = buffer_uptodate(bh) • Return whether the bh points to valid data • brelse(bh) • “buffer release” - decrement the ref count of the given buffer

  11. cse451fs functions • bh = cse451_bread(inode, block, create) • Similar to bread, but takes an inode and block number relative to the inode instead • bh = cse451_getblk(inode, block, create) • Similar to getblk, but takes an inode and block number • err = get_block(inode, block, &bh, create) • Fills in b_blocknr field in bh, allocating a new data block if necessary

More Related