[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MinixFS 0.60 PL10 Patch Collection
here are some more diffs to apply on top of it...
. fix bitmaps Kmalloc calculation for larger filesystems
. a hack for fsck to check for sparse directories
. clear bitmap dirty bits on `unmounts' (Dlock), you'll get warnings
about bitmaps not written out after fsck runs sometimes, don't ask
me why... as long as fsck found no errors you can ignore them
. make sure symlinks always go in the same cache too
one of the last 2 must have been what trashed me inode blocks ~once
a month before, and looks like this was also what caused evanlangs
problems... at least my filesystems are now as solid as a rock, even
the one with /var/spool/news and the history if you know cnews... :)
Index: fsck/fsck.c
@@ -123,7 +123,6 @@
break;
case I_DIRECTORY:
- ndir++;
if(rip->i_size & (DSIZE*incr-1))
{
inerr("Partial Entry");
@@ -135,6 +134,18 @@
}
}
traverse_zones(pass1);
+ if (dirsparse) {
+ inerr("Sparse directory");
+ if(ask("Make regular?","Changed"))
+ {
+ rip->i_mode &= ~I_TYPE;
+ rip->i_mode |= I_REGULAR;
+ cdirty=1;
+ nreg++;
+ break;
+ }
+ }
+ ndir++;
trunc=0;
ist->flag|=I_DIR;
break;
@@ -404,6 +415,7 @@
if(trunc!=2) trunc=0; /* 2 means silently truncate (directory) */
done_trunc=0;
+ dirsparse=0;
for(i=0;i<NR_ZONE;i++)
if( (*func)(&rip->i_zone[i],(i<NDIR) ? 0 : (i-NDIR+1) ) )
@@ -468,7 +480,11 @@
return 1;
}
}
- else zonecount--;
+ else {
+ if (!*zone)
+ ++dirsparse;
+ zonecount--;
+ }
break;
case 1:
@@ -480,7 +496,11 @@
return 1;
}
}
- else indcount--;
+ else {
+ if (!*zone)
+ ++dirsparse;
+ indcount--;
+ }
break;
case 2:
@@ -492,7 +512,11 @@
return 1;
}
}
- else dindcount--;
+ else {
+ if (!*zone)
+ ++dirsparse;
+ dindcount--;
+ }
break;
}
}
Index: fsck/global.h
@@ -61,6 +61,7 @@
static d_inode *rip;
static d_inode zinode; /* zero inode */
static inode_stat *ist,*inode_status;
+static long dirsparse; /* to find sparse directories */
#endif
EXTERN long cino; /* current inode */
Index: minixfs/cache.c
@@ -343,6 +343,7 @@
{
int warned=0;
cache *p;
+ super_info *psblk;
for(p=syscache.start;p!=usrcache.end;p++)
if(p->drive==drv && p->status)
{
@@ -350,4 +351,13 @@
ALERT("Cache entry not written out when drive %c invalidated",drv+'A');
p->status=0;
}
+ psblk=super_ptr[drv];
+ if(psblk==DFS) return;
+
+ if(psblk->idirty)
+ ALERT("Inode bitmap not written out when drive %c invalidated",drv+'A');
+ if(psblk->zdirty)
+ ALERT("Zone bitmap not written out when drive %c invalidated",drv+'A');
+ psblk->idirty=0;
+ psblk->zdirty=0;
}
Index: minixfs/inode.c
@@ -127,7 +127,7 @@
char some,dirty;
super_info *psblk=super_ptr[drive];
char vers;
- cache_control *control = IS_DIR((*rip)) ? &syscache : &usrcache;
+ cache_control *control = (IS_DIR((*rip))||IS_SYM((*rip))) ? &syscache : &usrcache;
cache *p, *q, *guess = control->start;
vers=psblk->version;
/* Handle zones in inode first */
Index: minixfs/main.c
@@ -339,8 +339,13 @@
if(IS_DIR(rip)) {
void *p;
int dot=-1,dotdot=-1;
+#if 1
+ p=Kmalloc((unsigned long) (BLOCK_SIZE*((unsigned long) psblk->sblk.s_imap_blks+
+ psblk->sblk.s_zmap_blks)));
+#else
p=Kmalloc((unsigned) (BLOCK_SIZE*(psblk->sblk.s_imap_blks+
psblk->sblk.s_zmap_blks)));
+#endif
if(!p) {
DEBUG("No room for bitmaps");
Kfree(psblk);
Index: minixfs/zone.c
@@ -452,7 +452,16 @@
new_zone:
if (temp_zone && flag > 1)
{
+#if 1
+ cache_control *control = &usrcache;
+ if (IS_DIR((*rip))) {
+ ALERT("find_zone: Drive %d sparse dir!",drive);
+ control = &syscache;
+ }
+ tmp = cput_zone (temp_zone, drive, control);
+#else
tmp = cput_zone (temp_zone, drive, &usrcache);
+#endif
bzero (tmp->buffer, (size_t) BLOCK_SIZE);
}
return temp_zone;
@@ -534,7 +543,7 @@
rip=get_inode1(inum,drive,&status,NOGUESS);
/* Work out which cache to use */
- control = IS_DIR((*rip)) ? &syscache : &usrcache;
+ control = (IS_DIR((*rip))||IS_SYM((*rip))) ? &syscache : &usrcache;
if(pos==-1l) pos=rip->i_size; /* If pos==-1 append */
chunk=pos/BLOCK_SIZE;
@@ -592,7 +601,7 @@
rip=get_inode2(inum,drive,&status,NOGUESS);
/* Work out which cache to use */
- control = IS_DIR((*rip)) ? &syscache : &usrcache;
+ control = (IS_DIR((*rip))||IS_SYM((*rip))) ? &syscache : &usrcache;
if(pos==-1l) pos=rip->i_size; /* If pos==-1 append */
chunk=pos/BLOCK_SIZE;