Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
1c7aa960
提交
1c7aa960
8月 08, 2017
创建
作者:
Robert Morris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
a little more lock documentation
上级
70d912b3
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
13 行增加
和
0 行删除
+13
-0
fs.c
fs.c
+13
-0
没有找到文件。
fs.c
浏览文件 @
1c7aa960
...
@@ -154,6 +154,15 @@ bfree(int dev, uint b)
...
@@ -154,6 +154,15 @@ bfree(int dev, uint b)
// Many internal file system functions expect the caller to
// Many internal file system functions expect the caller to
// 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.
// Since ip->ref indicates whether an icache entry is free, the
// icache.lock defends icache allocation. icache.lock also defends
// all fields of an unallocated icache entry, during allocation.
//
// An ip->lock sleep-lock defends all ip-> fields other than ref,
// dev, and inum. One must hold ip->lock in order to
// read or write that inode's ip->valid, ip->size, ip->type, &c.
struct
{
struct
{
struct
spinlock
lock
;
struct
spinlock
lock
;
...
@@ -205,6 +214,7 @@ ialloc(uint dev, short type)
...
@@ -205,6 +214,7 @@ ialloc(uint dev, short type)
}
}
// Copy a modified in-memory inode to disk.
// Copy a modified in-memory inode to disk.
// Caller must hold ip->lock.
void
void
iupdate
(
struct
inode
*
ip
)
iupdate
(
struct
inode
*
ip
)
{
{
...
@@ -421,6 +431,7 @@ itrunc(struct inode *ip)
...
@@ -421,6 +431,7 @@ itrunc(struct inode *ip)
}
}
// Copy stat information from inode.
// Copy stat information from inode.
// Caller must hold ip->lock.
void
void
stati
(
struct
inode
*
ip
,
struct
stat
*
st
)
stati
(
struct
inode
*
ip
,
struct
stat
*
st
)
{
{
...
@@ -433,6 +444,7 @@ stati(struct inode *ip, struct stat *st)
...
@@ -433,6 +444,7 @@ stati(struct inode *ip, struct stat *st)
//PAGEBREAK!
//PAGEBREAK!
// Read data from inode.
// Read data from inode.
// Caller must hold ip->lock.
int
int
readi
(
struct
inode
*
ip
,
char
*
dst
,
uint
off
,
uint
n
)
readi
(
struct
inode
*
ip
,
char
*
dst
,
uint
off
,
uint
n
)
{
{
...
@@ -461,6 +473,7 @@ readi(struct inode *ip, char *dst, uint off, uint n)
...
@@ -461,6 +473,7 @@ readi(struct inode *ip, char *dst, uint off, uint n)
// PAGEBREAK!
// PAGEBREAK!
// Write data to inode.
// Write data to inode.
// Caller must hold ip->lock.
int
int
writei
(
struct
inode
*
ip
,
char
*
src
,
uint
off
,
uint
n
)
writei
(
struct
inode
*
ip
,
char
*
src
,
uint
off
,
uint
n
)
{
{
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论