Linux 内核文件系统与设备操作流程分析(25) if (result) dput(dentry); else result = dentry; } mutex_unlock(&dir->i_mutex); return result; } .......}这里到了实际文件系统的查找函数。首先根据第一个参数,也就是上级的 dentry从 ext3_dir_entry_2 中得到新的 dentry 结构,并从其中得到相关的 inode number,再调用 iget() 函数去获取相应的 struct inode 结构,最后将此 inode 与 dentry进行关联。static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd){ struct inode * inode; struct ext3_dir_entry_2 * de; struct buffer_head * bh; if (dentry->d_name.len > EXT3_NAME_LEN) return ERR_PTR(-ENAMETOOLONG); // // 得到新的 dentry 并返回一个磁盘缓存 buffer_head 结构 // 注意:这个 dentry 虽然是新分配的,但它所指向的 d_parent // 与 d_inode 是有效的,也就是说上级目录相关信息是有效的。 // 返回的 de 里包含了 inode number。 // bh = ext3_find_entry(dentry, &de); // // 注意:这里的 inode 默认置为 NULL //