inode cache
linux kernel 1.0 中__iget 实现如下:
struct inode * __iget(struct super_block * sb, int nr, int crossmntp)
{
static struct wait_queue * update_wait = NULL;
struct inode_hash_entry * h;
struct inode * inode;
struct inode * empty = NULL;
if (!sb)
panic("VFS: iget with sb==NULL");
h = hash(sb->s_dev, nr);
repeat:
for (inode = h->inode; inode ; inode = inode->i_hash_next)
if (inode->i_dev == sb->s_dev && inode->i_ino == nr)
goto found_it;
if (!empty) {
h->updating++;
empty = get_empty_inode();
if (!--h->updating)
wake_up(&update_wait);
if (empty)
goto repeat;
return (NULL);
}
inode = empty;
inode->i_sb = sb;
inode->i_dev = sb->s_dev;
inode->i_ino = nr;
inode->i_flags = sb->s_flags;
put_last_free(inode);
insert_inode_hash(inode);
read_inode(inode);
goto return_it;
found_it:
if (!inode->i_count)
nr_free_inodes--;
inode->i_count++;
wait_on_inode(inode);
if (inode->i_dev != sb->s_dev || inode->i_ino != nr) {
printk("Whee.. inode changed from under us. Tell Linus\n");
iput(inode);
goto repeat;
}
if (crossmntp && inode->i_mount) {
struct inode * tmp = inode->i_mount;
tmp->i_count++;
iput(inode);
inode = tmp;
wait_on_inode(inode);
}
if (empty)
iput(empty);
return_it:
while (h->updating)
sleep_on(&update_wait);
return inode;
}
请问其中的update_wait是什么作用? 如何起作用的? 谢谢~
struct inode * __iget(struct super_block * sb, int nr, int crossmntp)
{
static struct wait_queue * update_wait = NULL;
struct inode_hash_entry * h;
struct inode * inode;
struct inode * empty = NULL;
if (!sb)
panic("VFS: iget with sb==NULL");
h = hash(sb->s_dev, nr);
repeat:
for (inode = h->inode; inode ; inode = inode->i_hash_next)
if (inode->i_dev == sb->s_dev && inode->i_ino == nr)
goto found_it;
if (!empty) {
h->updating++;
empty = get_empty_inode();
if (!--h->updating)
wake_up(&update_wait);
if (empty)
goto repeat;
return (NULL);
}
inode = empty;
inode->i_sb = sb;
inode->i_dev = sb->s_dev;
inode->i_ino = nr;
inode->i_flags = sb->s_flags;
put_last_free(inode);
insert_inode_hash(inode);
read_inode(inode);
goto return_it;
found_it:
if (!inode->i_count)
nr_free_inodes--;
inode->i_count++;
wait_on_inode(inode);
if (inode->i_dev != sb->s_dev || inode->i_ino != nr) {
printk("Whee.. inode changed from under us. Tell Linus\n");
iput(inode);
goto repeat;
}
if (crossmntp && inode->i_mount) {
struct inode * tmp = inode->i_mount;
tmp->i_count++;
iput(inode);
inode = tmp;
wait_on_inode(inode);
}
if (empty)
iput(empty);
return_it:
while (h->updating)
sleep_on(&update_wait);
return inode;
}
请问其中的update_wait是什么作用? 如何起作用的? 谢谢~
...全文
相关推荐
linux内核2.6cache源代码
**Dentry和Inode缓存**:在Linux文件系统中,每个文件和目录都有对应的Inode结构,记录文件属性等信息;而Dentry则关联文件名和Inode。
页面缓冲(Page Cache)的管理
### 页面缓冲(Page Cache)的管理#### 一、文件读写过程分析页面缓冲(Page Cache)作为Linux操作系统中的一项重要机制,主要用于缓存文件系统的读写操作,从而提高整体性能。
FSDev.rar_linux 文件系统
本文详细介绍了Linux内核中文件系统管理的关键功能,包括inode和数据块位图的管理、块设备的读写操作、buffer cache的实现以及缓冲区的管理。同时,还涉及了错误代码的定义和管理,确保文件系
linux 内核 cache 管理介绍
在Linux内核中,缓存分为多种类型,如页缓存(Page Cache)、dentry缓存和inode缓存等。它们共同构成了Linux内核的内存管理系统,帮助减少磁盘I/O,提高系统响应速度。
jffs2源代码情景分析(beta2).pdf
- **jffs2_inode_cache**: 表示文件系统中的inode缓存,用于提高inode访问效率。


