Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/lfs improve some panic messages



details:   https://anonhg.NetBSD.org/src/rev/14cdee9caf66
branches:  trunk
changeset: 341122:14cdee9caf66
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Oct 19 04:21:48 2015 +0000

description:
improve some panic messages

diffstat:

 sys/ufs/lfs/lfs_accessors.h |  13 ++++++++-----
 sys/ufs/lfs/lfs_segment.c   |  16 +++++++++++-----
 2 files changed, 19 insertions(+), 10 deletions(-)

diffs (74 lines):

diff -r d052569c5996 -r 14cdee9caf66 sys/ufs/lfs/lfs_accessors.h
--- a/sys/ufs/lfs/lfs_accessors.h       Mon Oct 19 02:47:05 2015 +0000
+++ b/sys/ufs/lfs/lfs_accessors.h       Mon Oct 19 04:21:48 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_accessors.h,v 1.38 2015/10/15 06:24:21 dholland Exp $      */
+/*     $NetBSD: lfs_accessors.h,v 1.39 2015/10/19 04:21:48 dholland Exp $      */
 
 /*  from NetBSD: lfs.h,v 1.165 2015/07/24 06:59:32 dholland Exp  */
 /*  from NetBSD: dinode.h,v 1.22 2013/01/22 09:39:18 dholland Exp  */
@@ -671,7 +671,8 @@
        if ((_e = bread((F)->lfs_ivnode,                                \
            ((IN) / lfs_sb_getsepb(F)) + lfs_sb_getcleansz(F),          \
            lfs_sb_getbsize(F), 0, &(BP))) != 0)                        \
-               panic("lfs: ifile read: %d", _e);                       \
+               panic("lfs: ifile read: segentry %llu: error %d\n",     \
+                        (unsigned long long)(IN), _e);                 \
        if (lfs_sb_getversion(F) == 1)                                  \
                (SP) = (SEGUSE *)((SEGUSE_V1 *)(BP)->b_data +           \
                        ((IN) & (lfs_sb_getsepb(F) - 1)));              \
@@ -933,11 +934,13 @@
 
 /* Read in the block with the cleaner info from the ifile. */
 #define LFS_CLEANERINFO(CP, F, BP) do {                                        \
+       int _e;                                                         \
        SHARE_IFLOCK(F);                                                \
        VTOI((F)->lfs_ivnode)->i_flag |= IN_ACCESS;                     \
-       if (bread((F)->lfs_ivnode,                                      \
-           (daddr_t)0, lfs_sb_getbsize(F), 0, &(BP)))                  \
-               panic("lfs: ifile read");                               \
+       _e = bread((F)->lfs_ivnode,                                     \
+           (daddr_t)0, lfs_sb_getbsize(F), 0, &(BP));                  \
+       if (_e)                                                         \
+               panic("lfs: ifile read: cleanerinfo: error %d\n", _e);  \
        (CP) = (CLEANERINFO *)(BP)->b_data;                             \
        UNSHARE_IFLOCK(F);                                              \
 } while (0)
diff -r d052569c5996 -r 14cdee9caf66 sys/ufs/lfs/lfs_segment.c
--- a/sys/ufs/lfs/lfs_segment.c Mon Oct 19 02:47:05 2015 +0000
+++ b/sys/ufs/lfs/lfs_segment.c Mon Oct 19 04:21:48 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_segment.c,v 1.262 2015/10/10 22:34:33 dholland Exp $       */
+/*     $NetBSD: lfs_segment.c,v 1.263 2015/10/19 04:21:48 dholland Exp $       */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.262 2015/10/10 22:34:33 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.263 2015/10/19 04:21:48 dholland Exp $");
 
 #ifdef DEBUG
 # define vndebug(vp, str) do {                                         \
@@ -680,10 +680,16 @@
                segleft = lfs_sb_getnseg(fs);
                curseg = 0;
                for (n = 0; n < lfs_sb_getsegtabsz(fs); n++) {
+                       int bread_error;
+
                        dirty = 0;
-                       if (bread(fs->lfs_ivnode, lfs_sb_getcleansz(fs) + n,
-                           lfs_sb_getbsize(fs), B_MODIFY, &bp))
-                               panic("lfs_segwrite: ifile read");
+                       bread_error = bread(fs->lfs_ivnode,
+                           lfs_sb_getcleansz(fs) + n,
+                           lfs_sb_getbsize(fs), B_MODIFY, &bp);
+                       if (bread_error)
+                               panic("lfs_segwrite: ifile read: "
+                                     "seguse %u: error %d\n",
+                                     n, bread_error);
                        segusep = (SEGUSE *)bp->b_data;
                        maxseg = min(segleft, lfs_sb_getsepb(fs));
                        for (i = 0; i < maxseg; i++) {



Home | Main Index | Thread Index | Old Index