Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
a099175e
提交
a099175e
3月 25, 2012
创建
作者:
Nickolai Zeldovich
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'scale-amd64' of
git+ssh://pdos.csail.mit.edu/home/am0/6.828/xv6
into scale-amd64
上级
929a4d12
05df2105
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
78 行增加
和
52 行删除
+78
-52
Makefile
Makefile
+1
-1
mktree.cc
bin/mktree.cc
+16
-7
wqtest.cc
bin/wqtest.cc
+0
-1
xdu.cc
bin/xdu.cc
+1
-5
xls.cc
bin/xls.cc
+0
-3
dirit.hh
include/dirit.hh
+16
-8
lockstat.h
include/lockstat.h
+1
-0
ns.hh
include/ns.hh
+4
-0
wqfor.hh
include/wqfor.hh
+36
-2
wqkernel.hh
include/wqkernel.hh
+0
-5
wquser.hh
include/wquser.hh
+0
-6
fs.cc
kernel/fs.cc
+1
-1
wq.cc
lib/wq.cc
+0
-6
mkfs.c
tools/mkfs.c
+2
-2
wqlinux.hh
user/wqlinux.hh
+0
-5
没有找到文件。
Makefile
浏览文件 @
a099175e
...
...
@@ -3,7 +3,7 @@
Q
?=
@
TOOLPREFIX
?=
x86_64-jos-elf-
QEMU
?=
qemu-system-x86_64
QEMUSMP
?=
4
QEMUSMP
?=
8
QEMUSRC
?=
../mtrace
MTRACE
?=
$(QEMU)
HW
?=
qemu
...
...
bin/mktree.cc
浏览文件 @
a099175e
...
...
@@ -3,12 +3,19 @@
#include "user.h"
#include "lib.h"
#include "fcntl.h"
#include "wq.hh"
static
int
branch
;
static
void
dolevel
(
int
fd
,
int
branch
,
int
depth
)
dolevel
(
int
fd
,
int
depth
)
{
if
(
depth
>
0
)
{
for
(
int
i
=
0
;
i
<
branch
;
i
++
)
{
int
it
=
0
;
wq_for_serial
<
int
>
(
it
,
[](
int
&
it
)
->
bool
{
return
it
<
branch
;
},
[
&
fd
,
&
depth
](
int
i
)
->
void
{
char
name
[]
=
"a"
;
*
name
+=
i
;
if
(
mkdirat
(
fd
,
name
)
<
0
)
...
...
@@ -16,9 +23,9 @@ dolevel(int fd, int branch, int depth)
int
nfd
=
openat
(
fd
,
name
,
O_RDONLY
);
if
(
nfd
<
0
)
die
(
"openat
"
);
dolevel
(
nfd
,
branch
,
depth
-
1
);
}
die
(
"openat
: %s at %u"
,
name
,
depth
);
dolevel
(
nfd
,
depth
-
1
);
}
);
}
close
(
fd
);
...
...
@@ -30,8 +37,10 @@ main(int ac, char **av)
if
(
ac
<
4
)
die
(
"usage: %s dir branch depth"
,
av
[
0
]);
initwq
();
const
char
*
dir
=
av
[
1
];
int
branch
=
atoi
(
av
[
2
]);
branch
=
atoi
(
av
[
2
]);
int
depth
=
atoi
(
av
[
3
]);
if
(
mkdir
(
dir
))
...
...
@@ -41,5 +50,5 @@ main(int ac, char **av)
if
(
fd
<
0
)
die
(
"open"
);
dolevel
(
fd
,
branch
,
depth
);
dolevel
(
fd
,
depth
);
}
bin/wqtest.cc
浏览文件 @
a099175e
...
...
@@ -127,6 +127,5 @@ main(int ac, char **av)
test0
();
testfork
();
execwork
::
test
();
exitwq
();
return
0
;
}
bin/xdu.cc
浏览文件 @
a099175e
...
...
@@ -51,15 +51,12 @@ du(int fd)
[](
dirit
&
i
)
->
bool
{
return
!
i
.
end
();
},
[
&
size
,
&
fd
](
const
char
*
name
)
->
void
{
if
(
!
strcmp
(
name
,
"."
)
||
!
strcmp
(
name
,
".."
))
{
free
((
void
*
)
name
);
if
(
!
strcmp
(
name
,
"."
)
||
!
strcmp
(
name
,
".."
))
return
;
}
int
nfd
=
openat
(
fd
,
name
,
0
);
if
(
nfd
>=
0
)
size
+=
du
(
nfd
);
// should go into work queue
free
((
void
*
)
name
);
});
}
else
{
close
(
fd
);
...
...
@@ -79,6 +76,5 @@ main(int ac, char **av)
perf_stop
();
printf
(
"%ld
\n
"
,
s
);
wq_dump
();
exitwq
();
return
0
;
}
bin/xls.cc
浏览文件 @
a099175e
...
...
@@ -67,14 +67,12 @@ ls(const char *path)
struct
stat
st
;
if
(
xfstatat
(
fd
,
name
,
&
st
)
<
0
){
printf
(
"ls: cannot stat %s
\n
"
,
name
);
free
((
void
*
)
name
);
return
;
}
if
(
!
silent
)
printf
(
"%u %10lu %10lu %s
\n
"
,
ST_TYPE
(
st
),
ST_INO
(
st
),
ST_SIZE
(
st
),
name
);
free
((
void
*
)
name
);
});
}
else
{
close
(
fd
);
...
...
@@ -99,6 +97,5 @@ main(int argc, char *argv[])
perf_stop
();
wq_dump
();
exitwq
();
return
0
;
}
include/dirit.hh
浏览文件 @
a099175e
...
...
@@ -13,14 +13,6 @@ public:
return
*
this
;
}
const
char
*
copy_value
()
{
char
*
buf
=
(
char
*
)
malloc
(
256
);
return
name
(
buf
,
256
);
}
bool
end
()
const
{
return
end_
;
}
private
:
char
*
name
(
char
*
buf
,
size_t
n
)
const
{
n
=
MIN
(
DIRSIZ
+
1
,
n
);
memmove
(
buf
,
de_
.
name
,
n
-
1
);
...
...
@@ -28,6 +20,9 @@ private:
return
buf
;
}
bool
end
()
const
{
return
end_
;
}
private
:
void
refill
(
void
)
{
int
r
;
...
...
@@ -45,3 +40,16 @@ private:
bool
end_
;
struct
dirent
de_
;
};
static
inline
const
char
*
copy_value
(
dirit
&
it
)
{
char
*
buf
=
(
char
*
)
malloc
(
256
);
return
it
.
name
(
buf
,
256
);
}
static
inline
void
free_value
(
dirit
&
it
,
const
char
*
name
)
{
free
((
void
*
)
name
);
}
include/lockstat.h
浏览文件 @
a099175e
...
...
@@ -52,6 +52,7 @@ struct klockstat;
#define LOCKSTAT_KALLOC 1
#define LOCKSTAT_KMALLOC 1
#define LOCKSTAT_NET 1
#define LOCKSTAT_NS 1
#define LOCKSTAT_PIPE 1
#define LOCKSTAT_PROC 1
#define LOCKSTAT_SCHED 1
...
...
include/ns.hh
浏览文件 @
a099175e
...
...
@@ -56,6 +56,10 @@ class xns : public rcu_freed {
nextkey
=
1
;
for
(
int
i
=
0
;
i
<
NHASH
;
i
++
)
table
[
i
].
chain
=
0
;
for
(
int
i
=
0
;
i
<
NCPU
;
i
++
)
{
percore
[
i
]
=
nullptr
;
initlock
(
&
percore_lock
[
i
],
"xns_lock"
,
LOCKSTAT_NS
);
}
}
~
xns
()
{
...
...
include/wqfor.hh
浏览文件 @
a099175e
...
...
@@ -13,7 +13,7 @@ struct forwork : public work {
:
it_
(
it
),
cond_
(
cond
),
body_
(
body
),
frame_
(
frame
)
{}
virtual
void
run
()
{
decltype
(
it_
.
copy_value
())
v
=
it_
.
copy_value
(
);
decltype
(
copy_value
(
it_
))
v
=
copy_value
(
it_
);
++
it_
;
if
(
cond_
(
it_
))
{
forwork
<
IT
,
BODY
>
*
w
=
new
forwork
<
IT
,
BODY
>
(
it_
,
cond_
,
body_
,
frame_
);
...
...
@@ -21,6 +21,7 @@ struct forwork : public work {
wq_push
(
w
);
}
body_
(
v
);
free_value
(
it_
,
v
);
frame_
.
dec
();
delete
this
;
}
...
...
@@ -48,15 +49,48 @@ wq_for(IT &init, bool (*cond)(IT &it), BODY body)
// XXX(sbw) should be able to coarsen loop
decltype
(
init
.
copy_value
())
v
=
init
.
copy_value
();
if
(
!
cond
(
init
))
return
;
decltype
(
copy_value
(
init
))
v
=
copy_value
(
init
);
++
init
;
if
(
cond
(
init
))
{
forwork
<
IT
,
BODY
>
*
w
=
new
forwork
<
IT
,
BODY
>
(
init
,
cond
,
body
,
frame
);
frame
.
inc
();
wq_push
(
w
);
}
body
(
v
);
free_value
(
init
,
v
);
while
(
!
frame
.
zero
())
wq_trywork
();
}
// For debugging
// Same API as wq_for but serially executes body
template
<
typename
IT
,
typename
BODY
>
static
inline
void
wq_for_serial
(
IT
&
init
,
bool
(
*
cond
)(
IT
&
it
),
BODY
body
)
{
for
(;
cond
(
init
);
++
init
)
{
decltype
(
copy_value
(
init
))
v
=
copy_value
(
init
);
body
(
v
);
free_value
(
init
,
v
);
}
}
// Default copy_value
template
<
typename
T
>
static
inline
T
copy_value
(
T
&
it
)
{
return
it
;
}
// Default free_value
template
<
typename
T
>
static
inline
void
free_value
(
T
&
it
,
T
&
v
)
{
}
include/wqkernel.hh
浏览文件 @
a099175e
...
...
@@ -43,9 +43,4 @@ wqarch_init(void)
{
}
static
inline
void
wqarch_exit
(
void
)
{
}
#define xprintf cprintf
include/wquser.hh
浏览文件 @
a099175e
...
...
@@ -92,12 +92,6 @@ wqarch_init(void)
pthread_setspecific
(
idkey
,
(
void
*
)(
u64
)
id
);
}
static
inline
void
wqarch_exit
(
void
)
{
exiting
=
1
;
}
#define xprintf printf
#define pushcli()
#define popcli()
kernel/fs.cc
浏览文件 @
a099175e
...
...
@@ -201,7 +201,7 @@ ialloc(u32 dev, short type)
//cprintf("ialloc oops %d\n", inum); // XXX harmless
}
}
cprintf
(
"ialloc:
no inodes
\n
"
);
cprintf
(
"ialloc:
0/%u inodes
\n
"
,
sb
.
ninodes
);
return
nullptr
;
}
...
...
lib/wq.cc
浏览文件 @
a099175e
...
...
@@ -79,12 +79,6 @@ initwq(void)
wqarch_init
();
}
void
exitwq
(
void
)
{
wqarch_exit
();
}
//
// wq
//
...
...
tools/mkfs.c
浏览文件 @
a099175e
...
...
@@ -11,8 +11,8 @@
#include "include/stat.h"
int
nblocks
=
4067
;
int
ninodes
=
2
00
;
int
size
=
4
096
;
int
ninodes
=
8
00
;
int
size
=
4
172
;
int
fsfd
;
struct
superblock
sb
;
...
...
user/wqlinux.hh
浏览文件 @
a099175e
...
...
@@ -83,11 +83,6 @@ wqarch_init(void)
}
}
static
inline
void
wqarch_exit
(
void
)
{
}
#define xprintf printf
#define pushcli()
#define popcli()
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论