summaryrefslogtreecommitdiff
path: root/fs.c
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2016-09-11 17:24:04 -0400
committerFrans Kaashoek <[email protected]>2016-09-11 17:24:04 -0400
commit6670d3b5e084d9d900d2ea13e624e72e1e28f84c (patch)
tree5ad8eb3dc3ba247c7dbe45ee082d1900853fd1e1 /fs.c
parent551c2f3576d34e4749a1165af07d90e21ad528be (diff)
downloadxv6-labs-6670d3b5e084d9d900d2ea13e624e72e1e28f84c.tar.gz
xv6-labs-6670d3b5e084d9d900d2ea13e624e72e1e28f84c.tar.bz2
xv6-labs-6670d3b5e084d9d900d2ea13e624e72e1e28f84c.zip
Straight replacement of B_BUSY with a sleeping lock.
Diffstat (limited to 'fs.c')
-rw-r--r--fs.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs.c b/fs.c
index 6887dbc..26a0b3e 100644
--- a/fs.c
+++ b/fs.c
@@ -16,6 +16,7 @@
#include "mmu.h"
#include "proc.h"
#include "spinlock.h"
+#include "sleeplock.h"
#include "fs.h"
#include "buf.h"
#include "file.h"
@@ -167,7 +168,7 @@ iinit(int dev)
initlock(&icache.lock, "icache");
readsb(dev, &sb);
cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d\
- inodestart %d bmap start %d\n", sb.size, sb.nblocks,
+ inodestart %d bmap start %d\n", sb.size, sb.nblocks,
sb.ninodes, sb.nlog, sb.logstart, sb.inodestart,
sb.bmapstart);
}
@@ -455,6 +456,13 @@ readi(struct inode *ip, char *dst, uint off, uint n)
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
+ /*
+ cprintf("data off %d:\n", off);
+ for (int j = 0; j < min(m, 10); j++) {
+ cprintf("%x ", bp->data[off%BSIZE+j]);
+ }
+ cprintf("\n");
+ */
memmove(dst, bp->data + off%BSIZE, m);
brelse(bp);
}