]> git.wh0rd.org - dump.git/commitdiff
Print out ext2 block number when dump encounters a read error.
authorStelian Pop <stelian@popies.net>
Mon, 10 Jun 2002 14:04:59 +0000 (14:04 +0000)
committerStelian Pop <stelian@popies.net>
Mon, 10 Jun 2002 14:04:59 +0000 (14:04 +0000)
CHANGES
compat/include/bsdcompat.h
dump/dump.8.in
dump/traverse.c

diff --git a/CHANGES b/CHANGES
index d1ad0fea00f98340049c08cebe144073696baeda..a4d1b44a8e22c5109278914126c513e9a6f4ce9f 100644 (file)
--- 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)
 ==================================================================
 
index 881f50582b725fb65987aa08e0b7b58483740751..16de840c73d8531be3ee97aa5d1707911b21a1bd 100644 (file)
@@ -5,7 +5,7 @@
  *     Stelian Pop <stelian@popies.net>, 1999-2000
  *     Stelian Pop <stelian@popies.net> - AlcĂ´ve <www.alcove.com>, 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 <config.h>
@@ -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
index 455f8c0bdf5d7ddfc15eb57945b8ca5f7e542b0d..ef41382582b7473296f7f8265b177f2e630dbc62 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.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.
index 09bcded2f35e22e261255596253205179e889a4f..cfa16b339871f01eea497ddbe626f052c2b126e4 100644 (file)
@@ -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 <config.h>
@@ -51,6 +51,7 @@ static const char rcsid[] =
 #include <string.h>
 #include <unistd.h>
 #endif
+#include <errno.h>
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -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);
        }
 }