Commit patch from Tor Egge to fix the "large filesystem restore" problem.

This appears to work for me in the old case, but I don't have large
enough filesystems to test the fix case.

Reported working by: karl@mcs.net
This commit is contained in:
Warner Losh 1998-07-28 18:50:01 +00:00
parent aa6db4230d
commit 49a3215509
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=37923

View File

@ -41,7 +41,7 @@
static char sccsid[] = "@(#)tape.c 8.9 (Berkeley) 5/1/95"; static char sccsid[] = "@(#)tape.c 8.9 (Berkeley) 5/1/95";
#endif #endif
static const char rcsid[] = static const char rcsid[] =
"$Id$"; "$Id: tape.c,v 1.13 1998/07/28 06:20:15 charnier Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -107,6 +107,8 @@ static void xtrmap __P((char *, long));
static void xtrmapskip __P((char *, long)); static void xtrmapskip __P((char *, long));
static void xtrskip __P((char *, long)); static void xtrskip __P((char *, long));
static int readmapflag;
/* /*
* Set up an input source * Set up an input source
*/ */
@ -681,7 +683,7 @@ getfile(fill, skip)
gettingfile++; gettingfile++;
loop: loop:
for (i = 0; i < spcl.c_count; i++) { for (i = 0; i < spcl.c_count; i++) {
if (spcl.c_addr[i]) { if (readmapflag || spcl.c_addr[i]) {
readtape(&buf[curblk++][0]); readtape(&buf[curblk++][0]);
if (curblk == fssize / TP_BSIZE) { if (curblk == fssize / TP_BSIZE) {
(*fill)((char *)buf, (long)(size > TP_BSIZE ? (*fill)((char *)buf, (long)(size > TP_BSIZE ?
@ -700,7 +702,7 @@ getfile(fill, skip)
} }
if ((size -= TP_BSIZE) <= 0) { if ((size -= TP_BSIZE) <= 0) {
for (i++; i < spcl.c_count; i++) for (i++; i < spcl.c_count; i++)
if (spcl.c_addr[i]) if (readmapflag || spcl.c_addr[i])
readtape(junk); readtape(junk);
break; break;
} }
@ -1098,6 +1100,7 @@ gethead(buf)
qcvt.val[0] = i; qcvt.val[0] = i;
buf->c_dinode.di_size = qcvt.qval; buf->c_dinode.di_size = qcvt.qval;
} }
readmapflag = 0;
switch (buf->c_type) { switch (buf->c_type) {
@ -1108,8 +1111,11 @@ gethead(buf)
*/ */
buf->c_inumber = 0; buf->c_inumber = 0;
buf->c_dinode.di_size = buf->c_count * TP_BSIZE; buf->c_dinode.di_size = buf->c_count * TP_BSIZE;
for (i = 0; i < buf->c_count; i++) if (buf->c_count > TP_NINDIR)
buf->c_addr[i]++; readmapflag = 1;
else
for (i = 0; i < buf->c_count; i++)
buf->c_addr[i]++;
break; break;
case TS_TAPE: case TS_TAPE:
@ -1190,7 +1196,7 @@ accthdr(header)
blks = 0; blks = 0;
if (header->c_type != TS_END) if (header->c_type != TS_END)
for (i = 0; i < header->c_count; i++) for (i = 0; i < header->c_count; i++)
if (header->c_addr[i] != 0) if (readmapflag || header->c_addr[i] != 0)
blks++; blks++;
predict = blks; predict = blks;
blksread = 0; blksread = 0;