comment fixes

This commit is contained in:
Robert Morris 2017-08-09 06:54:45 -04:00
parent da3b931ddb
commit 70705966ad
2 changed files with 12 additions and 9 deletions

6
bio.c
View file

@ -75,9 +75,9 @@ bget(uint dev, uint blockno)
} }
} }
// Not cached; recycle some unused buffer and clean buffer // Not cached; recycle an unused buffer.
// "clean" because B_DIRTY and not locked means log.c // Even if refcnt==0, B_DIRTY indicates a buffer is in use
// hasn't yet committed the changes to the buffer. // because log.c has modified it but not yet committed it.
for(b = bcache.head.prev; b != &bcache.head; b = b->prev){ for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
if(b->refcnt == 0 && (b->flags & B_DIRTY) == 0) { if(b->refcnt == 0 && (b->flags & B_DIRTY) == 0) {
b->dev = dev; b->dev = dev;

15
fs.c
View file

@ -155,10 +155,10 @@ bfree(int dev, uint b)
// have locked the inodes involved; this lets callers create // have locked the inodes involved; this lets callers create
// multi-step atomic operations. // multi-step atomic operations.
// //
// The icache.lock spin-lock defends ip->ref, ip->dev, and ip->inum. // The icache.lock spin-lock defends the allocation of icache
// Since ip->ref indicates whether an icache entry is free, the // entries. Since ip->ref indicates whether an entry is free,
// icache.lock defends icache allocation. icache.lock also defends // and ip->dev and ip->inum indicate which i-node an entry
// all fields of an unallocated icache entry, during allocation. // holds, one must hold icache.lock while using any of those fields.
// //
// An ip->lock sleep-lock defends all ip-> fields other than ref, // An ip->lock sleep-lock defends all ip-> fields other than ref,
// dev, and inum. One must hold ip->lock in order to // dev, and inum. One must hold ip->lock in order to
@ -189,8 +189,9 @@ iinit(int dev)
static struct inode* iget(uint dev, uint inum); static struct inode* iget(uint dev, uint inum);
//PAGEBREAK! //PAGEBREAK!
// Allocate a new inode with the given type on device dev. // Allocate an inode on device dev.
// A free inode has a type of zero. // Give it type type.
// Returns an unlocked but allocated and referenced inode.
struct inode* struct inode*
ialloc(uint dev, short type) ialloc(uint dev, short type)
{ {
@ -214,6 +215,8 @@ ialloc(uint dev, short type)
} }
// Copy a modified in-memory inode to disk. // Copy a modified in-memory inode to disk.
// Must be called after every change to an ip->xxx field
// that lives on disk, since i-node cache is write-through.
// Caller must hold ip->lock. // Caller must hold ip->lock.
void void
iupdate(struct inode *ip) iupdate(struct inode *ip)