commit e77222a4ecdf427c2eed2eb44251b8841ef81b3c from: rsc date: Thu May 04 18:02:13 2006 UTC ext2 fixes commit - 6802a899956b6c593729c53fe9435dfc89020444 commit + e77222a4ecdf427c2eed2eb44251b8841ef81b3c blob - 41ebfcee4173d26243078a3c78a59d604c8e680a blob + 8473aa34c934d17c074a05022cfd95dd7fa3ee7a --- src/libdiskfs/ext2.c +++ src/libdiskfs/ext2.c @@ -6,7 +6,7 @@ #include #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 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; blob - cf246f98463f5327a7ad48b02b784c96bab40ebe blob + 8b4d051462eb10a03203cbad3e6e8a7ffcd4e969 --- src/libdiskfs/venti.c +++ 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) {