提交 7face953 创建 作者: Frans Kaashoek's avatar Frans Kaashoek

Merge branch 'scale' of ssh://amsterdam.csail.mit.edu/home/am0/6.828/xv6 into scale

...@@ -28,14 +28,12 @@ struct ns { ...@@ -28,14 +28,12 @@ struct ns {
int nextkey; int nextkey;
struct bucket table[NHASH]; struct bucket table[NHASH];
struct spinlock lock; struct spinlock lock;
char name[16];
}; };
struct spinlock ns_lock;
void void
nsinit(void) nsinit(void)
{ {
initlock(&ns_lock, "nstable");
} }
// XXX should be using our missing scalable allocator module // XXX should be using our missing scalable allocator module
...@@ -48,13 +46,11 @@ nsalloc(void) ...@@ -48,13 +46,11 @@ nsalloc(void)
if (ns == 0) if (ns == 0)
panic("nsalloc"); panic("nsalloc");
memset(ns, 0, sizeof(struct ns)); memset(ns, 0, sizeof(struct ns));
initlock(&ns_lock, "ns"); snprintf(ns->name, sizeof(ns->name), "ns:%x", ns);
initlock(&ns->lock, ns->name);
acquire(&ns_lock); for (int i = 0; i < NHASH; i++)
for (int i = 0; i < NHASH; i++) {
TAILQ_INIT(&ns->table[i].chain); TAILQ_INIT(&ns->table[i].chain);
}
release(&ns_lock);
return ns; return ns;
} }
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论