From aca7d867ae18bd62627f16ef90e58b433b881056 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Wed, 28 Mar 2001 12:59:48 +0000 Subject: [PATCH] Correction of block estimate. Added EXT2_RESIZE_INO to the dump exclusion list Added block count in rmt debug. Minor cleanups. --- dump/dump.8.in | 6 +++--- dump/main.c | 23 ++++++++++++++--------- dump/tape.c | 6 +++--- dump/traverse.c | 17 ++++++++++++----- rmt/rmt.c | 13 +++++++++---- 5 files changed, 41 insertions(+), 24 deletions(-) diff --git a/dump/dump.8.in b/dump/dump.8.in index 8365856..52b8713 100644 --- a/dump/dump.8.in +++ b/dump/dump.8.in @@ -30,7 +30,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dump.8.in,v 1.23 2001/03/23 14:40:12 stelian Exp $ +.\" $Id: dump.8.in,v 1.24 2001/03/28 12:59:48 stelian Exp $ .\" .Dd __DATE__ .Dt DUMP 8 @@ -112,7 +112,7 @@ copy all files new or modified since the last dump of a lower level. The default level is 9. .It Fl B Ar records -The number of 1 KB blocks per volume. +The number of 1 kB blocks per volume. This option overrides the end-of-media detection, and calculation of tape size based on length and density. .It Fl a @@ -126,7 +126,7 @@ existing tape, or using a tape drive with hardware compression .It Fl b Ar blocksize The number of kilobytes per dump record. Since the IO system slices all requests into chunks of MAXBSIZE -(typically 64KB), it is not possible to use a larger blocksize +(typically 64kB), it is not possible to use a larger blocksize without having problems later with .Xr restore 8 . Therefore diff --git a/dump/main.c b/dump/main.c index 1358576..b032334 100644 --- a/dump/main.c +++ b/dump/main.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.40 2001/03/23 14:40:12 stelian Exp $"; + "$Id: main.c,v 1.41 2001/03/28 12:59:48 stelian Exp $"; #endif /* not lint */ #include @@ -596,12 +596,12 @@ main(int argc, char *argv[]) } if (sizest) { - printf("%.0f\n", ((double)tapesize + 11) * TP_BSIZE); + printf("%.0f\n", ((double)tapesize + 1 + ntrec) * TP_BSIZE); exit(X_FINOK); } /* stop here for size estimate */ if (pipeout || unlimited) { - tapesize += 11; /* 10 trailer blocks + 1 map header */ + tapesize += 1 + ntrec; /* 1 map header + trailer blocks */ msg("estimated %ld tape blocks.\n", tapesize); } else { double fetapes; @@ -641,7 +641,7 @@ main(int argc, char *argv[]) /* count the dumped inodes map on each additional tape */ tapesize += (etapes - 1) * (howmany(mapsize * sizeof(char), TP_BSIZE) + 1); - tapesize += etapes + 10; /* headers + 10 trailer blks */ + tapesize += etapes + ntrec; /* headers + trailer blks */ msg("estimated %ld tape blocks on %3.2f tape(s).\n", tapesize, fetapes); } @@ -700,8 +700,8 @@ main(int argc, char *argv[]) continue; #ifdef __linux__ /* - * No need to check here for deleted and not yes reallocated inodes - * since this is done in dumpino(). + * No need to check here for deleted and not yet reallocated + * inodes since this is done in dumpino(). */ #endif (void)dumpino(dp, ino); @@ -709,7 +709,12 @@ main(int argc, char *argv[]) tend_writing = time(NULL); spcl.c_type = TS_END; - for (i = 0; i < ntrec; i++) + /* + * Finish off the current tape record with trailer blocks, to ensure + * at least the data in the last partial record makes it to tape. + * Also make sure we write at least 1 trailer block. + */ + for (i = ntrec - (spcl.c_tapea % ntrec); i; --i) writeheader(maxino - 1); tnow = trewind(); @@ -723,7 +728,7 @@ main(int argc, char *argv[]) ((double)spcl.c_tapea * TP_BSIZE / 1048576), spcl.c_volume); - /* report dump performance, avoid division through zero */ + /* report dump performance, avoid division by zero */ if (tend_writing - tstart_writing == 0) msg("finished in less than a second\n"); else @@ -740,7 +745,7 @@ main(int argc, char *argv[]) if (compressed) { long tapekb = bytes_written / 1024; double rate = .0005 + (double) spcl.c_tapea / tapekb; - msg("Wrote %ldkB uncompressed, %ldKB compressed, %1.3f:1\n", + msg("Wrote %ldkB uncompressed, %ldkB compressed, %1.3f:1\n", spcl.c_tapea, tapekb, rate); } diff --git a/dump/tape.c b/dump/tape.c index 2390c86..890c77b 100644 --- a/dump/tape.c +++ b/dump/tape.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.39 2001/03/23 14:40:12 stelian Exp $"; + "$Id: tape.c,v 1.40 2001/03/28 12:59:48 stelian Exp $"; #endif /* not lint */ #include @@ -303,7 +303,7 @@ do_stats(void) xferrate += txfrate; if (compressed) { double rate = .0005 + (double) blocks / (double) volkb; - msg("Volume %d %ldKB uncompressed, %ldkB compressed," + msg("Volume %d %ldkB uncompressed, %ldkB compressed," " %1.3f:1\n", tapeno, blocks, volkb, rate); } @@ -327,7 +327,7 @@ mktimeest(time_t tnow) / blockswritten * tapesize; if (tnow > tstart_volume) (void)snprintf(msgbuf, sizeof(msgbuf), - "%3.2f%% done at %ld KB/s, finished in %d:%02d\n", + "%3.2f%% done at %ld kB/s, finished in %d:%02d\n", (blockswritten * 100.0) / tapesize, (spcl.c_tapea - tapea_volume) / (tnow - tstart_volume), (int)(deltat / 3600), (int)((deltat % 3600) / 60)); diff --git a/dump/traverse.c b/dump/traverse.c index ebf605a..c4e1e9a 100644 --- a/dump/traverse.c +++ b/dump/traverse.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: traverse.c,v 1.30 2001/03/23 14:40:12 stelian Exp $"; + "$Id: traverse.c,v 1.31 2001/03/28 12:59:48 stelian Exp $"; #endif /* not lint */ #include @@ -128,6 +128,9 @@ typedef ino_t ext2_ino_t; #define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT3_FEATURE_INCOMPAT_RECOVER | \ EXT2_FEATURE_INCOMPAT_FILETYPE) #endif +#ifndef EXT2_RESIZE_INO +#define EXT2_RESIZE_INO 7 +#endif int dump_fs_open(const char *disk, ext2_filsys *fs) { @@ -152,12 +155,16 @@ int dump_fs_open(const char *disk, ext2_filsys *fs) retval = EXT2_ET_UNSUPP_FEATURE; ext2fs_close(*fs); } - else if (es->s_feature_compat & + else { + if (es->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL && journal_ino && !exclude_ino(journal_ino)) { - iexclude_list[iexclude_num++] = journal_ino; - msg("Added ext3 journal inode %u to exclude list\n", - journal_ino); + iexclude_list[iexclude_num++] = journal_ino; + msg("Exclude ext3 journal inode %u\n", + journal_ino); + } + if (!exclude_ino(EXT2_RESIZE_INO)) + iexclude_list[iexclude_num++] = EXT2_RESIZE_INO; } } return retval; diff --git a/rmt/rmt.c b/rmt/rmt.c index d1f801f..64fc4ab 100644 --- a/rmt/rmt.c +++ b/rmt/rmt.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: rmt.c,v 1.12 2000/12/21 11:14:54 stelian Exp $"; + "$Id: rmt.c,v 1.13 2001/03/28 12:59:49 stelian Exp $"; #endif /* not linux */ /* @@ -87,6 +87,7 @@ main(int argc, char *argv[]) int rval = 0; char c; int n, i, cc; + unsigned long block = 0; argc--, argv++; if (argc > 0) { @@ -116,14 +117,16 @@ top: tape = open(device, atoi(filemode), 0666); if (tape < 0) goto ioerror; + block = 0; goto respond; case 'C': - DEBUG("rmtd: C\n"); + DEBUG1("rmtd: C (%lu blocks)\n", block); getstring(device); /* discard */ if (close(tape) < 0) goto ioerror; tape = -1; + block = 0; goto respond; case 'L': @@ -138,7 +141,7 @@ top: case 'W': getstring(count); n = atoi(count); - DEBUG1("rmtd: W %s\n", count); + DEBUG2("rmtd: W %s (block = %lu)\n", count, block); record = checkbuf(record, n); for (i = 0; i < n; i += cc) { cc = read(0, &record[i], n - i); @@ -150,11 +153,12 @@ top: rval = write(tape, record, n); if (rval < 0) goto ioerror; + block += n >> 10; goto respond; case 'R': getstring(count); - DEBUG1("rmtd: R %s\n", count); + DEBUG2("rmtd: R %s (block %lu)\n", count, block); n = atoi(count); record = checkbuf(record, n); rval = read(tape, record, n); @@ -163,6 +167,7 @@ top: (void)sprintf(resp, "A%d\n", rval); (void)write(1, resp, strlen(resp)); (void)write(1, record, rval); + block += n >> 10; goto top; case 'I': -- 2.39.5