diff options
-rw-r--r-- | fs/jfs/jfs_dmap.c | 11 | ||||
-rw-r--r-- | fs/jfs/jfs_imap.c | 15 | ||||
-rw-r--r-- | fs/jfs/jfs_xtree.c | 26 |
3 files changed, 19 insertions, 33 deletions
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index e1985066b1c6..2bc7d8aa5740 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c | |||
@@ -2172,7 +2172,7 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
2172 | } | 2172 | } |
2173 | 2173 | ||
2174 | /* update the free count for this dmap */ | 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 | BMAP_LOCK(bmp); | 2177 | BMAP_LOCK(bmp); |
2178 | 2178 | ||
@@ -2316,7 +2316,7 @@ static int dbFreeBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
2316 | 2316 | ||
2317 | /* update the free count for this dmap. | 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 | BMAP_LOCK(bmp); | 2321 | BMAP_LOCK(bmp); |
2322 | 2322 | ||
@@ -3226,7 +3226,7 @@ static int dbAllocDmapBU(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
3226 | } | 3226 | } |
3227 | 3227 | ||
3228 | /* update the free count for this dmap */ | 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 | /* reconstruct summary tree */ | 3231 | /* reconstruct summary tree */ |
3232 | dbInitDmapTree(dp); | 3232 | dbInitDmapTree(dp); |
@@ -3660,9 +3660,8 @@ static int dbInitDmap(struct dmap * dp, s64 Blkno, int nblocks) | |||
3660 | goto initTree; | 3660 | goto initTree; |
3661 | } | 3661 | } |
3662 | } else { | 3662 | } else { |
3663 | dp->nblocks = | 3663 | le32_add_cpu(&dp->nblocks, nblocks); |
3664 | cpu_to_le32(le32_to_cpu(dp->nblocks) + nblocks); | 3664 | le32_add_cpu(&dp->nfree, nblocks); |
3665 | dp->nfree = cpu_to_le32(le32_to_cpu(dp->nfree) + nblocks); | ||
3666 | } | 3665 | } |
3667 | 3666 | ||
3668 | /* word number containing start block number */ | 3667 | /* word number containing start block number */ |
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index 9bf29f771737..734ec916beaf 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c | |||
@@ -1019,8 +1019,7 @@ int diFree(struct inode *ip) | |||
1019 | /* update the free inode counts at the iag, ag and | 1019 | /* update the free inode counts at the iag, ag and |
1020 | * map level. | 1020 | * map level. |
1021 | */ | 1021 | */ |
1022 | iagp->nfreeinos = | 1022 | le32_add_cpu(&iagp->nfreeinos, 1); |
1023 | cpu_to_le32(le32_to_cpu(iagp->nfreeinos) + 1); | ||
1024 | imap->im_agctl[agno].numfree += 1; | 1023 | imap->im_agctl[agno].numfree += 1; |
1025 | atomic_inc(&imap->im_numfree); | 1024 | atomic_inc(&imap->im_numfree); |
1026 | 1025 | ||
@@ -1219,9 +1218,8 @@ int diFree(struct inode *ip) | |||
1219 | /* update the number of free inodes and number of free extents | 1218 | /* update the number of free inodes and number of free extents |
1220 | * for the iag. | 1219 | * for the iag. |
1221 | */ | 1220 | */ |
1222 | iagp->nfreeinos = cpu_to_le32(le32_to_cpu(iagp->nfreeinos) - | 1221 | le32_add_cpu(&iagp->nfreeinos, -(INOSPEREXT - 1)); |
1223 | (INOSPEREXT - 1)); | 1222 | le32_add_cpu(&iagp->nfreeexts, 1); |
1224 | iagp->nfreeexts = cpu_to_le32(le32_to_cpu(iagp->nfreeexts) + 1); | ||
1225 | 1223 | ||
1226 | /* update the number of free inodes and backed inodes | 1224 | /* update the number of free inodes and backed inodes |
1227 | * at the ag and inode map level. | 1225 | * at the ag and inode map level. |
@@ -2124,7 +2122,7 @@ static int diAllocBit(struct inomap * imap, struct iag * iagp, int ino) | |||
2124 | /* update the free inode count at the iag, ag, inode | 2122 | /* update the free inode count at the iag, ag, inode |
2125 | * map levels. | 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 | imap->im_agctl[agno].numfree -= 1; | 2126 | imap->im_agctl[agno].numfree -= 1; |
2129 | atomic_dec(&imap->im_numfree); | 2127 | atomic_dec(&imap->im_numfree); |
2130 | 2128 | ||
@@ -2378,9 +2376,8 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno) | |||
2378 | /* update the free inode and free extent counts for the | 2376 | /* update the free inode and free extent counts for the |
2379 | * iag. | 2377 | * iag. |
2380 | */ | 2378 | */ |
2381 | iagp->nfreeinos = cpu_to_le32(le32_to_cpu(iagp->nfreeinos) + | 2379 | le32_add_cpu(&iagp->nfreeinos, (INOSPEREXT - 1)); |
2382 | (INOSPEREXT - 1)); | 2380 | le32_add_cpu(&iagp->nfreeexts, -1); |
2383 | iagp->nfreeexts = cpu_to_le32(le32_to_cpu(iagp->nfreeexts) - 1); | ||
2384 | 2381 | ||
2385 | /* update the free and backed inode counts for the ag. | 2382 | /* update the free and backed inode counts for the ag. |
2386 | */ | 2383 | */ |
diff --git a/fs/jfs/jfs_xtree.c b/fs/jfs/jfs_xtree.c index a000aaa75136..5a61ebf2cbcc 100644 --- a/fs/jfs/jfs_xtree.c +++ b/fs/jfs/jfs_xtree.c | |||
@@ -905,8 +905,7 @@ int xtInsert(tid_t tid, /* transaction id */ | |||
905 | XT_PUTENTRY(xad, xflag, xoff, xlen, xaddr); | 905 | XT_PUTENTRY(xad, xflag, xoff, xlen, xaddr); |
906 | 906 | ||
907 | /* advance next available entry index */ | 907 | /* advance next available entry index */ |
908 | p->header.nextindex = | 908 | le16_add_cpu(&p->header.nextindex, 1); |
909 | cpu_to_le16(le16_to_cpu(p->header.nextindex) + 1); | ||
910 | 909 | ||
911 | /* Don't log it if there are no links to the file */ | 910 | /* Don't log it if there are no links to the file */ |
912 | if (!test_cflag(COMMIT_Nolink, ip)) { | 911 | if (!test_cflag(COMMIT_Nolink, ip)) { |
@@ -997,8 +996,7 @@ xtSplitUp(tid_t tid, | |||
997 | split->addr); | 996 | split->addr); |
998 | 997 | ||
999 | /* advance next available entry index */ | 998 | /* advance next available entry index */ |
1000 | sp->header.nextindex = | 999 | le16_add_cpu(&sp->header.nextindex, 1); |
1001 | cpu_to_le16(le16_to_cpu(sp->header.nextindex) + 1); | ||
1002 | 1000 | ||
1003 | /* Don't log it if there are no links to the file */ | 1001 | /* Don't log it if there are no links to the file */ |
1004 | if (!test_cflag(COMMIT_Nolink, ip)) { | 1002 | if (!test_cflag(COMMIT_Nolink, ip)) { |
@@ -1167,9 +1165,7 @@ xtSplitUp(tid_t tid, | |||
1167 | JFS_SBI(ip->i_sb)->nbperpage, rcbn); | 1165 | JFS_SBI(ip->i_sb)->nbperpage, rcbn); |
1168 | 1166 | ||
1169 | /* advance next available entry index. */ | 1167 | /* advance next available entry index. */ |
1170 | sp->header.nextindex = | 1168 | le16_add_cpu(&sp->header.nextindex, 1); |
1171 | cpu_to_le16(le16_to_cpu(sp->header.nextindex) + | ||
1172 | 1); | ||
1173 | 1169 | ||
1174 | /* Don't log it if there are no links to the file */ | 1170 | /* Don't log it if there are no links to the file */ |
1175 | if (!test_cflag(COMMIT_Nolink, ip)) { | 1171 | if (!test_cflag(COMMIT_Nolink, ip)) { |
@@ -1738,8 +1734,7 @@ int xtExtend(tid_t tid, /* transaction id */ | |||
1738 | XT_PUTENTRY(xad, XAD_NEW, xoff, len, xaddr); | 1734 | XT_PUTENTRY(xad, XAD_NEW, xoff, len, xaddr); |
1739 | 1735 | ||
1740 | /* advance next available entry index */ | 1736 | /* advance next available entry index */ |
1741 | p->header.nextindex = | 1737 | le16_add_cpu(&p->header.nextindex, 1); |
1742 | cpu_to_le16(le16_to_cpu(p->header.nextindex) + 1); | ||
1743 | } | 1738 | } |
1744 | 1739 | ||
1745 | /* get back old entry */ | 1740 | /* get back old entry */ |
@@ -1905,8 +1900,7 @@ printf("xtTailgate: xoff:0x%lx xlen:0x%x xaddr:0x%lx\n", | |||
1905 | XT_PUTENTRY(xad, XAD_NEW, xoff, xlen, xaddr); | 1900 | XT_PUTENTRY(xad, XAD_NEW, xoff, xlen, xaddr); |
1906 | 1901 | ||
1907 | /* advance next available entry index */ | 1902 | /* advance next available entry index */ |
1908 | p->header.nextindex = | 1903 | le16_add_cpu(&p->header.nextindex, 1); |
1909 | cpu_to_le16(le16_to_cpu(p->header.nextindex) + 1); | ||
1910 | } | 1904 | } |
1911 | 1905 | ||
1912 | /* get back old XAD */ | 1906 | /* get back old XAD */ |
@@ -2567,8 +2561,7 @@ int xtAppend(tid_t tid, /* transaction id */ | |||
2567 | XT_PUTENTRY(xad, xflag, xoff, xlen, xaddr); | 2561 | XT_PUTENTRY(xad, xflag, xoff, xlen, xaddr); |
2568 | 2562 | ||
2569 | /* advance next available entry index */ | 2563 | /* advance next available entry index */ |
2570 | p->header.nextindex = | 2564 | le16_add_cpu(&p->header.nextindex, 1); |
2571 | cpu_to_le16(le16_to_cpu(p->header.nextindex) + 1); | ||
2572 | 2565 | ||
2573 | xtlck->lwm.offset = | 2566 | xtlck->lwm.offset = |
2574 | (xtlck->lwm.offset) ? min(index,(int) xtlck->lwm.offset) : index; | 2567 | (xtlck->lwm.offset) ? min(index,(int) xtlck->lwm.offset) : index; |
@@ -2631,8 +2624,7 @@ int xtDelete(tid_t tid, struct inode *ip, s64 xoff, s32 xlen, int flag) | |||
2631 | * delete the entry from the leaf page | 2624 | * delete the entry from the leaf page |
2632 | */ | 2625 | */ |
2633 | nextindex = le16_to_cpu(p->header.nextindex); | 2626 | nextindex = le16_to_cpu(p->header.nextindex); |
2634 | p->header.nextindex = | 2627 | le16_add_cpu(&p->header.nextindex, -1); |
2635 | cpu_to_le16(le16_to_cpu(p->header.nextindex) - 1); | ||
2636 | 2628 | ||
2637 | /* | 2629 | /* |
2638 | * if the leaf page bocome empty, free the page | 2630 | * if the leaf page bocome empty, free the page |
@@ -2795,9 +2787,7 @@ xtDeleteUp(tid_t tid, struct inode *ip, | |||
2795 | (nextindex - index - | 2787 | (nextindex - index - |
2796 | 1) << L2XTSLOTSIZE); | 2788 | 1) << L2XTSLOTSIZE); |
2797 | 2789 | ||
2798 | p->header.nextindex = | 2790 | le16_add_cpu(&p->header.nextindex, -1); |
2799 | cpu_to_le16(le16_to_cpu(p->header.nextindex) - | ||
2800 | 1); | ||
2801 | jfs_info("xtDeleteUp(entry): 0x%lx[%d]", | 2791 | jfs_info("xtDeleteUp(entry): 0x%lx[%d]", |
2802 | (ulong) parent->bn, index); | 2792 | (ulong) parent->bn, index); |
2803 | } | 2793 | } |