aboutsummaryrefslogtreecommitdiff
path: root/src/libdiskfs/venti.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-05-04 18:02:13 +0000
committerrsc <devnull@localhost>2006-05-04 18:02:13 +0000
commite77222a4ecdf427c2eed2eb44251b8841ef81b3c (patch)
treedc8c4b5f35272fcc99d4fa0e04ac91173a8d0e59 /src/libdiskfs/venti.c
parent6802a899956b6c593729c53fe9435dfc89020444 (diff)
downloadplan9port-e77222a4ecdf427c2eed2eb44251b8841ef81b3c.tar.gz
plan9port-e77222a4ecdf427c2eed2eb44251b8841ef81b3c.tar.bz2
plan9port-e77222a4ecdf427c2eed2eb44251b8841ef81b3c.zip
ext2 fixes
Diffstat (limited to 'src/libdiskfs/venti.c')
-rw-r--r--src/libdiskfs/venti.c61
1 files changed, 29 insertions, 32 deletions
diff --git a/src/libdiskfs/venti.c b/src/libdiskfs/venti.c
index cf246f98..8b4d0514 100644
--- a/src/libdiskfs/venti.c
+++ b/src/libdiskfs/venti.c
@@ -41,38 +41,7 @@ vtfileindices(VtEntry *e, u32int bn, int *index)
return i;
}
-static VtBlock*
-_vtfileblock(VtCache *c, VtEntry *e, u32int bn)
-{
- VtBlock *b, *bb;
- int i, d, index[VtPointerDepth+1], t;
-
- i = vtfileindices(e, bn, index);
- if(i < 0)
- return nil;
- d = (e->type&VtTypeDepthMask);
- if(i > d){
- werrstr("bad address %d > %d (%x %x)", i, d, e->type, e->flags);
- return nil;
- }
-
-/*fprint(2, "vtread %V\n", e->score); */
- b = vtcacheglobal(c, e->score, e->type);
- if(b == nil)
- return nil;
-
- for(i=d-1; i>=0; i--){
- t = VtDataType+i;
-/*fprint(2, "vtread %V\n", b->data+index[i]*VtScoreSize); */
- bb = vtcacheglobal(c, b->data+index[i]*VtScoreSize, t);
- vtblockput(b);
- if(bb == nil)
- return nil;
- b = bb;
- }
- return b;
-}
-
+VtBlock *_vtfileblock(VtCache*, VtEntry*, u32int); /* avoid auto-inline by putting later in file */
static void
diskventiblockput(Block *b)
{
@@ -109,6 +78,34 @@ nfilereads++;
return b;
}
+VtBlock*
+_vtfileblock(VtCache *c, VtEntry *e, u32int bn)
+{
+ VtBlock *b, *bb;
+ int i, d, index[VtPointerDepth+1], t;
+ uchar score[VtScoreSize];
+
+ i = vtfileindices(e, bn, index);
+ if(i < 0)
+ return nil;
+ d = (e->type&VtTypeDepthMask);
+ if(i > d){
+ werrstr("bad address %d > %d (%x %x)", i, d, e->type, e->flags);
+ return nil;
+ }
+
+/*fprint(2, "vtread %V\n", e->score); */
+ b = vtcacheglobal(c, e->score, e->type);
+ for(i=d-1; i>=0 && b; i--){
+ t = VtDataType+i;
+/*fprint(2, "vtread %V\n", b->data+index[i]*VtScoreSize); */
+ memmove(score, b->data+index[i]*VtScoreSize, VtScoreSize);
+ vtblockput(b);
+ b = vtcacheglobal(c, score, t);
+ }
+ return b;
+}
+
static void
diskventiclose(Disk *dd)
{