提交 75201ac0 创建 作者: Silas Boyd-Wickizer's avatar Silas Boyd-Wickizer

Merge branch 'scale-amd64' into wq-rejig

...@@ -137,22 +137,21 @@ vmnode::loadpg(off_t off) ...@@ -137,22 +137,21 @@ vmnode::loadpg(off_t off)
mtreadavar("inode:%x.%x", ip->dev, ip->inum); mtreadavar("inode:%x.%x", ip->dev, ip->inum);
mtwriteavar("vmnode:%016x", this); mtwriteavar("vmnode:%016x", this);
#endif #endif
char *p = page[off/PGSIZE]; char *p = page[off/PGSIZE];
s64 n; s64 filen = off > sz ? 0 : MIN(PGSIZE, sz-off);
if (sz - off < PGSIZE) off_t fileo = offset+off;
n = sz - off;
else
n = PGSIZE;
// //
// Possible race condition with concurrent loadpg() calls, // Possible race condition with concurrent loadpg() calls,
// if the underlying inode's contents change.. // if the underlying inode's contents change..
// //
if (readi(ip, p, offset+off, n) != n) if (readi(ip, p, fileo, filen) != filen)
return -1; return -1;
// XXX(sbw) we might leave the begining of page[0] and the // XXX(sbw), we should memset the remainder, but sometimes
// end of page[npages-1] with some random content. // we loadpg on a pg that already has content.
//memset(&p[filen], 0, PGSIZE-filen);
return 0; return 0;
} }
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论