aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/jfs_dmap.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_dmap.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_dmap.c')
-rw-r--r--fs/jfs/jfs_dmap.c70
1 files changed, 27 insertions, 43 deletions
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 9a55f53be5ff..370d7b6c5942 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -346,8 +346,7 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
346 printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n", 346 printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n",
347 (unsigned long long) blkno, 347 (unsigned long long) blkno,
348 (unsigned long long) nblocks); 348 (unsigned long long) nblocks);
349 jfs_error(ip->i_sb, 349 jfs_error(ip->i_sb, "block to be freed is outside the map\n");
350 "dbFree: block to be freed is outside the map");
351 return -EIO; 350 return -EIO;
352 } 351 }
353 352
@@ -384,7 +383,7 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks)
384 383
385 /* free the blocks. */ 384 /* free the blocks. */
386 if ((rc = dbFreeDmap(bmp, dp, blkno, nb))) { 385 if ((rc = dbFreeDmap(bmp, dp, blkno, nb))) {
387 jfs_error(ip->i_sb, "dbFree: error in block map\n"); 386 jfs_error(ip->i_sb, "error in block map\n");
388 release_metapage(mp); 387 release_metapage(mp);
389 IREAD_UNLOCK(ipbmap); 388 IREAD_UNLOCK(ipbmap);
390 return (rc); 389 return (rc);
@@ -441,8 +440,7 @@ dbUpdatePMap(struct inode *ipbmap,
441 printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n", 440 printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n",
442 (unsigned long long) blkno, 441 (unsigned long long) blkno,
443 (unsigned long long) nblocks); 442 (unsigned long long) nblocks);
444 jfs_error(ipbmap->i_sb, 443 jfs_error(ipbmap->i_sb, "blocks are outside the map\n");
445 "dbUpdatePMap: blocks are outside the map");
446 return -EIO; 444 return -EIO;
447 } 445 }
448 446
@@ -726,7 +724,7 @@ int dbAlloc(struct inode *ip, s64 hint, s64 nblocks, s64 * results)
726 724
727 /* the hint should be within the map */ 725 /* the hint should be within the map */
728 if (hint >= mapSize) { 726 if (hint >= mapSize) {
729 jfs_error(ip->i_sb, "dbAlloc: the hint is outside the map"); 727 jfs_error(ip->i_sb, "the hint is outside the map\n");
730 return -EIO; 728 return -EIO;
731 } 729 }
732 730
@@ -1057,8 +1055,7 @@ static int dbExtend(struct inode *ip, s64 blkno, s64 nblocks, s64 addnblocks)
1057 bmp = sbi->bmap; 1055 bmp = sbi->bmap;
1058 if (lastblkno < 0 || lastblkno >= bmp->db_mapsize) { 1056 if (lastblkno < 0 || lastblkno >= bmp->db_mapsize) {
1059 IREAD_UNLOCK(ipbmap); 1057 IREAD_UNLOCK(ipbmap);
1060 jfs_error(ip->i_sb, 1058 jfs_error(ip->i_sb, "the block is outside the filesystem\n");
1061 "dbExtend: the block is outside the filesystem");
1062 return -EIO; 1059 return -EIO;
1063 } 1060 }
1064 1061
@@ -1134,8 +1131,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
1134 u32 mask; 1131 u32 mask;
1135 1132
1136 if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) { 1133 if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
1137 jfs_error(bmp->db_ipbmap->i_sb, 1134 jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
1138 "dbAllocNext: Corrupt dmap page");
1139 return -EIO; 1135 return -EIO;
1140 } 1136 }
1141 1137
@@ -1265,8 +1261,7 @@ dbAllocNear(struct bmap * bmp,
1265 s8 *leaf; 1261 s8 *leaf;
1266 1262
1267 if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) { 1263 if (dp->tree.leafidx != cpu_to_le32(LEAFIND)) {
1268 jfs_error(bmp->db_ipbmap->i_sb, 1264 jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmap page\n");
1269 "dbAllocNear: Corrupt dmap page");
1270 return -EIO; 1265 return -EIO;
1271 } 1266 }
1272 1267
@@ -1381,8 +1376,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
1381 */ 1376 */
1382 if (l2nb > bmp->db_agl2size) { 1377 if (l2nb > bmp->db_agl2size) {
1383 jfs_error(bmp->db_ipbmap->i_sb, 1378 jfs_error(bmp->db_ipbmap->i_sb,
1384 "dbAllocAG: allocation request is larger than the " 1379 "allocation request is larger than the allocation group size\n");
1385 "allocation group size");
1386 return -EIO; 1380 return -EIO;
1387 } 1381 }
1388 1382
@@ -1417,7 +1411,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
1417 (unsigned long long) blkno, 1411 (unsigned long long) blkno,
1418 (unsigned long long) nblocks); 1412 (unsigned long long) nblocks);
1419 jfs_error(bmp->db_ipbmap->i_sb, 1413 jfs_error(bmp->db_ipbmap->i_sb,
1420 "dbAllocAG: dbAllocCtl failed in free AG"); 1414 "dbAllocCtl failed in free AG\n");
1421 } 1415 }
1422 return (rc); 1416 return (rc);
1423 } 1417 }
@@ -1433,8 +1427,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
1433 budmin = dcp->budmin; 1427 budmin = dcp->budmin;
1434 1428
1435 if (dcp->leafidx != cpu_to_le32(CTLLEAFIND)) { 1429 if (dcp->leafidx != cpu_to_le32(CTLLEAFIND)) {
1436 jfs_error(bmp->db_ipbmap->i_sb, 1430 jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
1437 "dbAllocAG: Corrupt dmapctl page");
1438 release_metapage(mp); 1431 release_metapage(mp);
1439 return -EIO; 1432 return -EIO;
1440 } 1433 }
@@ -1475,7 +1468,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
1475 } 1468 }
1476 if (n == 4) { 1469 if (n == 4) {
1477 jfs_error(bmp->db_ipbmap->i_sb, 1470 jfs_error(bmp->db_ipbmap->i_sb,
1478 "dbAllocAG: failed descending stree"); 1471 "failed descending stree\n");
1479 release_metapage(mp); 1472 release_metapage(mp);
1480 return -EIO; 1473 return -EIO;
1481 } 1474 }
@@ -1515,8 +1508,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
1515 &blkno))) { 1508 &blkno))) {
1516 if (rc == -ENOSPC) { 1509 if (rc == -ENOSPC) {
1517 jfs_error(bmp->db_ipbmap->i_sb, 1510 jfs_error(bmp->db_ipbmap->i_sb,
1518 "dbAllocAG: control page " 1511 "control page inconsistent\n");
1519 "inconsistent");
1520 return -EIO; 1512 return -EIO;
1521 } 1513 }
1522 return (rc); 1514 return (rc);
@@ -1528,7 +1520,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
1528 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results); 1520 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
1529 if (rc == -ENOSPC) { 1521 if (rc == -ENOSPC) {
1530 jfs_error(bmp->db_ipbmap->i_sb, 1522 jfs_error(bmp->db_ipbmap->i_sb,
1531 "dbAllocAG: unable to allocate blocks"); 1523 "unable to allocate blocks\n");
1532 rc = -EIO; 1524 rc = -EIO;
1533 } 1525 }
1534 return (rc); 1526 return (rc);
@@ -1587,8 +1579,7 @@ static int dbAllocAny(struct bmap * bmp, s64 nblocks, int l2nb, s64 * results)
1587 */ 1579 */
1588 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results); 1580 rc = dbAllocCtl(bmp, nblocks, l2nb, blkno, results);
1589 if (rc == -ENOSPC) { 1581 if (rc == -ENOSPC) {
1590 jfs_error(bmp->db_ipbmap->i_sb, 1582 jfs_error(bmp->db_ipbmap->i_sb, "unable to allocate blocks\n");
1591 "dbAllocAny: unable to allocate blocks");
1592 return -EIO; 1583 return -EIO;
1593 } 1584 }
1594 return (rc); 1585 return (rc);
@@ -1652,8 +1643,7 @@ s64 dbDiscardAG(struct inode *ip, int agno, s64 minlen)
1652 range_cnt = min_t(u64, max_ranges + 1, 32 * 1024); 1643 range_cnt = min_t(u64, max_ranges + 1, 32 * 1024);
1653 totrim = kmalloc(sizeof(struct range2trim) * range_cnt, GFP_NOFS); 1644 totrim = kmalloc(sizeof(struct range2trim) * range_cnt, GFP_NOFS);
1654 if (totrim == NULL) { 1645 if (totrim == NULL) {
1655 jfs_error(bmp->db_ipbmap->i_sb, 1646 jfs_error(bmp->db_ipbmap->i_sb, "no memory for trim array\n");
1656 "dbDiscardAG: no memory for trim array");
1657 IWRITE_UNLOCK(ipbmap); 1647 IWRITE_UNLOCK(ipbmap);
1658 return 0; 1648 return 0;
1659 } 1649 }
@@ -1682,8 +1672,7 @@ s64 dbDiscardAG(struct inode *ip, int agno, s64 minlen)
1682 nblocks = 1 << l2nb; 1672 nblocks = 1 << l2nb;
1683 } else { 1673 } else {
1684 /* Trim any already allocated blocks */ 1674 /* Trim any already allocated blocks */
1685 jfs_error(bmp->db_ipbmap->i_sb, 1675 jfs_error(bmp->db_ipbmap->i_sb, "-EIO\n");
1686 "dbDiscardAG: -EIO");
1687 break; 1676 break;
1688 } 1677 }
1689 1678
@@ -1761,7 +1750,7 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno)
1761 1750
1762 if (dcp->leafidx != cpu_to_le32(CTLLEAFIND)) { 1751 if (dcp->leafidx != cpu_to_le32(CTLLEAFIND)) {
1763 jfs_error(bmp->db_ipbmap->i_sb, 1752 jfs_error(bmp->db_ipbmap->i_sb,
1764 "dbFindCtl: Corrupt dmapctl page"); 1753 "Corrupt dmapctl page\n");
1765 release_metapage(mp); 1754 release_metapage(mp);
1766 return -EIO; 1755 return -EIO;
1767 } 1756 }
@@ -1782,7 +1771,7 @@ static int dbFindCtl(struct bmap * bmp, int l2nb, int level, s64 * blkno)
1782 if (rc) { 1771 if (rc) {
1783 if (lev != level) { 1772 if (lev != level) {
1784 jfs_error(bmp->db_ipbmap->i_sb, 1773 jfs_error(bmp->db_ipbmap->i_sb,
1785 "dbFindCtl: dmap inconsistent"); 1774 "dmap inconsistent\n");
1786 return -EIO; 1775 return -EIO;
1787 } 1776 }
1788 return -ENOSPC; 1777 return -ENOSPC;
@@ -1906,7 +1895,7 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
1906 if (dp->tree.stree[ROOT] != L2BPERDMAP) { 1895 if (dp->tree.stree[ROOT] != L2BPERDMAP) {
1907 release_metapage(mp); 1896 release_metapage(mp);
1908 jfs_error(bmp->db_ipbmap->i_sb, 1897 jfs_error(bmp->db_ipbmap->i_sb,
1909 "dbAllocCtl: the dmap is not all free"); 1898 "the dmap is not all free\n");
1910 rc = -EIO; 1899 rc = -EIO;
1911 goto backout; 1900 goto backout;
1912 } 1901 }
@@ -1953,7 +1942,7 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
1953 * to indicate that we have leaked blocks. 1942 * to indicate that we have leaked blocks.
1954 */ 1943 */
1955 jfs_error(bmp->db_ipbmap->i_sb, 1944 jfs_error(bmp->db_ipbmap->i_sb,
1956 "dbAllocCtl: I/O Error: Block Leakage."); 1945 "I/O Error: Block Leakage\n");
1957 continue; 1946 continue;
1958 } 1947 }
1959 dp = (struct dmap *) mp->data; 1948 dp = (struct dmap *) mp->data;
@@ -1965,8 +1954,7 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
1965 * to indicate that we have leaked blocks. 1954 * to indicate that we have leaked blocks.
1966 */ 1955 */
1967 release_metapage(mp); 1956 release_metapage(mp);
1968 jfs_error(bmp->db_ipbmap->i_sb, 1957 jfs_error(bmp->db_ipbmap->i_sb, "Block Leakage\n");
1969 "dbAllocCtl: Block Leakage.");
1970 continue; 1958 continue;
1971 } 1959 }
1972 1960
@@ -2263,8 +2251,7 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
2263 for (; nwords > 0; nwords -= nw) { 2251 for (; nwords > 0; nwords -= nw) {
2264 if (leaf[word] < BUDMIN) { 2252 if (leaf[word] < BUDMIN) {
2265 jfs_error(bmp->db_ipbmap->i_sb, 2253 jfs_error(bmp->db_ipbmap->i_sb,
2266 "dbAllocBits: leaf page " 2254 "leaf page corrupt\n");
2267 "corrupt");
2268 break; 2255 break;
2269 } 2256 }
2270 2257
@@ -2536,8 +2523,7 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
2536 dcp = (struct dmapctl *) mp->data; 2523 dcp = (struct dmapctl *) mp->data;
2537 2524
2538 if (dcp->leafidx != cpu_to_le32(CTLLEAFIND)) { 2525 if (dcp->leafidx != cpu_to_le32(CTLLEAFIND)) {
2539 jfs_error(bmp->db_ipbmap->i_sb, 2526 jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page\n");
2540 "dbAdjCtl: Corrupt dmapctl page");
2541 release_metapage(mp); 2527 release_metapage(mp);
2542 return -EIO; 2528 return -EIO;
2543 } 2529 }
@@ -2638,8 +2624,7 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)
2638 assert(level == bmp->db_maxlevel); 2624 assert(level == bmp->db_maxlevel);
2639 if (bmp->db_maxfreebud != oldroot) { 2625 if (bmp->db_maxfreebud != oldroot) {
2640 jfs_error(bmp->db_ipbmap->i_sb, 2626 jfs_error(bmp->db_ipbmap->i_sb,
2641 "dbAdjCtl: the maximum free buddy is " 2627 "the maximum free buddy is not the old root\n");
2642 "not the old root");
2643 } 2628 }
2644 bmp->db_maxfreebud = dcp->stree[ROOT]; 2629 bmp->db_maxfreebud = dcp->stree[ROOT];
2645 } 2630 }
@@ -3481,7 +3466,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks)
3481 p = BMAPBLKNO + nbperpage; /* L2 page */ 3466 p = BMAPBLKNO + nbperpage; /* L2 page */
3482 l2mp = read_metapage(ipbmap, p, PSIZE, 0); 3467 l2mp = read_metapage(ipbmap, p, PSIZE, 0);
3483 if (!l2mp) { 3468 if (!l2mp) {
3484 jfs_error(ipbmap->i_sb, "dbExtendFS: L2 page could not be read"); 3469 jfs_error(ipbmap->i_sb, "L2 page could not be read\n");
3485 return -EIO; 3470 return -EIO;
3486 } 3471 }
3487 l2dcp = (struct dmapctl *) l2mp->data; 3472 l2dcp = (struct dmapctl *) l2mp->data;
@@ -3646,8 +3631,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks)
3646 } 3631 }
3647 } /* for each L1 in a L2 */ 3632 } /* for each L1 in a L2 */
3648 3633
3649 jfs_error(ipbmap->i_sb, 3634 jfs_error(ipbmap->i_sb, "function has not returned as expected\n");
3650 "dbExtendFS: function has not returned as expected");
3651errout: 3635errout:
3652 if (l0mp) 3636 if (l0mp)
3653 release_metapage(l0mp); 3637 release_metapage(l0mp);
@@ -3717,7 +3701,7 @@ void dbFinalizeBmap(struct inode *ipbmap)
3717 } 3701 }
3718 if (bmp->db_agpref >= bmp->db_numag) { 3702 if (bmp->db_agpref >= bmp->db_numag) {
3719 jfs_error(ipbmap->i_sb, 3703 jfs_error(ipbmap->i_sb,
3720 "cannot find ag with average freespace"); 3704 "cannot find ag with average freespace\n");
3721 } 3705 }
3722 } 3706 }
3723 3707