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