diff options
author | rsc <devnull@localhost> | 2006-05-04 18:02:13 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2006-05-04 18:02:13 +0000 |
commit | e77222a4ecdf427c2eed2eb44251b8841ef81b3c (patch) | |
tree | dc8c4b5f35272fcc99d4fa0e04ac91173a8d0e59 /src/libdiskfs | |
parent | 6802a899956b6c593729c53fe9435dfc89020444 (diff) | |
download | plan9port-e77222a4ecdf427c2eed2eb44251b8841ef81b3c.tar.gz plan9port-e77222a4ecdf427c2eed2eb44251b8841ef81b3c.tar.bz2 plan9port-e77222a4ecdf427c2eed2eb44251b8841ef81b3c.zip |
ext2 fixes
Diffstat (limited to 'src/libdiskfs')
-rw-r--r-- | src/libdiskfs/ext2.c | 17 | ||||
-rw-r--r-- | src/libdiskfs/venti.c | 61 |
2 files changed, 37 insertions, 41 deletions
diff --git a/src/libdiskfs/ext2.c b/src/libdiskfs/ext2.c index 41ebfcee..8473aa34 100644 --- a/src/libdiskfs/ext2.c +++ b/src/libdiskfs/ext2.c @@ -6,7 +6,7 @@ #include <diskfs.h> #include "ext2.h" -#define debug 1 +#define debug 0 static int ext2sync(Fsys*); static void ext2close(Fsys*); @@ -111,8 +111,10 @@ ext2blockread(Fsys *fsys, u64int vbno) fprint(2, "loading group: %r..."); return nil; } -/* if(debug) */ -/* fprint(2, "group %d bitblock=%d...", bno/fs->blockspergroup, g->bitblock); */ +/* + if(debug) + fprint(2, "group %d bitblock=%d...", bno/fs->blockspergroup, g->bitblock); +*/ if((bitb = diskread(fs->disk, fs->blocksize, (u64int)g->bitblock*fs->blocksize)) == nil){ if(debug) @@ -138,7 +140,7 @@ static Block* ext2datablock(Ext2 *fs, u32int bno, int size) { USED(size); - return ext2blockread(fs->fsys, bno+fs->firstblock); + return ext2blockread(fs->fsys, bno); } static Block* @@ -605,15 +607,12 @@ ext2readdir(Fsys *fsys, SunAuthUnix *au, Nfs3Handle *h, u32int count, u64int coo if(debug) fprint(2, "bad namlen %d reclen %d at offset %d of %d\n", de->namlen, de->reclen, (int)(p-b->data), b->len); break; } - if(de->name[de->namlen] != 0){ - if(debug) fprint(2, "bad name %d %.*s\n", de->namlen, de->namlen, de->name); - continue; - } - if(debug) print("%s/%d ", de->name, (int)de->ino); + if(debug) print("%.*s/%d ", de->namlen, de->name, (int)de->ino); if((uchar*)de - b->data < off) continue; e.fileid = de->ino; e.name = de->name; + e.namelen = de->namlen; e.cookie = (u64int)i*fs->blocksize + (p - b->data); if(nfs3entrypack(dp, dep, &ndp, &e) < 0){ done = 1; 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) { |