aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/jfs_xtree.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-06-04 19:39:15 -0400
committerDave Kleikamp <dave.kleikamp@oracle.com>2013-06-05 15:47:19 -0400
commiteb8630d7d2fd13589e6a7a3ae2fe1f75f867fbed (patch)
tree16a5040af9b8df061385de9e0ab8e13e51790ddf /fs/jfs/jfs_xtree.c
parent21d1101f013c12d1dd78cfdf263d619c80975b47 (diff)
jfs: Update jfs_error
Use a more current logging style. Add __printf format and argument verification. Remove embedded function names from formats. Add %pf, __builtin_return_address(0) to jfs_error. Add newlines to formats for kernel style consistency. (One format already had an erroneous newline) Coalesce formats and align arguments. Object size reduced ~1KiB. $ size fs/jfs/built-in.o* text data bss dec hex filename 201891 35488 63936 301315 49903 fs/jfs/built-in.o.new 202821 35488 64192 302501 49da5 fs/jfs/built-in.o.old Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Diffstat (limited to 'fs/jfs/jfs_xtree.c')
-rw-r--r--fs/jfs/jfs_xtree.c62
1 files changed, 30 insertions, 32 deletions
diff --git a/fs/jfs/jfs_xtree.c b/fs/jfs/jfs_xtree.c
index 6c50871e6220..5ad7748860ce 100644
--- a/fs/jfs/jfs_xtree.c
+++ b/fs/jfs/jfs_xtree.c
@@ -64,22 +64,23 @@
64 64
65/* get page buffer for specified block address */ 65/* get page buffer for specified block address */
66/* ToDo: Replace this ugly macro with a function */ 66/* ToDo: Replace this ugly macro with a function */
67#define XT_GETPAGE(IP, BN, MP, SIZE, P, RC)\ 67#define XT_GETPAGE(IP, BN, MP, SIZE, P, RC) \
68{\ 68do { \
69 BT_GETPAGE(IP, BN, MP, xtpage_t, SIZE, P, RC, i_xtroot)\ 69 BT_GETPAGE(IP, BN, MP, xtpage_t, SIZE, P, RC, i_xtroot); \
70 if (!(RC))\ 70 if (!(RC)) { \
71 {\ 71 if ((le16_to_cpu((P)->header.nextindex) < XTENTRYSTART) || \
72 if ((le16_to_cpu((P)->header.nextindex) < XTENTRYSTART) ||\ 72 (le16_to_cpu((P)->header.nextindex) > \
73 (le16_to_cpu((P)->header.nextindex) > le16_to_cpu((P)->header.maxentry)) ||\ 73 le16_to_cpu((P)->header.maxentry)) || \
74 (le16_to_cpu((P)->header.maxentry) > (((BN)==0)?XTROOTMAXSLOT:PSIZE>>L2XTSLOTSIZE)))\ 74 (le16_to_cpu((P)->header.maxentry) > \
75 {\ 75 (((BN) == 0) ? XTROOTMAXSLOT : PSIZE >> L2XTSLOTSIZE))) { \
76 jfs_error((IP)->i_sb, "XT_GETPAGE: xtree page corrupt");\ 76 jfs_error((IP)->i_sb, \
77 BT_PUTPAGE(MP);\ 77 "XT_GETPAGE: xtree page corrupt\n"); \
78 MP = NULL;\ 78 BT_PUTPAGE(MP); \
79 RC = -EIO;\ 79 MP = NULL; \
80 }\ 80 RC = -EIO; \
81 }\ 81 } \
82} 82 } \
83} while (0)
83 84
84/* for consistency */ 85/* for consistency */
85#define XT_PUTPAGE(MP) BT_PUTPAGE(MP) 86#define XT_PUTPAGE(MP) BT_PUTPAGE(MP)
@@ -499,7 +500,7 @@ static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp,
499 500
500 /* push (bn, index) of the parent page/entry */ 501 /* push (bn, index) of the parent page/entry */
501 if (BT_STACK_FULL(btstack)) { 502 if (BT_STACK_FULL(btstack)) {
502 jfs_error(ip->i_sb, "stack overrun in xtSearch!"); 503 jfs_error(ip->i_sb, "stack overrun!\n");
503 XT_PUTPAGE(mp); 504 XT_PUTPAGE(mp);
504 return -EIO; 505 return -EIO;
505 } 506 }
@@ -1385,7 +1386,7 @@ int xtExtend(tid_t tid, /* transaction id */
1385 1386
1386 if (cmp != 0) { 1387 if (cmp != 0) {
1387 XT_PUTPAGE(mp); 1388 XT_PUTPAGE(mp);
1388 jfs_error(ip->i_sb, "xtExtend: xtSearch did not find extent"); 1389 jfs_error(ip->i_sb, "xtSearch did not find extent\n");
1389 return -EIO; 1390 return -EIO;
1390 } 1391 }
1391 1392
@@ -1393,7 +1394,7 @@ int xtExtend(tid_t tid, /* transaction id */
1393 xad = &p->xad[index]; 1394 xad = &p->xad[index];
1394 if ((offsetXAD(xad) + lengthXAD(xad)) != xoff) { 1395 if ((offsetXAD(xad) + lengthXAD(xad)) != xoff) {
1395 XT_PUTPAGE(mp); 1396 XT_PUTPAGE(mp);
1396 jfs_error(ip->i_sb, "xtExtend: extension is not contiguous"); 1397 jfs_error(ip->i_sb, "extension is not contiguous\n");
1397 return -EIO; 1398 return -EIO;
1398 } 1399 }
1399 1400
@@ -1552,7 +1553,7 @@ printf("xtTailgate: nxoff:0x%lx nxlen:0x%x nxaddr:0x%lx\n",
1552 1553
1553 if (cmp != 0) { 1554 if (cmp != 0) {
1554 XT_PUTPAGE(mp); 1555 XT_PUTPAGE(mp);
1555 jfs_error(ip->i_sb, "xtTailgate: couldn't find extent"); 1556 jfs_error(ip->i_sb, "couldn't find extent\n");
1556 return -EIO; 1557 return -EIO;
1557 } 1558 }
1558 1559
@@ -1560,8 +1561,7 @@ printf("xtTailgate: nxoff:0x%lx nxlen:0x%x nxaddr:0x%lx\n",
1560 nextindex = le16_to_cpu(p->header.nextindex); 1561 nextindex = le16_to_cpu(p->header.nextindex);
1561 if (index != nextindex - 1) { 1562 if (index != nextindex - 1) {
1562 XT_PUTPAGE(mp); 1563 XT_PUTPAGE(mp);
1563 jfs_error(ip->i_sb, 1564 jfs_error(ip->i_sb, "the entry found is not the last entry\n");
1564 "xtTailgate: the entry found is not the last entry");
1565 return -EIO; 1565 return -EIO;
1566 } 1566 }
1567 1567
@@ -1734,7 +1734,7 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
1734 1734
1735 if (cmp != 0) { 1735 if (cmp != 0) {
1736 XT_PUTPAGE(mp); 1736 XT_PUTPAGE(mp);
1737 jfs_error(ip->i_sb, "xtUpdate: Could not find extent"); 1737 jfs_error(ip->i_sb, "Could not find extent\n");
1738 return -EIO; 1738 return -EIO;
1739 } 1739 }
1740 1740
@@ -1758,7 +1758,7 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
1758 (nxoff + nxlen > xoff + xlen)) { 1758 (nxoff + nxlen > xoff + xlen)) {
1759 XT_PUTPAGE(mp); 1759 XT_PUTPAGE(mp);
1760 jfs_error(ip->i_sb, 1760 jfs_error(ip->i_sb,
1761 "xtUpdate: nXAD in not completely contained within XAD"); 1761 "nXAD in not completely contained within XAD\n");
1762 return -EIO; 1762 return -EIO;
1763 } 1763 }
1764 1764
@@ -1907,7 +1907,7 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
1907 1907
1908 if (xoff >= nxoff) { 1908 if (xoff >= nxoff) {
1909 XT_PUTPAGE(mp); 1909 XT_PUTPAGE(mp);
1910 jfs_error(ip->i_sb, "xtUpdate: xoff >= nxoff"); 1910 jfs_error(ip->i_sb, "xoff >= nxoff\n");
1911 return -EIO; 1911 return -EIO;
1912 } 1912 }
1913/* #endif _JFS_WIP_COALESCE */ 1913/* #endif _JFS_WIP_COALESCE */
@@ -2048,14 +2048,13 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
2048 2048
2049 if (cmp != 0) { 2049 if (cmp != 0) {
2050 XT_PUTPAGE(mp); 2050 XT_PUTPAGE(mp);
2051 jfs_error(ip->i_sb, "xtUpdate: xtSearch failed"); 2051 jfs_error(ip->i_sb, "xtSearch failed\n");
2052 return -EIO; 2052 return -EIO;
2053 } 2053 }
2054 2054
2055 if (index0 != index) { 2055 if (index0 != index) {
2056 XT_PUTPAGE(mp); 2056 XT_PUTPAGE(mp);
2057 jfs_error(ip->i_sb, 2057 jfs_error(ip->i_sb, "unexpected value of index\n");
2058 "xtUpdate: unexpected value of index");
2059 return -EIO; 2058 return -EIO;
2060 } 2059 }
2061 } 2060 }
@@ -3650,7 +3649,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag)
3650 getChild: 3649 getChild:
3651 /* save current parent entry for the child page */ 3650 /* save current parent entry for the child page */
3652 if (BT_STACK_FULL(&btstack)) { 3651 if (BT_STACK_FULL(&btstack)) {
3653 jfs_error(ip->i_sb, "stack overrun in xtTruncate!"); 3652 jfs_error(ip->i_sb, "stack overrun!\n");
3654 XT_PUTPAGE(mp); 3653 XT_PUTPAGE(mp);
3655 return -EIO; 3654 return -EIO;
3656 } 3655 }
@@ -3751,8 +3750,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size)
3751 3750
3752 if (cmp != 0) { 3751 if (cmp != 0) {
3753 XT_PUTPAGE(mp); 3752 XT_PUTPAGE(mp);
3754 jfs_error(ip->i_sb, 3753 jfs_error(ip->i_sb, "did not find extent\n");
3755 "xtTruncate_pmap: did not find extent");
3756 return -EIO; 3754 return -EIO;
3757 } 3755 }
3758 } else { 3756 } else {
@@ -3851,7 +3849,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size)
3851 getChild: 3849 getChild:
3852 /* save current parent entry for the child page */ 3850 /* save current parent entry for the child page */
3853 if (BT_STACK_FULL(&btstack)) { 3851 if (BT_STACK_FULL(&btstack)) {
3854 jfs_error(ip->i_sb, "stack overrun in xtTruncate_pmap!"); 3852 jfs_error(ip->i_sb, "stack overrun!\n");
3855 XT_PUTPAGE(mp); 3853 XT_PUTPAGE(mp);
3856 return -EIO; 3854 return -EIO;
3857 } 3855 }