From c5e38bc12e0a29762e7a4561c815ab8a7c8ade56 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Wed, 28 Apr 2010 09:29:35 +0000 Subject: [PATCH] Bump estimate blocks to long long to cope with huge dumps. --- CHANGES | 6 +++++- dump/dump.h | 12 ++++++------ dump/main.c | 10 +++++----- dump/traverse.c | 22 +++++++++++----------- 4 files changed, 27 insertions(+), 23 deletions(-) diff --git a/CHANGES b/CHANGES index b31b75a..088e5bb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.310 2010/03/22 16:08:10 stelian Exp $ +$Id: CHANGES,v 1.311 2010/04/28 09:29:35 stelian Exp $ Changes between versions 0.4b42 and 0.4b43 (released ?????????????) =================================================================== @@ -39,6 +39,10 @@ Changes between versions 0.4b42 and 0.4b43 (released ?????????????) Brière for the bug report and the associated patch. +9. Fix progress/estimated blocks display in dump when doing really + huge backups. Thanks to Steve Bonds + for the bug report and tests. (Sourceforge bug #2987758) + Changes between versions 0.4b41 and 0.4b42 (released June 18, 2009) =================================================================== diff --git a/dump/dump.h b/dump/dump.h index fafd4c3..f26d12b 100644 --- a/dump/dump.h +++ b/dump/dump.h @@ -5,7 +5,7 @@ * Stelian Pop , 1999-2000 * Stelian Pop - Alcôve , 2000-2002 * - * $Id: dump.h,v 1.49 2004/07/01 09:14:49 stelian Exp $ + * $Id: dump.h,v 1.50 2010/04/28 09:29:50 stelian Exp $ */ /*- @@ -91,7 +91,7 @@ extern int fifoout; /* true => output to fifo */ extern dump_ino_t curino; /* current inumber; used globally */ extern int newtape; /* new tape flag */ extern int density; /* density in 0.1" units */ -extern long tapesize; /* estimated tape size, blocks */ +extern long long tapesize; /* estimated tape size, blocks */ extern long tsize; /* tape size in 0.1" units */ extern long asize; /* number of 0.1" units written on current tape */ extern int etapes; /* estimated number of tapes */ @@ -148,12 +148,12 @@ time_t unctime __P((const char *str)); /* mapping rouintes */ struct dinode; long blockest __P((struct dinode const *dp)); -int mapfiles __P((dump_ino_t maxino, long *tapesize)); +int mapfiles __P((dump_ino_t maxino, long long *tapesize)); #ifdef __linux__ -int mapfilesfromdir __P((dump_ino_t maxino, long *tapesize, char *directory)); -int maponefile __P((dump_ino_t maxino, long *tapesize, char *directory)); +int mapfilesfromdir __P((dump_ino_t maxino, long long *tapesize, char *directory)); +int maponefile __P((dump_ino_t maxino, long long *tapesize, char *directory)); #endif -int mapdirs __P((dump_ino_t maxino, long *tapesize)); +int mapdirs __P((dump_ino_t maxino, long long *tapesize)); /* file dumping routines */ void blksout __P((blk_t *blkp, int frags, dump_ino_t ino)); diff --git a/dump/main.c b/dump/main.c index 74ca0be..ae3e3ca 100644 --- a/dump/main.c +++ b/dump/main.c @@ -37,7 +37,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.96 2009/07/23 09:34:07 stelian Exp $"; + "$Id: main.c,v 1.97 2010/04/28 09:29:50 stelian Exp $"; #endif /* not lint */ #include @@ -123,7 +123,7 @@ int fifoout; /* true => output to fifo */ dump_ino_t curino; /* current inumber; used globally */ int newtape; /* new tape flag */ int density; /* density in 0.1" units */ -long tapesize; /* estimated tape size, blocks */ +long long tapesize; /* estimated tape size, blocks */ long tsize; /* tape size in 0.1" units */ long asize; /* number of 0.1" units written on current tape */ int etapes; /* estimated number of tapes */ @@ -869,12 +869,12 @@ main(int argc, char *argv[]) if (pipeout || unlimited) { tapesize += 1 + ntrec; /* 1 map header + trailer blocks */ - msg("estimated %ld blocks.\n", tapesize); + msg("estimated %lld blocks.\n", tapesize); } else { double fetapes; if (blocksperfiles) { - long tapesize_left; + long long tapesize_left; tapesize_left = tapesize; fetapes = 0; @@ -921,7 +921,7 @@ main(int argc, char *argv[]) tapesize += (etapes - 1) * (howmany(mapsize * sizeof(char), TP_BSIZE) + 1); tapesize += etapes + ntrec; /* headers + trailer blks */ - msg("estimated %ld blocks on %3.2f tape(s).\n", + msg("estimated %lld blocks on %3.2f tape(s).\n", tapesize, fetapes); } diff --git a/dump/traverse.c b/dump/traverse.c index 1889218..491d43a 100644 --- a/dump/traverse.c +++ b/dump/traverse.c @@ -37,7 +37,7 @@ #ifndef lint static const char rcsid[] = - "$Id: traverse.c,v 1.68 2010/03/22 15:40:55 stelian Exp $"; + "$Id: traverse.c,v 1.69 2010/04/28 09:29:50 stelian Exp $"; #endif /* not lint */ #include @@ -99,7 +99,7 @@ static int dirindir __P((dump_ino_t ino, daddr_t blkno, int level, long *size)); static void dmpindir __P((dump_ino_t ino, daddr_t blk, int level, fsizeT *size)); static int searchdir __P((dump_ino_t ino, daddr_t blkno, long size, long filesize)); #endif -static void mapfileino __P((dump_ino_t ino, struct dinode const *dp, long *tapesize, int *dirskipped)); +static void mapfileino __P((dump_ino_t ino, struct dinode const *dp, long long *tapesize, int *dirskipped)); static void dump_xattr __P((dump_ino_t ino, struct dinode *dp)); #ifdef HAVE_EXT2_JOURNAL_INUM @@ -260,7 +260,7 @@ blockest(struct dinode const *dp) * copy of the given inode, or be NULL (in which case it is fetched.) */ static void -mapfileino(dump_ino_t ino, struct dinode const *dp, long *tapesize, int *dirskipped) +mapfileino(dump_ino_t ino, struct dinode const *dp, long long *tapesize, int *dirskipped) { int mode; @@ -315,7 +315,7 @@ mapfileino(dump_ino_t ino, struct dinode const *dp, long *tapesize, int *dirskip */ #ifdef __linux__ int -mapfiles(UNUSED(dump_ino_t maxino), long *tapesize) +mapfiles(UNUSED(dump_ino_t maxino), long long *tapesize) { ext2_ino_t ino; int anydirskipped = 0; @@ -359,7 +359,7 @@ mapfiles(UNUSED(dump_ino_t maxino), long *tapesize) } #else int -mapfiles(dump_ino_t maxino, long *tapesize) +mapfiles(dump_ino_t maxino, long long *tapesize) { dump_ino_t ino; int anydirskipped = 0; @@ -378,7 +378,7 @@ mapfiles(dump_ino_t maxino, long *tapesize) #ifdef __linux__ int -maponefile(UNUSED(dump_ino_t maxino), long *tapesize, char *directory) +maponefile(UNUSED(dump_ino_t maxino), long long *tapesize, char *directory) { errcode_t retval; ext2_ino_t dir_ino; @@ -426,7 +426,7 @@ maponefile(UNUSED(dump_ino_t maxino), long *tapesize, char *directory) #ifdef __linux__ struct mapfile_context { - long *tapesize; + long long *tapesize; int *anydirskipped; }; @@ -468,7 +468,7 @@ mapfilesindir(struct ext2_dir_entry *dirent, UNUSED(int offset), * the directories in the filesystem. */ int -mapfilesfromdir(UNUSED(dump_ino_t maxino), long *tapesize, char *directory) +mapfilesfromdir(UNUSED(dump_ino_t maxino), long long *tapesize, char *directory) { errcode_t retval; struct mapfile_context mfc; @@ -530,7 +530,7 @@ mapfilesfromdir(UNUSED(dump_ino_t maxino), long *tapesize, char *directory) struct mapdirs_context { int *ret; int nodump; - long *tapesize; + long long *tapesize; }; #endif @@ -547,7 +547,7 @@ struct mapdirs_context { * pass using this algorithm. */ int -mapdirs(dump_ino_t maxino, long *tapesize) +mapdirs(dump_ino_t maxino, long long *tapesize) { struct dinode *dp; int isdir; @@ -672,7 +672,7 @@ searchdir(struct ext2_dir_entry *dp, UNUSED(int offset), { struct mapdirs_context *mdc; int *ret; - long *tapesize; + long long *tapesize; struct dinode *ip; mdc = (struct mapdirs_context *)private; -- 2.39.5