Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
9cec455b
提交
9cec455b
8月 08, 2017
创建
作者:
Robert Morris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fs comment nits
上级
5cbccef8
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
7 行增加
和
7 行删除
+7
-7
fs.c
fs.c
+7
-7
没有找到文件。
fs.c
浏览文件 @
9cec455b
...
@@ -112,20 +112,20 @@ bfree(int dev, uint b)
...
@@ -112,20 +112,20 @@ bfree(int dev, uint b)
// inodes include book-keeping information that is
// inodes include book-keeping information that is
// not stored on disk: ip->ref and ip->flags.
// not stored on disk: ip->ref and ip->flags.
//
//
// An inode and its in-memory repres
tative
go through a
// An inode and its in-memory repres
entation
go through a
// sequence of states before they can be used by the
// sequence of states before they can be used by the
// rest of the file system code.
// rest of the file system code.
//
//
// * Allocation: an inode is allocated if its type (on disk)
// * Allocation: an inode is allocated if its type (on disk)
// is non-zero. ialloc() allocates, iput() frees if
// is non-zero. ialloc() allocates,
and
iput() frees if
// the
link count has
fallen to zero.
// the
reference and link counts have
fallen to zero.
//
//
// * Referencing in cache: an entry in the inode cache
// * Referencing in cache: an entry in the inode cache
// is free if ip->ref is zero. Otherwise ip->ref tracks
// is free if ip->ref is zero. Otherwise ip->ref tracks
// the number of in-memory pointers to the entry (open
// the number of in-memory pointers to the entry (open
// files and current directories). iget()
to find
or
// files and current directories). iget()
finds
or
// create
a cache entry and increment its ref,
iput()
// create
s a cache entry and increments its ref;
iput()
//
to decrement
ref.
//
decrements
ref.
//
//
// * Valid: the information (type, size, &c) in an inode
// * Valid: the information (type, size, &c) in an inode
// cache entry is only correct when the I_VALID bit
// cache entry is only correct when the I_VALID bit
...
@@ -283,7 +283,7 @@ ilock(struct inode *ip)
...
@@ -283,7 +283,7 @@ ilock(struct inode *ip)
acquiresleep
(
&
ip
->
lock
);
acquiresleep
(
&
ip
->
lock
);
if
(
!
(
ip
->
flags
&
I_VALID
)
){
if
(
(
ip
->
flags
&
I_VALID
)
==
0
){
bp
=
bread
(
ip
->
dev
,
IBLOCK
(
ip
->
inum
,
sb
));
bp
=
bread
(
ip
->
dev
,
IBLOCK
(
ip
->
inum
,
sb
));
dip
=
(
struct
dinode
*
)
bp
->
data
+
ip
->
inum
%
IPB
;
dip
=
(
struct
dinode
*
)
bp
->
data
+
ip
->
inum
%
IPB
;
ip
->
type
=
dip
->
type
;
ip
->
type
=
dip
->
type
;
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论