Commit 891456227881da9c565c455010380a40d385a478

Authored by Marcin Slusarz
Committed by Dave Kleikamp
1 parent 96b5a46e2a

jfs: le*_add_cpu conversion

replace all:
little_endian_variable = cpu_to_leX(leX_to_cpu(little_endian_variable) +
                                        expression_in_cpu_byteorder);
with:
        leX_add_cpu(&little_endian_variable, expression_in_cpu_byteorder);
generated with semantic patch

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Cc: jfs-discussion@lists.sourceforge.net

Showing 3 changed files with 19 additions and 33 deletions Side-by-side Diff

... ... @@ -2172,7 +2172,7 @@
2172 2172 }
2173 2173  
2174 2174 /* update the free count for this dmap */
2175   - dp->nfree = cpu_to_le32(le32_to_cpu(dp->nfree) - nblocks);
  2175 + le32_add_cpu(&dp->nfree, -nblocks);
2176 2176  
2177 2177 BMAP_LOCK(bmp);
2178 2178  
... ... @@ -2316,7 +2316,7 @@
2316 2316  
2317 2317 /* update the free count for this dmap.
2318 2318 */
2319   - dp->nfree = cpu_to_le32(le32_to_cpu(dp->nfree) + nblocks);
  2319 + le32_add_cpu(&dp->nfree, nblocks);
2320 2320  
2321 2321 BMAP_LOCK(bmp);
2322 2322  
... ... @@ -3226,7 +3226,7 @@
3226 3226 }
3227 3227  
3228 3228 /* update the free count for this dmap */
3229   - dp->nfree = cpu_to_le32(le32_to_cpu(dp->nfree) - nblocks);
  3229 + le32_add_cpu(&dp->nfree, -nblocks);
3230 3230  
3231 3231 /* reconstruct summary tree */
3232 3232 dbInitDmapTree(dp);
... ... @@ -3660,9 +3660,8 @@
3660 3660 goto initTree;
3661 3661 }
3662 3662 } else {
3663   - dp->nblocks =
3664   - cpu_to_le32(le32_to_cpu(dp->nblocks) + nblocks);
3665   - dp->nfree = cpu_to_le32(le32_to_cpu(dp->nfree) + nblocks);
  3663 + le32_add_cpu(&dp->nblocks, nblocks);
  3664 + le32_add_cpu(&dp->nfree, nblocks);
3666 3665 }
3667 3666  
3668 3667 /* word number containing start block number */
... ... @@ -1019,8 +1019,7 @@
1019 1019 /* update the free inode counts at the iag, ag and
1020 1020 * map level.
1021 1021 */
1022   - iagp->nfreeinos =
1023   - cpu_to_le32(le32_to_cpu(iagp->nfreeinos) + 1);
  1022 + le32_add_cpu(&iagp->nfreeinos, 1);
1024 1023 imap->im_agctl[agno].numfree += 1;
1025 1024 atomic_inc(&imap->im_numfree);
1026 1025  
... ... @@ -1219,9 +1218,8 @@
1219 1218 /* update the number of free inodes and number of free extents
1220 1219 * for the iag.
1221 1220 */
1222   - iagp->nfreeinos = cpu_to_le32(le32_to_cpu(iagp->nfreeinos) -
1223   - (INOSPEREXT - 1));
1224   - iagp->nfreeexts = cpu_to_le32(le32_to_cpu(iagp->nfreeexts) + 1);
  1221 + le32_add_cpu(&iagp->nfreeinos, -(INOSPEREXT - 1));
  1222 + le32_add_cpu(&iagp->nfreeexts, 1);
1225 1223  
1226 1224 /* update the number of free inodes and backed inodes
1227 1225 * at the ag and inode map level.
... ... @@ -2124,7 +2122,7 @@
2124 2122 /* update the free inode count at the iag, ag, inode
2125 2123 * map levels.
2126 2124 */
2127   - iagp->nfreeinos = cpu_to_le32(le32_to_cpu(iagp->nfreeinos) - 1);
  2125 + le32_add_cpu(&iagp->nfreeinos, -1);
2128 2126 imap->im_agctl[agno].numfree -= 1;
2129 2127 atomic_dec(&imap->im_numfree);
2130 2128  
... ... @@ -2378,9 +2376,8 @@
2378 2376 /* update the free inode and free extent counts for the
2379 2377 * iag.
2380 2378 */
2381   - iagp->nfreeinos = cpu_to_le32(le32_to_cpu(iagp->nfreeinos) +
2382   - (INOSPEREXT - 1));
2383   - iagp->nfreeexts = cpu_to_le32(le32_to_cpu(iagp->nfreeexts) - 1);
  2379 + le32_add_cpu(&iagp->nfreeinos, (INOSPEREXT - 1));
  2380 + le32_add_cpu(&iagp->nfreeexts, -1);
2384 2381  
2385 2382 /* update the free and backed inode counts for the ag.
2386 2383 */
... ... @@ -905,8 +905,7 @@
905 905 XT_PUTENTRY(xad, xflag, xoff, xlen, xaddr);
906 906  
907 907 /* advance next available entry index */
908   - p->header.nextindex =
909   - cpu_to_le16(le16_to_cpu(p->header.nextindex) + 1);
  908 + le16_add_cpu(&p->header.nextindex, 1);
910 909  
911 910 /* Don't log it if there are no links to the file */
912 911 if (!test_cflag(COMMIT_Nolink, ip)) {
... ... @@ -997,8 +996,7 @@
997 996 split->addr);
998 997  
999 998 /* advance next available entry index */
1000   - sp->header.nextindex =
1001   - cpu_to_le16(le16_to_cpu(sp->header.nextindex) + 1);
  999 + le16_add_cpu(&sp->header.nextindex, 1);
1002 1000  
1003 1001 /* Don't log it if there are no links to the file */
1004 1002 if (!test_cflag(COMMIT_Nolink, ip)) {
... ... @@ -1167,9 +1165,7 @@
1167 1165 JFS_SBI(ip->i_sb)->nbperpage, rcbn);
1168 1166  
1169 1167 /* advance next available entry index. */
1170   - sp->header.nextindex =
1171   - cpu_to_le16(le16_to_cpu(sp->header.nextindex) +
1172   - 1);
  1168 + le16_add_cpu(&sp->header.nextindex, 1);
1173 1169  
1174 1170 /* Don't log it if there are no links to the file */
1175 1171 if (!test_cflag(COMMIT_Nolink, ip)) {
... ... @@ -1738,8 +1734,7 @@
1738 1734 XT_PUTENTRY(xad, XAD_NEW, xoff, len, xaddr);
1739 1735  
1740 1736 /* advance next available entry index */
1741   - p->header.nextindex =
1742   - cpu_to_le16(le16_to_cpu(p->header.nextindex) + 1);
  1737 + le16_add_cpu(&p->header.nextindex, 1);
1743 1738 }
1744 1739  
1745 1740 /* get back old entry */
... ... @@ -1905,8 +1900,7 @@
1905 1900 XT_PUTENTRY(xad, XAD_NEW, xoff, xlen, xaddr);
1906 1901  
1907 1902 /* advance next available entry index */
1908   - p->header.nextindex =
1909   - cpu_to_le16(le16_to_cpu(p->header.nextindex) + 1);
  1903 + le16_add_cpu(&p->header.nextindex, 1);
1910 1904 }
1911 1905  
1912 1906 /* get back old XAD */
... ... @@ -2567,8 +2561,7 @@
2567 2561 XT_PUTENTRY(xad, xflag, xoff, xlen, xaddr);
2568 2562  
2569 2563 /* advance next available entry index */
2570   - p->header.nextindex =
2571   - cpu_to_le16(le16_to_cpu(p->header.nextindex) + 1);
  2564 + le16_add_cpu(&p->header.nextindex, 1);
2572 2565  
2573 2566 xtlck->lwm.offset =
2574 2567 (xtlck->lwm.offset) ? min(index,(int) xtlck->lwm.offset) : index;
... ... @@ -2631,8 +2624,7 @@
2631 2624 * delete the entry from the leaf page
2632 2625 */
2633 2626 nextindex = le16_to_cpu(p->header.nextindex);
2634   - p->header.nextindex =
2635   - cpu_to_le16(le16_to_cpu(p->header.nextindex) - 1);
  2627 + le16_add_cpu(&p->header.nextindex, -1);
2636 2628  
2637 2629 /*
2638 2630 * if the leaf page bocome empty, free the page
... ... @@ -2795,9 +2787,7 @@
2795 2787 (nextindex - index -
2796 2788 1) << L2XTSLOTSIZE);
2797 2789  
2798   - p->header.nextindex =
2799   - cpu_to_le16(le16_to_cpu(p->header.nextindex) -
2800   - 1);
  2790 + le16_add_cpu(&p->header.nextindex, -1);
2801 2791 jfs_info("xtDeleteUp(entry): 0x%lx[%d]",
2802 2792 (ulong) parent->bn, index);
2803 2793 }