From aa1b1e7f1a9c7201ba1ac4eb35921e2c9df26729 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Mon, 10 Jun 2002 14:04:59 +0000 Subject: [PATCH] Print out ext2 block number when dump encounters a read error. --- CHANGES | 10 +++++++++- compat/include/bsdcompat.h | 5 +++-- dump/dump.8.in | 17 ++++++++++++++++- dump/traverse.c | 22 ++++++++++++---------- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/CHANGES b/CHANGES index d1ad0fe..a4d1b44 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,13 @@ -$Id: CHANGES,v 1.180 2002/06/08 07:19:28 stelian Exp $ +$Id: CHANGES,v 1.181 2002/06/10 14:04:59 stelian Exp $ +Changes between versions 0.4b29 and 0.4b30 (released ????????????????) +====================================================================== + +1. Made dump print out the ext2 logical block number in case of a read + error, which can be given as an argument to debugfs' ncheck command, + in order to find out the affected inode. Added note about this + usage in dump's man page. + Changes between versions 0.4b28 and 0.4b29 (released June 8, 2002) ================================================================== diff --git a/compat/include/bsdcompat.h b/compat/include/bsdcompat.h index 881f505..16de840 100644 --- a/compat/include/bsdcompat.h +++ b/compat/include/bsdcompat.h @@ -5,7 +5,7 @@ * Stelian Pop , 1999-2000 * Stelian Pop - AlcĂ´ve , 2000-2002 * - * $Id: bsdcompat.h,v 1.16 2002/01/16 09:32:14 stelian Exp $ + * $Id: bsdcompat.h,v 1.17 2002/06/10 14:05:00 stelian Exp $ */ #include @@ -36,7 +36,8 @@ #define powerof2(x) ((((x)-1)&(x))==0) #define dbtob(b) ((unsigned)(b) << DEV_BSHIFT) -#define fsbtodb(sb,b) ((int)(((long long)b * EXT2_BLOCK_SIZE(sb->super)) / DEV_BSIZE)) +#define fsbtodb(sb,b) ((int)(((long long)(b) * EXT2_BLOCK_SIZE((sb)->super)) / DEV_BSIZE)) +#define dbtofsb(sb,b) ((int)(((long long)(b) * DEV_BSIZE) / EXT2_BLOCK_SIZE((sb)->super))) #define sblock fs #define fs_fsize fragsize diff --git a/dump/dump.8.in b/dump/dump.8.in index 455f8c0..ef41382 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.41 2002/06/05 13:29:15 stelian Exp $ +.\" $Id: dump.8.in,v 1.42 2002/06/10 14:05:00 stelian Exp $ .\" .Dd __DATE__ .Dt DUMP 8 @@ -568,6 +568,21 @@ on the filesystem are ignored. If noticing read errors is important, the output from dump can be parsed to look for lines that contain the text 'read error'. .Pp +When a read error occurs, +.Nm +prints out the corresponding physical disk block and sector number and the +ext2 logical block number. +It doesn't print out the corresponing file name or even the inode number. +The user has to use +.Xr debugfs 8 , +commands +.Pa ncheck +and +.Pa icheck +to translate the +.Pa ext2blk +number printed out by dump into an inode number, then into a file name. +.Pp Each reel requires a new process, so parent processes for reels already written just hang around until the entire tape is written. diff --git a/dump/traverse.c b/dump/traverse.c index 09bcded..cfa16b3 100644 --- a/dump/traverse.c +++ b/dump/traverse.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: traverse.c,v 1.46 2002/05/16 21:22:36 stelian Exp $"; + "$Id: traverse.c,v 1.47 2002/06/10 14:05:00 stelian Exp $"; #endif /* not lint */ #include @@ -51,6 +51,7 @@ static const char rcsid[] = #include #include #endif +#include #include #include @@ -1278,7 +1279,6 @@ void bread(daddr_t blkno, char *buf, int size) { int cnt, i; - extern int errno; loop: #ifdef __linux__ @@ -1306,11 +1306,12 @@ loop: goto loop; } if (cnt == -1) - msg("read error from %s: %s: [block %d]: count=%d\n", - disk, strerror(errno), blkno, size); + msg("read error from %s: %s: [block %d, ext2blk %d]: count=%d\n", + disk, strerror(errno), blkno, + dbtofsb(sblock, blkno), size); else - msg("short read error from %s: [block %d]: count=%d, got=%d\n", - disk, blkno, size, cnt); + msg("short read error from %s: [block %d, ext2blk %d]: count=%d, got=%d\n", + disk, blkno, dbtofsb(sblock, blkno), size, cnt); if (++breaderrors > breademax) { msg("More than %d block read errors from %d\n", breademax, disk); @@ -1338,11 +1339,12 @@ loop: if ((cnt = read(diskfd, buf, (int)dev_bsize)) == dev_bsize) continue; if (cnt == -1) { - msg("read error from %s: %s: [sector %d]: count=%d\n", - disk, strerror(errno), blkno, dev_bsize); + msg("read error from %s: %s: [sector %d, ext2blk %d]: count=%d\n", + disk, strerror(errno), blkno, + dbtofsb(sblock, blkno), dev_bsize); continue; } - msg("short read error from %s: [sector %d]: count=%d, got=%d\n", - disk, blkno, dev_bsize, cnt); + msg("short read error from %s: [sector %d, ext2blk %d]: count=%d, got=%d\n", + disk, blkno, dbtofsb(sblock, blkno), dev_bsize, cnt); } } -- 2.39.2