]> err.no Git - linux-2.6/commitdiff
[XFS] Portability changes: remove prdev, stick to one diagnostic
authorNathan Scott <nathans@sgi.com>
Fri, 9 Jun 2006 05:29:40 +0000 (15:29 +1000)
committerNathan Scott <nathans@sgi.com>
Fri, 9 Jun 2006 05:29:40 +0000 (15:29 +1000)
interface.

SGI-PV: 953338
SGI-Modid: xfs-linux-melb:xfs-kern:26103a

Signed-off-by: Nathan Scott <nathans@sgi.com>
fs/xfs/support/debug.c
fs/xfs/support/debug.h
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_inode.c
fs/xfs/xfs_log_recover.c
fs/xfs/xfs_mount.c
fs/xfs/xfs_rtalloc.c
fs/xfs/xfs_trans_buf.c
fs/xfs/xfs_trans_item.c
fs/xfs/xfs_vfsops.c

index b08b3d9345b7660972cb341fb876ac1ba77cb52c..36fbeccdc722c27a5492076fad587b13f98d5e8c 100644 (file)
@@ -47,7 +47,7 @@ cmn_err(register int level, char *fmt, ...)
        va_start(ap, fmt);
        if (*fmt == '!') fp++;
        len = vsprintf(message, fp, ap);
-       if (message[len-1] != '\n')
+       if (level != CE_DEBUG && message[len-1] != '\n')
                strcat(message, "\n");
        printk("%s%s", err_level[level], message);
        va_end(ap);
@@ -68,7 +68,7 @@ icmn_err(register int level, char *fmt, va_list ap)
                level = XFS_MAX_ERR_LEVEL;
        spin_lock_irqsave(&xfs_err_lock,flags);
        len = vsprintf(message, fmt, ap);
-       if (message[len-1] != '\n')
+       if (level != CE_DEBUG && message[len-1] != '\n')
                strcat(message, "\n");
        spin_unlock_irqrestore(&xfs_err_lock,flags);
        printk("%s%s", err_level[level], message);
index e3bf58112e7ec3492cbe4be9fd546b39a59cbbff..4f54dca662a89ca646f9ff27a51d129a1c42a4de 100644 (file)
@@ -33,9 +33,6 @@ extern void cmn_err(int, char *, ...)
        __attribute__ ((format (printf, 2, 3)));
 extern void assfail(char *expr, char *f, int l);
 
-#define prdev(fmt,targ,args...) \
-       printk("Device %s - " fmt "\n", XFS_BUFTARG_NAME(targ), ## args)
-
 #define ASSERT_ALWAYS(expr)    \
        (unlikely((expr) != 0) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
 
index 59013e1f16e586a825a85e8c0dda79ab35a16b0b..290912cbff6391a6426a8e274f7c6f7326e0df9e 100644 (file)
@@ -1030,9 +1030,9 @@ xfs_buf_iodone_callbacks(
                if ((XFS_BUF_TARGET(bp) != lasttarg) ||
                    (time_after(jiffies, (lasttime + 5*HZ)))) {
                        lasttime = jiffies;
-                       prdev("XFS write error in file system meta-data "
-                             "block 0x%llx in %s",
-                             XFS_BUF_TARGET(bp),
+                       cmn_err(CE_ALERT, "Device %s, XFS metadata write error"
+                                       " block 0x%llx in %s",
+                               XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)),
                              (__uint64_t)XFS_BUF_ADDR(bp), mp->m_fsname);
                }
                lasttarg = XFS_BUF_TARGET(bp);
index b30bffa99edc34042ebe5446a8684fc39d016436..50119a00885baf2253562894af16ebdf8467d85e 100644 (file)
@@ -352,8 +352,9 @@ xfs_itobp(
                if (unlikely(XFS_TEST_ERROR(!di_ok, mp, XFS_ERRTAG_ITOBP_INOTOBP,
                                 XFS_RANDOM_ITOBP_INOTOBP))) {
 #ifdef DEBUG
-                       prdev("bad inode magic/vsn daddr %lld #%d (magic=%x)",
-                               mp->m_ddev_targp,
+                       cmn_err(CE_ALERT, "Device %s - bad inode magic/vsn "
+                                         "daddr %lld #%d (magic=%x)",
+                               XFS_BUFTARG_NAME(mp->m_ddev_targp),
                                (unsigned long long)imap.im_blkno, i,
                                INT_GET(dip->di_core.di_magic, ARCH_CONVERT));
 #endif
index a17218e815366137a8ca5e133d63f335cfb3f14a..f952f9dbf74a5f80518dac9413b6e531e348f940 100644 (file)
@@ -193,14 +193,14 @@ xlog_header_check_dump(
 {
        int                     b;
 
-       printk("%s:  SB : uuid = ", __FUNCTION__);
+       cmn_err(CE_DEBUG, "%s:  SB : uuid = ", __FUNCTION__);
        for (b = 0; b < 16; b++)
-               printk("%02x",((unsigned char *)&mp->m_sb.sb_uuid)[b]);
-       printk(", fmt = %d\n", XLOG_FMT);
-       printk("    log : uuid = ");
+               cmn_err(CE_DEBUG, "%02x", ((uchar_t *)&mp->m_sb.sb_uuid)[b]);
+       cmn_err(CE_DEBUG, ", fmt = %d\n", XLOG_FMT);
+       cmn_err(CE_DEBUG, "    log : uuid = ");
        for (b = 0; b < 16; b++)
-               printk("%02x",((unsigned char *)&head->h_fs_uuid)[b]);
-       printk(", fmt = %d\n", INT_GET(head->h_fmt, ARCH_CONVERT));
+               cmn_err(CE_DEBUG, "%02x",((uchar_t *)&head->h_fs_uuid)[b]);
+       cmn_err(CE_DEBUG, ", fmt = %d\n", INT_GET(head->h_fmt, ARCH_CONVERT));
 }
 #else
 #define xlog_header_check_dump(mp, head)
@@ -3444,13 +3444,13 @@ xlog_unpack_data_checksum(
            if (rhead->h_chksum ||
                ((log->l_flags & XLOG_CHKSUM_MISMATCH) == 0)) {
                    cmn_err(CE_DEBUG,
-                       "XFS: LogR chksum mismatch: was (0x%x) is (0x%x)",
+                       "XFS: LogR chksum mismatch: was (0x%x) is (0x%x)\n",
                            INT_GET(rhead->h_chksum, ARCH_CONVERT), chksum);
                    cmn_err(CE_DEBUG,
 "XFS: Disregard message if filesystem was created with non-DEBUG kernel");
                    if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) {
                            cmn_err(CE_DEBUG,
-                               "XFS: LogR this is a LogV2 filesystem");
+                               "XFS: LogR this is a LogV2 filesystem\n");
                    }
                    log->l_flags |= XLOG_CHKSUM_MISMATCH;
            }
@@ -3999,7 +3999,7 @@ xlog_recover_finish(
                log->l_flags &= ~XLOG_RECOVERY_NEEDED;
        } else {
                cmn_err(CE_DEBUG,
-                       "!Ending clean XFS mount for filesystem: %s",
+                       "!Ending clean XFS mount for filesystem: %s\n",
                        log->l_mp->m_fsname);
        }
        return 0;
index 4b7be49cc4de3a81066cf133c30e367f697489ff..9378408a69d50f3b1e8acd289aec82142662bb84 100644 (file)
@@ -1006,8 +1006,9 @@ xfs_mountfs(
 
        if (unlikely((rip->i_d.di_mode & S_IFMT) != S_IFDIR)) {
                cmn_err(CE_WARN, "XFS: corrupted root inode");
-               prdev("Root inode %llu is not a directory",
-                     mp->m_ddev_targp, (unsigned long long)rip->i_ino);
+               cmn_err(CE_WARN, "Device %s - root %llu is not a directory",
+                       XFS_BUFTARG_NAME(mp->m_ddev_targp),
+                       (unsigned long long)rip->i_ino);
                xfs_iunlock(rip, XFS_ILOCK_EXCL);
                XFS_ERROR_REPORT("xfs_mountfs_int(2)", XFS_ERRLEVEL_LOW,
                                 mp);
index f5944c8b37884c8e15a989d33b21233ed8dc224a..af290cf37ac1efbc7e06787cec091b1a97914105 100644 (file)
@@ -2404,10 +2404,10 @@ xfs_rtprint_range(
 {
        xfs_extlen_t    i;              /* block number in the extent */
 
-       printk("%Ld: ", (long long)start);
+       cmn_err(CE_DEBUG, "%Ld: ", (long long)start);
        for (i = 0; i < len; i++)
-               printk("%d", xfs_rtcheck_bit(mp, tp, start + i, 1));
-       printk("\n");
+               cmn_err(CE_DEBUG, "%d", xfs_rtcheck_bit(mp, tp, start + i, 1));
+       cmn_err(CE_DEBUG, "\n");
 }
 
 /*
@@ -2431,17 +2431,17 @@ xfs_rtprint_summary(
                        (void)xfs_rtget_summary(mp, tp, l, i, &sumbp, &sb, &c);
                        if (c) {
                                if (!p) {
-                                       printk("%Ld-%Ld:", 1LL << l,
+                                       cmn_err(CE_DEBUG, "%Ld-%Ld:", 1LL << l,
                                                XFS_RTMIN((1LL << l) +
                                                          ((1LL << l) - 1LL),
                                                         mp->m_sb.sb_rextents));
                                        p = 1;
                                }
-                               printk(" %Ld:%d", (long long)i, c);
+                               cmn_err(CE_DEBUG, " %Ld:%d", (long long)i, c);
                        }
                }
                if (p)
-                       printk("\n");
+                       cmn_err(CE_DEBUG, "\n");
        }
        if (sumbp)
                xfs_trans_brelse(tp, sumbp);
index 422913645709a360ee5d54839f36c0054133eaa8..8cedd1583bc839d29ab6c8b96ae0db45ea4ade13 100644 (file)
@@ -320,7 +320,7 @@ xfs_trans_read_buf(
                        if (xfs_error_target == target) {
                                if (((xfs_req_num++) % xfs_error_mod) == 0) {
                                        xfs_buf_relse(bp);
-                                       printk("Returning error!\n");
+                                       cmn_err(CE_DEBUG, "Returning error!\n");
                                        return XFS_ERROR(EIO);
                                }
                        }
@@ -425,7 +425,7 @@ xfs_trans_read_buf(
                                xfs_force_shutdown(tp->t_mountp,
                                                   SHUTDOWN_META_IO_ERROR);
                                xfs_buf_relse(bp);
-                               printk("Returning error in trans!\n");
+                               cmn_err(CE_DEBUG, "Returning trans error!\n");
                                return XFS_ERROR(EIO);
                        }
                }
index 1117d600d74108f2ba9936663db4c5f758062a85..2912aac07c7bff8d7133a54297c78d6707a6669c 100644 (file)
@@ -493,7 +493,7 @@ xfs_trans_add_busy(xfs_trans_t *tp, xfs_agnumber_t ag, xfs_extlen_t idx)
                                break;
                        } else {
                                /* out-of-order vacancy */
-                               printk("OOO vacancy lbcp 0x%p\n", lbcp);
+                               cmn_err(CE_DEBUG, "OOO vacancy lbcp 0x%p\n", lbcp);
                                ASSERT(0);
                        }
                }
index 36ea1b2094f29cf6c2a475fce994e8e15a4e0008..ec85a2e24b523ea2ef76a09d694ebbd5f31b1a7b 100644 (file)
@@ -1708,42 +1708,48 @@ xfs_parseargs(
 
                if (!strcmp(this_char, MNTOPT_LOGBUFS)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
                        args->logbufs = simple_strtoul(value, &eov, 10);
                } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
                        args->logbufsize = suffix_strtoul(value, &eov, 10);
                } else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
                        strncpy(args->logname, value, MAXNAMELEN);
                } else if (!strcmp(this_char, MNTOPT_MTPT)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
                        strncpy(args->mtpt, value, MAXNAMELEN);
                } else if (!strcmp(this_char, MNTOPT_RTDEV)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
                        strncpy(args->rtname, value, MAXNAMELEN);
                } else if (!strcmp(this_char, MNTOPT_BIOSIZE)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
@@ -1752,7 +1758,8 @@ xfs_parseargs(
                        args->iosizelog = (uint8_t) iosize;
                } else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
@@ -1761,7 +1768,8 @@ xfs_parseargs(
                        args->iosizelog = ffs(iosize) - 1;
                } else if (!strcmp(this_char, MNTOPT_IHASHSIZE)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
@@ -1782,7 +1790,8 @@ xfs_parseargs(
                } else if (!strcmp(this_char, MNTOPT_INO64)) {
                        args->flags |= XFSMNT_INO64;
 #if !XFS_BIG_INUMS
-                       printk("XFS: %s option not allowed on this system\n",
+                       cmn_err(CE_WARN,
+                               "XFS: %s option not allowed on this system",
                                this_char);
                        return EINVAL;
 #endif
@@ -1792,14 +1801,16 @@ xfs_parseargs(
                        args->flags |= XFSMNT_SWALLOC;
                } else if (!strcmp(this_char, MNTOPT_SUNIT)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
                        dsunit = simple_strtoul(value, &eov, 10);
                } else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
                        if (!value || !*value) {
-                               printk("XFS: %s option requires an argument\n",
+                               cmn_err(CE_WARN,
+                                       "XFS: %s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
@@ -1807,7 +1818,8 @@ xfs_parseargs(
                } else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
                        args->flags &= ~XFSMNT_32BITINODES;
 #if !XFS_BIG_INUMS
-                       printk("XFS: %s option not allowed on this system\n",
+                       cmn_err(CE_WARN,
+                               "XFS: %s option not allowed on this system",
                                this_char);
                        return EINVAL;
 #endif
@@ -1831,36 +1843,41 @@ xfs_parseargs(
                        args->flags &= ~XFSMNT_ATTR2;
                } else if (!strcmp(this_char, "osyncisdsync")) {
                        /* no-op, this is now the default */
-printk("XFS: osyncisdsync is now the default, option is deprecated.\n");
+                       cmn_err(CE_WARN,
+       "XFS: osyncisdsync is now the default, option is deprecated.");
                } else if (!strcmp(this_char, "irixsgid")) {
-printk("XFS: irixsgid is now a sysctl(2) variable, option is deprecated.\n");
+                       cmn_err(CE_WARN,
+       "XFS: irixsgid is now a sysctl(2) variable, option is deprecated.");
                } else {
-                       printk("XFS: unknown mount option [%s].\n", this_char);
+                       cmn_err(CE_WARN,
+                               "XFS: unknown mount option [%s].", this_char);
                        return EINVAL;
                }
        }
 
        if (args->flags & XFSMNT_NORECOVERY) {
                if ((vfsp->vfs_flag & VFS_RDONLY) == 0) {
-                       printk("XFS: no-recovery mounts must be read-only.\n");
+                       cmn_err(CE_WARN,
+                               "XFS: no-recovery mounts must be read-only.");
                        return EINVAL;
                }
        }
 
        if ((args->flags & XFSMNT_NOALIGN) && (dsunit || dswidth)) {
-               printk(
-       "XFS: sunit and swidth options incompatible with the noalign option\n");
+               cmn_err(CE_WARN,
+       "XFS: sunit and swidth options incompatible with the noalign option");
                return EINVAL;
        }
 
        if ((dsunit && !dswidth) || (!dsunit && dswidth)) {
-               printk("XFS: sunit and swidth must be specified together\n");
+               cmn_err(CE_WARN,
+                       "XFS: sunit and swidth must be specified together");
                return EINVAL;
        }
 
        if (dsunit && (dswidth % dsunit != 0)) {
-               printk(
-       "XFS: stripe width (%d) must be a multiple of the stripe unit (%d)\n",
+               cmn_err(CE_WARN,
+       "XFS: stripe width (%d) must be a multiple of the stripe unit (%d)",
                        dswidth, dsunit);
                return EINVAL;
        }