]> git.wh0rd.org - dump.git/commitdiff
Correction of block estimate.
authorStelian Pop <stelian@popies.net>
Wed, 28 Mar 2001 12:59:48 +0000 (12:59 +0000)
committerStelian Pop <stelian@popies.net>
Wed, 28 Mar 2001 12:59:48 +0000 (12:59 +0000)
Added EXT2_RESIZE_INO to the dump exclusion list
Added block count in rmt debug.
Minor cleanups.

dump/dump.8.in
dump/main.c
dump/tape.c
dump/traverse.c
rmt/rmt.c

index 836585614481ef0e26d65194b613cf5ce82635f0..52b8713a98ae8ea4f5796af3ce05588aed03bf97 100644 (file)
@@ -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
index 1358576a15a488977b53102e3905600b306d4b16..b032334d22ebd824dfb19d88d5455cc716877c9d 100644 (file)
@@ -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 <config.h>
@@ -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);
        }
 
index 2390c860bbdd8b0f14905dd78c69aa150e770581..890c77b8e3ed6f93d53412706ddd09fe56e2a15e 100644 (file)
@@ -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 <config.h>
@@ -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));
index ebf605abe47edf3f2c6b382e3a7dbb1d0fba70b7..c4e1e9ab0dde48fe1ab28bb3d7aa1dfd46f3b47b 100644 (file)
@@ -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 <config.h>
@@ -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;
index d1f801fbf9be7f7e8c8dfb1e6b624f2a7cf23c73..64fc4ab023b2fce60c4352e57caa4e1a38f508f6 100644 (file)
--- 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':