Commit b65745205fc00d8c7722ec74e9bd955f3861c7e2
1 parent
9c48876a05
Exists in
master
and in
7 other branches
[XFS] Portability changes: remove prdev, stick to one diagnostic
interface. SGI-PV: 953338 SGI-Modid: xfs-linux-melb:xfs-kern:26103a Signed-off-by: Nathan Scott <nathans@sgi.com>
Showing 10 changed files with 67 additions and 51 deletions Side-by-side Diff
fs/xfs/support/debug.c
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | va_start(ap, fmt); |
48 | 48 | if (*fmt == '!') fp++; |
49 | 49 | len = vsprintf(message, fp, ap); |
50 | - if (message[len-1] != '\n') | |
50 | + if (level != CE_DEBUG && message[len-1] != '\n') | |
51 | 51 | strcat(message, "\n"); |
52 | 52 | printk("%s%s", err_level[level], message); |
53 | 53 | va_end(ap); |
... | ... | @@ -68,7 +68,7 @@ |
68 | 68 | level = XFS_MAX_ERR_LEVEL; |
69 | 69 | spin_lock_irqsave(&xfs_err_lock,flags); |
70 | 70 | len = vsprintf(message, fmt, ap); |
71 | - if (message[len-1] != '\n') | |
71 | + if (level != CE_DEBUG && message[len-1] != '\n') | |
72 | 72 | strcat(message, "\n"); |
73 | 73 | spin_unlock_irqrestore(&xfs_err_lock,flags); |
74 | 74 | printk("%s%s", err_level[level], message); |
fs/xfs/support/debug.h
... | ... | @@ -33,9 +33,6 @@ |
33 | 33 | __attribute__ ((format (printf, 2, 3))); |
34 | 34 | extern void assfail(char *expr, char *f, int l); |
35 | 35 | |
36 | -#define prdev(fmt,targ,args...) \ | |
37 | - printk("Device %s - " fmt "\n", XFS_BUFTARG_NAME(targ), ## args) | |
38 | - | |
39 | 36 | #define ASSERT_ALWAYS(expr) \ |
40 | 37 | (unlikely((expr) != 0) ? (void)0 : assfail(#expr, __FILE__, __LINE__)) |
41 | 38 |
fs/xfs/xfs_buf_item.c
... | ... | @@ -1030,9 +1030,9 @@ |
1030 | 1030 | if ((XFS_BUF_TARGET(bp) != lasttarg) || |
1031 | 1031 | (time_after(jiffies, (lasttime + 5*HZ)))) { |
1032 | 1032 | lasttime = jiffies; |
1033 | - prdev("XFS write error in file system meta-data " | |
1034 | - "block 0x%llx in %s", | |
1035 | - XFS_BUF_TARGET(bp), | |
1033 | + cmn_err(CE_ALERT, "Device %s, XFS metadata write error" | |
1034 | + " block 0x%llx in %s", | |
1035 | + XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)), | |
1036 | 1036 | (__uint64_t)XFS_BUF_ADDR(bp), mp->m_fsname); |
1037 | 1037 | } |
1038 | 1038 | lasttarg = XFS_BUF_TARGET(bp); |
fs/xfs/xfs_inode.c
... | ... | @@ -352,8 +352,9 @@ |
352 | 352 | if (unlikely(XFS_TEST_ERROR(!di_ok, mp, XFS_ERRTAG_ITOBP_INOTOBP, |
353 | 353 | XFS_RANDOM_ITOBP_INOTOBP))) { |
354 | 354 | #ifdef DEBUG |
355 | - prdev("bad inode magic/vsn daddr %lld #%d (magic=%x)", | |
356 | - mp->m_ddev_targp, | |
355 | + cmn_err(CE_ALERT, "Device %s - bad inode magic/vsn " | |
356 | + "daddr %lld #%d (magic=%x)", | |
357 | + XFS_BUFTARG_NAME(mp->m_ddev_targp), | |
357 | 358 | (unsigned long long)imap.im_blkno, i, |
358 | 359 | INT_GET(dip->di_core.di_magic, ARCH_CONVERT)); |
359 | 360 | #endif |
fs/xfs/xfs_log_recover.c
... | ... | @@ -193,14 +193,14 @@ |
193 | 193 | { |
194 | 194 | int b; |
195 | 195 | |
196 | - printk("%s: SB : uuid = ", __FUNCTION__); | |
196 | + cmn_err(CE_DEBUG, "%s: SB : uuid = ", __FUNCTION__); | |
197 | 197 | for (b = 0; b < 16; b++) |
198 | - printk("%02x",((unsigned char *)&mp->m_sb.sb_uuid)[b]); | |
199 | - printk(", fmt = %d\n", XLOG_FMT); | |
200 | - printk(" log : uuid = "); | |
198 | + cmn_err(CE_DEBUG, "%02x", ((uchar_t *)&mp->m_sb.sb_uuid)[b]); | |
199 | + cmn_err(CE_DEBUG, ", fmt = %d\n", XLOG_FMT); | |
200 | + cmn_err(CE_DEBUG, " log : uuid = "); | |
201 | 201 | for (b = 0; b < 16; b++) |
202 | - printk("%02x",((unsigned char *)&head->h_fs_uuid)[b]); | |
203 | - printk(", fmt = %d\n", INT_GET(head->h_fmt, ARCH_CONVERT)); | |
202 | + cmn_err(CE_DEBUG, "%02x",((uchar_t *)&head->h_fs_uuid)[b]); | |
203 | + cmn_err(CE_DEBUG, ", fmt = %d\n", INT_GET(head->h_fmt, ARCH_CONVERT)); | |
204 | 204 | } |
205 | 205 | #else |
206 | 206 | #define xlog_header_check_dump(mp, head) |
207 | 207 | |
... | ... | @@ -3444,13 +3444,13 @@ |
3444 | 3444 | if (rhead->h_chksum || |
3445 | 3445 | ((log->l_flags & XLOG_CHKSUM_MISMATCH) == 0)) { |
3446 | 3446 | cmn_err(CE_DEBUG, |
3447 | - "XFS: LogR chksum mismatch: was (0x%x) is (0x%x)", | |
3447 | + "XFS: LogR chksum mismatch: was (0x%x) is (0x%x)\n", | |
3448 | 3448 | INT_GET(rhead->h_chksum, ARCH_CONVERT), chksum); |
3449 | 3449 | cmn_err(CE_DEBUG, |
3450 | 3450 | "XFS: Disregard message if filesystem was created with non-DEBUG kernel"); |
3451 | 3451 | if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) { |
3452 | 3452 | cmn_err(CE_DEBUG, |
3453 | - "XFS: LogR this is a LogV2 filesystem"); | |
3453 | + "XFS: LogR this is a LogV2 filesystem\n"); | |
3454 | 3454 | } |
3455 | 3455 | log->l_flags |= XLOG_CHKSUM_MISMATCH; |
3456 | 3456 | } |
... | ... | @@ -3999,7 +3999,7 @@ |
3999 | 3999 | log->l_flags &= ~XLOG_RECOVERY_NEEDED; |
4000 | 4000 | } else { |
4001 | 4001 | cmn_err(CE_DEBUG, |
4002 | - "!Ending clean XFS mount for filesystem: %s", | |
4002 | + "!Ending clean XFS mount for filesystem: %s\n", | |
4003 | 4003 | log->l_mp->m_fsname); |
4004 | 4004 | } |
4005 | 4005 | return 0; |
fs/xfs/xfs_mount.c
... | ... | @@ -1006,8 +1006,9 @@ |
1006 | 1006 | |
1007 | 1007 | if (unlikely((rip->i_d.di_mode & S_IFMT) != S_IFDIR)) { |
1008 | 1008 | cmn_err(CE_WARN, "XFS: corrupted root inode"); |
1009 | - prdev("Root inode %llu is not a directory", | |
1010 | - mp->m_ddev_targp, (unsigned long long)rip->i_ino); | |
1009 | + cmn_err(CE_WARN, "Device %s - root %llu is not a directory", | |
1010 | + XFS_BUFTARG_NAME(mp->m_ddev_targp), | |
1011 | + (unsigned long long)rip->i_ino); | |
1011 | 1012 | xfs_iunlock(rip, XFS_ILOCK_EXCL); |
1012 | 1013 | XFS_ERROR_REPORT("xfs_mountfs_int(2)", XFS_ERRLEVEL_LOW, |
1013 | 1014 | mp); |
fs/xfs/xfs_rtalloc.c
... | ... | @@ -2404,10 +2404,10 @@ |
2404 | 2404 | { |
2405 | 2405 | xfs_extlen_t i; /* block number in the extent */ |
2406 | 2406 | |
2407 | - printk("%Ld: ", (long long)start); | |
2407 | + cmn_err(CE_DEBUG, "%Ld: ", (long long)start); | |
2408 | 2408 | for (i = 0; i < len; i++) |
2409 | - printk("%d", xfs_rtcheck_bit(mp, tp, start + i, 1)); | |
2410 | - printk("\n"); | |
2409 | + cmn_err(CE_DEBUG, "%d", xfs_rtcheck_bit(mp, tp, start + i, 1)); | |
2410 | + cmn_err(CE_DEBUG, "\n"); | |
2411 | 2411 | } |
2412 | 2412 | |
2413 | 2413 | /* |
2414 | 2414 | |
2415 | 2415 | |
... | ... | @@ -2431,17 +2431,17 @@ |
2431 | 2431 | (void)xfs_rtget_summary(mp, tp, l, i, &sumbp, &sb, &c); |
2432 | 2432 | if (c) { |
2433 | 2433 | if (!p) { |
2434 | - printk("%Ld-%Ld:", 1LL << l, | |
2434 | + cmn_err(CE_DEBUG, "%Ld-%Ld:", 1LL << l, | |
2435 | 2435 | XFS_RTMIN((1LL << l) + |
2436 | 2436 | ((1LL << l) - 1LL), |
2437 | 2437 | mp->m_sb.sb_rextents)); |
2438 | 2438 | p = 1; |
2439 | 2439 | } |
2440 | - printk(" %Ld:%d", (long long)i, c); | |
2440 | + cmn_err(CE_DEBUG, " %Ld:%d", (long long)i, c); | |
2441 | 2441 | } |
2442 | 2442 | } |
2443 | 2443 | if (p) |
2444 | - printk("\n"); | |
2444 | + cmn_err(CE_DEBUG, "\n"); | |
2445 | 2445 | } |
2446 | 2446 | if (sumbp) |
2447 | 2447 | xfs_trans_brelse(tp, sumbp); |
fs/xfs/xfs_trans_buf.c
... | ... | @@ -320,7 +320,7 @@ |
320 | 320 | if (xfs_error_target == target) { |
321 | 321 | if (((xfs_req_num++) % xfs_error_mod) == 0) { |
322 | 322 | xfs_buf_relse(bp); |
323 | - printk("Returning error!\n"); | |
323 | + cmn_err(CE_DEBUG, "Returning error!\n"); | |
324 | 324 | return XFS_ERROR(EIO); |
325 | 325 | } |
326 | 326 | } |
... | ... | @@ -425,7 +425,7 @@ |
425 | 425 | xfs_force_shutdown(tp->t_mountp, |
426 | 426 | SHUTDOWN_META_IO_ERROR); |
427 | 427 | xfs_buf_relse(bp); |
428 | - printk("Returning error in trans!\n"); | |
428 | + cmn_err(CE_DEBUG, "Returning trans error!\n"); | |
429 | 429 | return XFS_ERROR(EIO); |
430 | 430 | } |
431 | 431 | } |
fs/xfs/xfs_trans_item.c
fs/xfs/xfs_vfsops.c
... | ... | @@ -1708,42 +1708,48 @@ |
1708 | 1708 | |
1709 | 1709 | if (!strcmp(this_char, MNTOPT_LOGBUFS)) { |
1710 | 1710 | if (!value || !*value) { |
1711 | - printk("XFS: %s option requires an argument\n", | |
1711 | + cmn_err(CE_WARN, | |
1712 | + "XFS: %s option requires an argument", | |
1712 | 1713 | this_char); |
1713 | 1714 | return EINVAL; |
1714 | 1715 | } |
1715 | 1716 | args->logbufs = simple_strtoul(value, &eov, 10); |
1716 | 1717 | } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) { |
1717 | 1718 | if (!value || !*value) { |
1718 | - printk("XFS: %s option requires an argument\n", | |
1719 | + cmn_err(CE_WARN, | |
1720 | + "XFS: %s option requires an argument", | |
1719 | 1721 | this_char); |
1720 | 1722 | return EINVAL; |
1721 | 1723 | } |
1722 | 1724 | args->logbufsize = suffix_strtoul(value, &eov, 10); |
1723 | 1725 | } else if (!strcmp(this_char, MNTOPT_LOGDEV)) { |
1724 | 1726 | if (!value || !*value) { |
1725 | - printk("XFS: %s option requires an argument\n", | |
1727 | + cmn_err(CE_WARN, | |
1728 | + "XFS: %s option requires an argument", | |
1726 | 1729 | this_char); |
1727 | 1730 | return EINVAL; |
1728 | 1731 | } |
1729 | 1732 | strncpy(args->logname, value, MAXNAMELEN); |
1730 | 1733 | } else if (!strcmp(this_char, MNTOPT_MTPT)) { |
1731 | 1734 | if (!value || !*value) { |
1732 | - printk("XFS: %s option requires an argument\n", | |
1735 | + cmn_err(CE_WARN, | |
1736 | + "XFS: %s option requires an argument", | |
1733 | 1737 | this_char); |
1734 | 1738 | return EINVAL; |
1735 | 1739 | } |
1736 | 1740 | strncpy(args->mtpt, value, MAXNAMELEN); |
1737 | 1741 | } else if (!strcmp(this_char, MNTOPT_RTDEV)) { |
1738 | 1742 | if (!value || !*value) { |
1739 | - printk("XFS: %s option requires an argument\n", | |
1743 | + cmn_err(CE_WARN, | |
1744 | + "XFS: %s option requires an argument", | |
1740 | 1745 | this_char); |
1741 | 1746 | return EINVAL; |
1742 | 1747 | } |
1743 | 1748 | strncpy(args->rtname, value, MAXNAMELEN); |
1744 | 1749 | } else if (!strcmp(this_char, MNTOPT_BIOSIZE)) { |
1745 | 1750 | if (!value || !*value) { |
1746 | - printk("XFS: %s option requires an argument\n", | |
1751 | + cmn_err(CE_WARN, | |
1752 | + "XFS: %s option requires an argument", | |
1747 | 1753 | this_char); |
1748 | 1754 | return EINVAL; |
1749 | 1755 | } |
... | ... | @@ -1752,7 +1758,8 @@ |
1752 | 1758 | args->iosizelog = (uint8_t) iosize; |
1753 | 1759 | } else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) { |
1754 | 1760 | if (!value || !*value) { |
1755 | - printk("XFS: %s option requires an argument\n", | |
1761 | + cmn_err(CE_WARN, | |
1762 | + "XFS: %s option requires an argument", | |
1756 | 1763 | this_char); |
1757 | 1764 | return EINVAL; |
1758 | 1765 | } |
... | ... | @@ -1761,7 +1768,8 @@ |
1761 | 1768 | args->iosizelog = ffs(iosize) - 1; |
1762 | 1769 | } else if (!strcmp(this_char, MNTOPT_IHASHSIZE)) { |
1763 | 1770 | if (!value || !*value) { |
1764 | - printk("XFS: %s option requires an argument\n", | |
1771 | + cmn_err(CE_WARN, | |
1772 | + "XFS: %s option requires an argument", | |
1765 | 1773 | this_char); |
1766 | 1774 | return EINVAL; |
1767 | 1775 | } |
... | ... | @@ -1782,7 +1790,8 @@ |
1782 | 1790 | } else if (!strcmp(this_char, MNTOPT_INO64)) { |
1783 | 1791 | args->flags |= XFSMNT_INO64; |
1784 | 1792 | #if !XFS_BIG_INUMS |
1785 | - printk("XFS: %s option not allowed on this system\n", | |
1793 | + cmn_err(CE_WARN, | |
1794 | + "XFS: %s option not allowed on this system", | |
1786 | 1795 | this_char); |
1787 | 1796 | return EINVAL; |
1788 | 1797 | #endif |
1789 | 1798 | |
... | ... | @@ -1792,14 +1801,16 @@ |
1792 | 1801 | args->flags |= XFSMNT_SWALLOC; |
1793 | 1802 | } else if (!strcmp(this_char, MNTOPT_SUNIT)) { |
1794 | 1803 | if (!value || !*value) { |
1795 | - printk("XFS: %s option requires an argument\n", | |
1804 | + cmn_err(CE_WARN, | |
1805 | + "XFS: %s option requires an argument", | |
1796 | 1806 | this_char); |
1797 | 1807 | return EINVAL; |
1798 | 1808 | } |
1799 | 1809 | dsunit = simple_strtoul(value, &eov, 10); |
1800 | 1810 | } else if (!strcmp(this_char, MNTOPT_SWIDTH)) { |
1801 | 1811 | if (!value || !*value) { |
1802 | - printk("XFS: %s option requires an argument\n", | |
1812 | + cmn_err(CE_WARN, | |
1813 | + "XFS: %s option requires an argument", | |
1803 | 1814 | this_char); |
1804 | 1815 | return EINVAL; |
1805 | 1816 | } |
... | ... | @@ -1807,7 +1818,8 @@ |
1807 | 1818 | } else if (!strcmp(this_char, MNTOPT_64BITINODE)) { |
1808 | 1819 | args->flags &= ~XFSMNT_32BITINODES; |
1809 | 1820 | #if !XFS_BIG_INUMS |
1810 | - printk("XFS: %s option not allowed on this system\n", | |
1821 | + cmn_err(CE_WARN, | |
1822 | + "XFS: %s option not allowed on this system", | |
1811 | 1823 | this_char); |
1812 | 1824 | return EINVAL; |
1813 | 1825 | #endif |
1814 | 1826 | |
1815 | 1827 | |
1816 | 1828 | |
1817 | 1829 | |
1818 | 1830 | |
1819 | 1831 | |
... | ... | @@ -1831,36 +1843,41 @@ |
1831 | 1843 | args->flags &= ~XFSMNT_ATTR2; |
1832 | 1844 | } else if (!strcmp(this_char, "osyncisdsync")) { |
1833 | 1845 | /* no-op, this is now the default */ |
1834 | -printk("XFS: osyncisdsync is now the default, option is deprecated.\n"); | |
1846 | + cmn_err(CE_WARN, | |
1847 | + "XFS: osyncisdsync is now the default, option is deprecated."); | |
1835 | 1848 | } else if (!strcmp(this_char, "irixsgid")) { |
1836 | -printk("XFS: irixsgid is now a sysctl(2) variable, option is deprecated.\n"); | |
1849 | + cmn_err(CE_WARN, | |
1850 | + "XFS: irixsgid is now a sysctl(2) variable, option is deprecated."); | |
1837 | 1851 | } else { |
1838 | - printk("XFS: unknown mount option [%s].\n", this_char); | |
1852 | + cmn_err(CE_WARN, | |
1853 | + "XFS: unknown mount option [%s].", this_char); | |
1839 | 1854 | return EINVAL; |
1840 | 1855 | } |
1841 | 1856 | } |
1842 | 1857 | |
1843 | 1858 | if (args->flags & XFSMNT_NORECOVERY) { |
1844 | 1859 | if ((vfsp->vfs_flag & VFS_RDONLY) == 0) { |
1845 | - printk("XFS: no-recovery mounts must be read-only.\n"); | |
1860 | + cmn_err(CE_WARN, | |
1861 | + "XFS: no-recovery mounts must be read-only."); | |
1846 | 1862 | return EINVAL; |
1847 | 1863 | } |
1848 | 1864 | } |
1849 | 1865 | |
1850 | 1866 | if ((args->flags & XFSMNT_NOALIGN) && (dsunit || dswidth)) { |
1851 | - printk( | |
1852 | - "XFS: sunit and swidth options incompatible with the noalign option\n"); | |
1867 | + cmn_err(CE_WARN, | |
1868 | + "XFS: sunit and swidth options incompatible with the noalign option"); | |
1853 | 1869 | return EINVAL; |
1854 | 1870 | } |
1855 | 1871 | |
1856 | 1872 | if ((dsunit && !dswidth) || (!dsunit && dswidth)) { |
1857 | - printk("XFS: sunit and swidth must be specified together\n"); | |
1873 | + cmn_err(CE_WARN, | |
1874 | + "XFS: sunit and swidth must be specified together"); | |
1858 | 1875 | return EINVAL; |
1859 | 1876 | } |
1860 | 1877 | |
1861 | 1878 | if (dsunit && (dswidth % dsunit != 0)) { |
1862 | - printk( | |
1863 | - "XFS: stripe width (%d) must be a multiple of the stripe unit (%d)\n", | |
1879 | + cmn_err(CE_WARN, | |
1880 | + "XFS: stripe width (%d) must be a multiple of the stripe unit (%d)", | |
1864 | 1881 | dswidth, dsunit); |
1865 | 1882 | return EINVAL; |
1866 | 1883 | } |