|
11 | 11 | static const struct inode_operations simplefs_inode_ops; |
12 | 12 | static const struct inode_operations symlink_inode_ops; |
13 | 13 |
|
14 | | -/* Get inode ino from disk */ |
| 14 | +/* Either return the inode that corresponds to a given inode number (ino), if |
| 15 | + * it is already in the cache, or create a new inode object if it is not in the |
| 16 | + * cache. |
| 17 | + * |
| 18 | + * Note that this function is very similar to simplefs_new_inode, except that |
| 19 | + * the requested inode is supposed to be allocated on-disk already. So do not |
| 20 | + * use this to create a completely new inode that has not been allocated on |
| 21 | + * disk. |
| 22 | + */ |
15 | 23 | struct inode *simplefs_iget(struct super_block *sb, unsigned long ino) |
16 | 24 | { |
17 | 25 | struct inode *inode = NULL; |
@@ -181,7 +189,17 @@ static struct dentry *simplefs_lookup(struct inode *dir, |
181 | 189 | return NULL; |
182 | 190 | } |
183 | 191 |
|
184 | | -/* Create a new inode in dir */ |
| 192 | +/* Find and construct a new inode. |
| 193 | + * |
| 194 | + * @dir: the inode of the parent directory where the new inode is supposed to |
| 195 | + * be attached to. |
| 196 | + * @mode: the mode information of the new inode |
| 197 | + * |
| 198 | + * This is a helper function for the inode operation "create" (implemented in |
| 199 | + * simplefs_create()). It takes care of reserving an inode block on disk (by |
| 200 | + * modifying the inode bitmap), creating a VFS inode object (in memory), and |
| 201 | + * attaching filesystem-specific information to that VFS inode. |
| 202 | + */ |
185 | 203 | static struct inode *simplefs_new_inode(struct inode *dir, mode_t mode) |
186 | 204 | { |
187 | 205 | struct inode *inode; |
|
0 commit comments