Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ static uint
bmap(struct inode *ip, uint bn)
{
struct buf *bp;
uint addr;

if(bn < NDIRECT){
return ip->addrs[bn];
Expand All @@ -146,7 +147,9 @@ bmap(struct inode *ip, uint bn)
// Load indirect block
bp = bread(ip->dev, ip->addrs[NDIRECT]);
uint *a = (uint*)bp->data;
return a[bn];
addr = a[bn];
brelse(bp);
return addr;
}

panic("bmap: out of range");
Expand Down Expand Up @@ -184,4 +187,4 @@ readi(struct inode *ip, char *dst, uint off, uint n)
brelse(bp);
}
return n;
}
}