aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/Kbuild6
-rw-r--r--fs/xfs/Makefile118
-rw-r--r--fs/xfs/Makefile-linux-2.6117
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c8
-rw-r--r--fs/xfs/quota/xfs_qm.c6
-rw-r--r--fs/xfs/quota/xfs_trans_dquot.c6
-rw-r--r--fs/xfs/xfs_alloc.c16
-rw-r--r--fs/xfs/xfs_alloc_btree.c16
-rw-r--r--fs/xfs/xfs_arch.h15
-rw-r--r--fs/xfs/xfs_attr_leaf.c46
-rw-r--r--fs/xfs/xfs_bmap_btree.c16
-rw-r--r--fs/xfs/xfs_da_btree.c14
-rw-r--r--fs/xfs/xfs_dir2_block.c8
-rw-r--r--fs/xfs/xfs_dir2_data.c4
-rw-r--r--fs/xfs/xfs_dir2_leaf.c16
-rw-r--r--fs/xfs/xfs_dir2_node.c18
-rw-r--r--fs/xfs/xfs_fsops.c4
-rw-r--r--fs/xfs/xfs_ialloc.c12
-rw-r--r--fs/xfs/xfs_ialloc_btree.c16
-rw-r--r--fs/xfs/xfs_log.c6
-rw-r--r--fs/xfs/xfs_trans.c24
21 files changed, 235 insertions, 257 deletions
diff --git a/fs/xfs/Kbuild b/fs/xfs/Kbuild
deleted file mode 100644
index 2566e96706f1..000000000000
--- a/fs/xfs/Kbuild
+++ /dev/null
@@ -1,6 +0,0 @@
1#
2# The xfs people like to share Makefile with 2.6 and 2.4.
3# Utilise file named Kbuild file which has precedence over Makefile.
4#
5
6include $(srctree)/$(obj)/Makefile-linux-2.6
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index 49e3e7e5e3dc..36ec614e699a 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -1 +1,117 @@
1include $(TOPDIR)/fs/xfs/Makefile-linux-$(VERSION).$(PATCHLEVEL) 1#
2# Copyright (c) 2000-2005 Silicon Graphics, Inc.
3# All Rights Reserved.
4#
5# This program is free software; you can redistribute it and/or
6# modify it under the terms of the GNU General Public License as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it would be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write the Free Software Foundation,
16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17#
18
19EXTRA_CFLAGS += -I$(src) -I$(src)/linux-2.6 -funsigned-char
20
21XFS_LINUX := linux-2.6
22
23ifeq ($(CONFIG_XFS_DEBUG),y)
24 EXTRA_CFLAGS += -g
25endif
26
27obj-$(CONFIG_XFS_FS) += xfs.o
28
29xfs-$(CONFIG_XFS_QUOTA) += $(addprefix quota/, \
30 xfs_dquot.o \
31 xfs_dquot_item.o \
32 xfs_trans_dquot.o \
33 xfs_qm_syscalls.o \
34 xfs_qm_bhv.o \
35 xfs_qm.o)
36
37ifeq ($(CONFIG_XFS_QUOTA),y)
38xfs-$(CONFIG_PROC_FS) += quota/xfs_qm_stats.o
39endif
40
41xfs-$(CONFIG_XFS_RT) += xfs_rtalloc.o
42xfs-$(CONFIG_XFS_POSIX_ACL) += xfs_acl.o
43xfs-$(CONFIG_PROC_FS) += $(XFS_LINUX)/xfs_stats.o
44xfs-$(CONFIG_SYSCTL) += $(XFS_LINUX)/xfs_sysctl.o
45xfs-$(CONFIG_COMPAT) += $(XFS_LINUX)/xfs_ioctl32.o
46
47
48xfs-y += xfs_alloc.o \
49 xfs_alloc_btree.o \
50 xfs_attr.o \
51 xfs_attr_leaf.o \
52 xfs_bit.o \
53 xfs_bmap.o \
54 xfs_bmap_btree.o \
55 xfs_btree.o \
56 xfs_buf_item.o \
57 xfs_da_btree.o \
58 xfs_dir2.o \
59 xfs_dir2_block.o \
60 xfs_dir2_data.o \
61 xfs_dir2_leaf.o \
62 xfs_dir2_node.o \
63 xfs_dir2_sf.o \
64 xfs_error.o \
65 xfs_extfree_item.o \
66 xfs_filestream.o \
67 xfs_fsops.o \
68 xfs_ialloc.o \
69 xfs_ialloc_btree.o \
70 xfs_iget.o \
71 xfs_inode.o \
72 xfs_inode_item.o \
73 xfs_iomap.o \
74 xfs_itable.o \
75 xfs_dfrag.o \
76 xfs_log.o \
77 xfs_log_recover.o \
78 xfs_mount.o \
79 xfs_mru_cache.o \
80 xfs_rename.o \
81 xfs_trans.o \
82 xfs_trans_ail.o \
83 xfs_trans_buf.o \
84 xfs_trans_extfree.o \
85 xfs_trans_inode.o \
86 xfs_trans_item.o \
87 xfs_utils.o \
88 xfs_vfsops.o \
89 xfs_vnodeops.o \
90 xfs_rw.o \
91 xfs_dmops.o \
92 xfs_qmops.o
93
94xfs-$(CONFIG_XFS_TRACE) += xfs_dir2_trace.o
95
96# Objects in linux/
97xfs-y += $(addprefix $(XFS_LINUX)/, \
98 kmem.o \
99 xfs_aops.o \
100 xfs_buf.o \
101 xfs_export.o \
102 xfs_file.o \
103 xfs_fs_subr.o \
104 xfs_globals.o \
105 xfs_ioctl.o \
106 xfs_iops.o \
107 xfs_lrw.o \
108 xfs_super.o \
109 xfs_vnode.o)
110
111# Objects in support/
112xfs-y += $(addprefix support/, \
113 debug.o \
114 uuid.o)
115
116xfs-$(CONFIG_XFS_TRACE) += support/ktrace.o
117
diff --git a/fs/xfs/Makefile-linux-2.6 b/fs/xfs/Makefile-linux-2.6
deleted file mode 100644
index 97316451fc6d..000000000000
--- a/fs/xfs/Makefile-linux-2.6
+++ /dev/null
@@ -1,117 +0,0 @@
1#
2# Copyright (c) 2000-2005 Silicon Graphics, Inc.
3# All Rights Reserved.
4#
5# This program is free software; you can redistribute it and/or
6# modify it under the terms of the GNU General Public License as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it would be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write the Free Software Foundation,
16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17#
18
19EXTRA_CFLAGS += -Ifs/xfs -Ifs/xfs/linux-2.6 -funsigned-char
20
21XFS_LINUX := linux-2.6
22
23ifeq ($(CONFIG_XFS_DEBUG),y)
24 EXTRA_CFLAGS += -g
25endif
26
27obj-$(CONFIG_XFS_FS) += xfs.o
28
29xfs-$(CONFIG_XFS_QUOTA) += $(addprefix quota/, \
30 xfs_dquot.o \
31 xfs_dquot_item.o \
32 xfs_trans_dquot.o \
33 xfs_qm_syscalls.o \
34 xfs_qm_bhv.o \
35 xfs_qm.o)
36
37ifeq ($(CONFIG_XFS_QUOTA),y)
38xfs-$(CONFIG_PROC_FS) += quota/xfs_qm_stats.o
39endif
40
41xfs-$(CONFIG_XFS_RT) += xfs_rtalloc.o
42xfs-$(CONFIG_XFS_POSIX_ACL) += xfs_acl.o
43xfs-$(CONFIG_PROC_FS) += $(XFS_LINUX)/xfs_stats.o
44xfs-$(CONFIG_SYSCTL) += $(XFS_LINUX)/xfs_sysctl.o
45xfs-$(CONFIG_COMPAT) += $(XFS_LINUX)/xfs_ioctl32.o
46
47
48xfs-y += xfs_alloc.o \
49 xfs_alloc_btree.o \
50 xfs_attr.o \
51 xfs_attr_leaf.o \
52 xfs_bit.o \
53 xfs_bmap.o \
54 xfs_bmap_btree.o \
55 xfs_btree.o \
56 xfs_buf_item.o \
57 xfs_da_btree.o \
58 xfs_dir2.o \
59 xfs_dir2_block.o \
60 xfs_dir2_data.o \
61 xfs_dir2_leaf.o \
62 xfs_dir2_node.o \
63 xfs_dir2_sf.o \
64 xfs_error.o \
65 xfs_extfree_item.o \
66 xfs_filestream.o \
67 xfs_fsops.o \
68 xfs_ialloc.o \
69 xfs_ialloc_btree.o \
70 xfs_iget.o \
71 xfs_inode.o \
72 xfs_inode_item.o \
73 xfs_iomap.o \
74 xfs_itable.o \
75 xfs_dfrag.o \
76 xfs_log.o \
77 xfs_log_recover.o \
78 xfs_mount.o \
79 xfs_mru_cache.o \
80 xfs_rename.o \
81 xfs_trans.o \
82 xfs_trans_ail.o \
83 xfs_trans_buf.o \
84 xfs_trans_extfree.o \
85 xfs_trans_inode.o \
86 xfs_trans_item.o \
87 xfs_utils.o \
88 xfs_vfsops.o \
89 xfs_vnodeops.o \
90 xfs_rw.o \
91 xfs_dmops.o \
92 xfs_qmops.o
93
94xfs-$(CONFIG_XFS_TRACE) += xfs_dir2_trace.o
95
96# Objects in linux/
97xfs-y += $(addprefix $(XFS_LINUX)/, \
98 kmem.o \
99 xfs_aops.o \
100 xfs_buf.o \
101 xfs_export.o \
102 xfs_file.o \
103 xfs_fs_subr.o \
104 xfs_globals.o \
105 xfs_ioctl.o \
106 xfs_iops.o \
107 xfs_lrw.o \
108 xfs_super.o \
109 xfs_vnode.o)
110
111# Objects in support/
112xfs-y += $(addprefix support/, \
113 debug.o \
114 uuid.o)
115
116xfs-$(CONFIG_XFS_TRACE) += support/ktrace.o
117
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 4c82a050a3a8..a9952e490ac9 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -91,10 +91,10 @@ xfs_find_handle(
91 if (error) 91 if (error)
92 return error; 92 return error;
93 93
94 ASSERT(nd.dentry); 94 ASSERT(nd.path.dentry);
95 ASSERT(nd.dentry->d_inode); 95 ASSERT(nd.path.dentry->d_inode);
96 inode = igrab(nd.dentry->d_inode); 96 inode = igrab(nd.path.dentry->d_inode);
97 path_release(&nd); 97 path_put(&nd.path);
98 break; 98 break;
99 } 99 }
100 100
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index 35582fe9d648..1f3da5b8657b 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -1648,14 +1648,14 @@ xfs_qm_quotacheck_dqadjust(
1648 * Adjust the inode count and the block count to reflect this inode's 1648 * Adjust the inode count and the block count to reflect this inode's
1649 * resource usage. 1649 * resource usage.
1650 */ 1650 */
1651 be64_add(&dqp->q_core.d_icount, 1); 1651 be64_add_cpu(&dqp->q_core.d_icount, 1);
1652 dqp->q_res_icount++; 1652 dqp->q_res_icount++;
1653 if (nblks) { 1653 if (nblks) {
1654 be64_add(&dqp->q_core.d_bcount, nblks); 1654 be64_add_cpu(&dqp->q_core.d_bcount, nblks);
1655 dqp->q_res_bcount += nblks; 1655 dqp->q_res_bcount += nblks;
1656 } 1656 }
1657 if (rtblks) { 1657 if (rtblks) {
1658 be64_add(&dqp->q_core.d_rtbcount, rtblks); 1658 be64_add_cpu(&dqp->q_core.d_rtbcount, rtblks);
1659 dqp->q_res_rtbcount += rtblks; 1659 dqp->q_res_rtbcount += rtblks;
1660 } 1660 }
1661 1661
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c
index 7de6874bf1b8..f441f836ca8b 100644
--- a/fs/xfs/quota/xfs_trans_dquot.c
+++ b/fs/xfs/quota/xfs_trans_dquot.c
@@ -421,13 +421,13 @@ xfs_trans_apply_dquot_deltas(
421 (xfs_qcnt_t) -qtrx->qt_icount_delta); 421 (xfs_qcnt_t) -qtrx->qt_icount_delta);
422#endif 422#endif
423 if (totalbdelta) 423 if (totalbdelta)
424 be64_add(&d->d_bcount, (xfs_qcnt_t)totalbdelta); 424 be64_add_cpu(&d->d_bcount, (xfs_qcnt_t)totalbdelta);
425 425
426 if (qtrx->qt_icount_delta) 426 if (qtrx->qt_icount_delta)
427 be64_add(&d->d_icount, (xfs_qcnt_t)qtrx->qt_icount_delta); 427 be64_add_cpu(&d->d_icount, (xfs_qcnt_t)qtrx->qt_icount_delta);
428 428
429 if (totalrtbdelta) 429 if (totalrtbdelta)
430 be64_add(&d->d_rtbcount, (xfs_qcnt_t)totalrtbdelta); 430 be64_add_cpu(&d->d_rtbcount, (xfs_qcnt_t)totalrtbdelta);
431 431
432 /* 432 /*
433 * Get any default limits in use. 433 * Get any default limits in use.
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index ea6aa60ace06..bdbfbbee4959 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -592,7 +592,7 @@ xfs_alloc_ag_vextent(
592 if (!(args->wasfromfl)) { 592 if (!(args->wasfromfl)) {
593 593
594 agf = XFS_BUF_TO_AGF(args->agbp); 594 agf = XFS_BUF_TO_AGF(args->agbp);
595 be32_add(&agf->agf_freeblks, -(args->len)); 595 be32_add_cpu(&agf->agf_freeblks, -(args->len));
596 xfs_trans_agblocks_delta(args->tp, 596 xfs_trans_agblocks_delta(args->tp,
597 -((long)(args->len))); 597 -((long)(args->len)));
598 args->pag->pagf_freeblks -= args->len; 598 args->pag->pagf_freeblks -= args->len;
@@ -1720,7 +1720,7 @@ xfs_free_ag_extent(
1720 1720
1721 agf = XFS_BUF_TO_AGF(agbp); 1721 agf = XFS_BUF_TO_AGF(agbp);
1722 pag = &mp->m_perag[agno]; 1722 pag = &mp->m_perag[agno];
1723 be32_add(&agf->agf_freeblks, len); 1723 be32_add_cpu(&agf->agf_freeblks, len);
1724 xfs_trans_agblocks_delta(tp, len); 1724 xfs_trans_agblocks_delta(tp, len);
1725 pag->pagf_freeblks += len; 1725 pag->pagf_freeblks += len;
1726 XFS_WANT_CORRUPTED_GOTO( 1726 XFS_WANT_CORRUPTED_GOTO(
@@ -2008,18 +2008,18 @@ xfs_alloc_get_freelist(
2008 * Get the block number and update the data structures. 2008 * Get the block number and update the data structures.
2009 */ 2009 */
2010 bno = be32_to_cpu(agfl->agfl_bno[be32_to_cpu(agf->agf_flfirst)]); 2010 bno = be32_to_cpu(agfl->agfl_bno[be32_to_cpu(agf->agf_flfirst)]);
2011 be32_add(&agf->agf_flfirst, 1); 2011 be32_add_cpu(&agf->agf_flfirst, 1);
2012 xfs_trans_brelse(tp, agflbp); 2012 xfs_trans_brelse(tp, agflbp);
2013 if (be32_to_cpu(agf->agf_flfirst) == XFS_AGFL_SIZE(mp)) 2013 if (be32_to_cpu(agf->agf_flfirst) == XFS_AGFL_SIZE(mp))
2014 agf->agf_flfirst = 0; 2014 agf->agf_flfirst = 0;
2015 pag = &mp->m_perag[be32_to_cpu(agf->agf_seqno)]; 2015 pag = &mp->m_perag[be32_to_cpu(agf->agf_seqno)];
2016 be32_add(&agf->agf_flcount, -1); 2016 be32_add_cpu(&agf->agf_flcount, -1);
2017 xfs_trans_agflist_delta(tp, -1); 2017 xfs_trans_agflist_delta(tp, -1);
2018 pag->pagf_flcount--; 2018 pag->pagf_flcount--;
2019 2019
2020 logflags = XFS_AGF_FLFIRST | XFS_AGF_FLCOUNT; 2020 logflags = XFS_AGF_FLFIRST | XFS_AGF_FLCOUNT;
2021 if (btreeblk) { 2021 if (btreeblk) {
2022 be32_add(&agf->agf_btreeblks, 1); 2022 be32_add_cpu(&agf->agf_btreeblks, 1);
2023 pag->pagf_btreeblks++; 2023 pag->pagf_btreeblks++;
2024 logflags |= XFS_AGF_BTREEBLKS; 2024 logflags |= XFS_AGF_BTREEBLKS;
2025 } 2025 }
@@ -2117,17 +2117,17 @@ xfs_alloc_put_freelist(
2117 be32_to_cpu(agf->agf_seqno), &agflbp))) 2117 be32_to_cpu(agf->agf_seqno), &agflbp)))
2118 return error; 2118 return error;
2119 agfl = XFS_BUF_TO_AGFL(agflbp); 2119 agfl = XFS_BUF_TO_AGFL(agflbp);
2120 be32_add(&agf->agf_fllast, 1); 2120 be32_add_cpu(&agf->agf_fllast, 1);
2121 if (be32_to_cpu(agf->agf_fllast) == XFS_AGFL_SIZE(mp)) 2121 if (be32_to_cpu(agf->agf_fllast) == XFS_AGFL_SIZE(mp))
2122 agf->agf_fllast = 0; 2122 agf->agf_fllast = 0;
2123 pag = &mp->m_perag[be32_to_cpu(agf->agf_seqno)]; 2123 pag = &mp->m_perag[be32_to_cpu(agf->agf_seqno)];
2124 be32_add(&agf->agf_flcount, 1); 2124 be32_add_cpu(&agf->agf_flcount, 1);
2125 xfs_trans_agflist_delta(tp, 1); 2125 xfs_trans_agflist_delta(tp, 1);
2126 pag->pagf_flcount++; 2126 pag->pagf_flcount++;
2127 2127
2128 logflags = XFS_AGF_FLLAST | XFS_AGF_FLCOUNT; 2128 logflags = XFS_AGF_FLLAST | XFS_AGF_FLCOUNT;
2129 if (btreeblk) { 2129 if (btreeblk) {
2130 be32_add(&agf->agf_btreeblks, -1); 2130 be32_add_cpu(&agf->agf_btreeblks, -1);
2131 pag->pagf_btreeblks--; 2131 pag->pagf_btreeblks--;
2132 logflags |= XFS_AGF_BTREEBLKS; 2132 logflags |= XFS_AGF_BTREEBLKS;
2133 } 2133 }
diff --git a/fs/xfs/xfs_alloc_btree.c b/fs/xfs/xfs_alloc_btree.c
index 1603ce595853..3ce2645508ae 100644
--- a/fs/xfs/xfs_alloc_btree.c
+++ b/fs/xfs/xfs_alloc_btree.c
@@ -221,7 +221,7 @@ xfs_alloc_delrec(
221 */ 221 */
222 bno = be32_to_cpu(agf->agf_roots[cur->bc_btnum]); 222 bno = be32_to_cpu(agf->agf_roots[cur->bc_btnum]);
223 agf->agf_roots[cur->bc_btnum] = *lpp; 223 agf->agf_roots[cur->bc_btnum] = *lpp;
224 be32_add(&agf->agf_levels[cur->bc_btnum], -1); 224 be32_add_cpu(&agf->agf_levels[cur->bc_btnum], -1);
225 mp->m_perag[be32_to_cpu(agf->agf_seqno)].pagf_levels[cur->bc_btnum]--; 225 mp->m_perag[be32_to_cpu(agf->agf_seqno)].pagf_levels[cur->bc_btnum]--;
226 /* 226 /*
227 * Put this buffer/block on the ag's freelist. 227 * Put this buffer/block on the ag's freelist.
@@ -1256,9 +1256,9 @@ xfs_alloc_lshift(
1256 /* 1256 /*
1257 * Bump and log left's numrecs, decrement and log right's numrecs. 1257 * Bump and log left's numrecs, decrement and log right's numrecs.
1258 */ 1258 */
1259 be16_add(&left->bb_numrecs, 1); 1259 be16_add_cpu(&left->bb_numrecs, 1);
1260 xfs_alloc_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS); 1260 xfs_alloc_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS);
1261 be16_add(&right->bb_numrecs, -1); 1261 be16_add_cpu(&right->bb_numrecs, -1);
1262 xfs_alloc_log_block(cur->bc_tp, rbp, XFS_BB_NUMRECS); 1262 xfs_alloc_log_block(cur->bc_tp, rbp, XFS_BB_NUMRECS);
1263 /* 1263 /*
1264 * Slide the contents of right down one entry. 1264 * Slide the contents of right down one entry.
@@ -1346,7 +1346,7 @@ xfs_alloc_newroot(
1346 1346
1347 agf = XFS_BUF_TO_AGF(cur->bc_private.a.agbp); 1347 agf = XFS_BUF_TO_AGF(cur->bc_private.a.agbp);
1348 agf->agf_roots[cur->bc_btnum] = cpu_to_be32(nbno); 1348 agf->agf_roots[cur->bc_btnum] = cpu_to_be32(nbno);
1349 be32_add(&agf->agf_levels[cur->bc_btnum], 1); 1349 be32_add_cpu(&agf->agf_levels[cur->bc_btnum], 1);
1350 seqno = be32_to_cpu(agf->agf_seqno); 1350 seqno = be32_to_cpu(agf->agf_seqno);
1351 mp->m_perag[seqno].pagf_levels[cur->bc_btnum]++; 1351 mp->m_perag[seqno].pagf_levels[cur->bc_btnum]++;
1352 xfs_alloc_log_agf(cur->bc_tp, cur->bc_private.a.agbp, 1352 xfs_alloc_log_agf(cur->bc_tp, cur->bc_private.a.agbp,
@@ -1558,9 +1558,9 @@ xfs_alloc_rshift(
1558 /* 1558 /*
1559 * Decrement and log left's numrecs, bump and log right's numrecs. 1559 * Decrement and log left's numrecs, bump and log right's numrecs.
1560 */ 1560 */
1561 be16_add(&left->bb_numrecs, -1); 1561 be16_add_cpu(&left->bb_numrecs, -1);
1562 xfs_alloc_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS); 1562 xfs_alloc_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS);
1563 be16_add(&right->bb_numrecs, 1); 1563 be16_add_cpu(&right->bb_numrecs, 1);
1564 xfs_alloc_log_block(cur->bc_tp, rbp, XFS_BB_NUMRECS); 1564 xfs_alloc_log_block(cur->bc_tp, rbp, XFS_BB_NUMRECS);
1565 /* 1565 /*
1566 * Using a temporary cursor, update the parent key values of the 1566 * Using a temporary cursor, update the parent key values of the
@@ -1643,7 +1643,7 @@ xfs_alloc_split(
1643 */ 1643 */
1644 if ((be16_to_cpu(left->bb_numrecs) & 1) && 1644 if ((be16_to_cpu(left->bb_numrecs) & 1) &&
1645 cur->bc_ptrs[level] <= be16_to_cpu(right->bb_numrecs) + 1) 1645 cur->bc_ptrs[level] <= be16_to_cpu(right->bb_numrecs) + 1)
1646 be16_add(&right->bb_numrecs, 1); 1646 be16_add_cpu(&right->bb_numrecs, 1);
1647 i = be16_to_cpu(left->bb_numrecs) - be16_to_cpu(right->bb_numrecs) + 1; 1647 i = be16_to_cpu(left->bb_numrecs) - be16_to_cpu(right->bb_numrecs) + 1;
1648 /* 1648 /*
1649 * For non-leaf blocks, copy keys and addresses over to the new block. 1649 * For non-leaf blocks, copy keys and addresses over to the new block.
@@ -1689,7 +1689,7 @@ xfs_alloc_split(
1689 * Adjust numrecs, sibling pointers. 1689 * Adjust numrecs, sibling pointers.
1690 */ 1690 */
1691 lbno = XFS_DADDR_TO_AGBNO(cur->bc_mp, XFS_BUF_ADDR(lbp)); 1691 lbno = XFS_DADDR_TO_AGBNO(cur->bc_mp, XFS_BUF_ADDR(lbp));
1692 be16_add(&left->bb_numrecs, -(be16_to_cpu(right->bb_numrecs))); 1692 be16_add_cpu(&left->bb_numrecs, -(be16_to_cpu(right->bb_numrecs)));
1693 right->bb_rightsib = left->bb_rightsib; 1693 right->bb_rightsib = left->bb_rightsib;
1694 left->bb_rightsib = cpu_to_be32(rbno); 1694 left->bb_rightsib = cpu_to_be32(rbno);
1695 right->bb_leftsib = cpu_to_be32(lbno); 1695 right->bb_leftsib = cpu_to_be32(lbno);
diff --git a/fs/xfs/xfs_arch.h b/fs/xfs/xfs_arch.h
index c4836890b726..f9472a2076d4 100644
--- a/fs/xfs/xfs_arch.h
+++ b/fs/xfs/xfs_arch.h
@@ -170,21 +170,6 @@
170 } \ 170 } \
171} 171}
172 172
173static inline void be16_add(__be16 *a, __s16 b)
174{
175 *a = cpu_to_be16(be16_to_cpu(*a) + b);
176}
177
178static inline void be32_add(__be32 *a, __s32 b)
179{
180 *a = cpu_to_be32(be32_to_cpu(*a) + b);
181}
182
183static inline void be64_add(__be64 *a, __s64 b)
184{
185 *a = cpu_to_be64(be64_to_cpu(*a) + b);
186}
187
188/* 173/*
189 * In directories inode numbers are stored as unaligned arrays of unsigned 174 * In directories inode numbers are stored as unaligned arrays of unsigned
190 * 8bit integers on disk. 175 * 8bit integers on disk.
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
index eb3815ebb7aa..b08e2a2a8add 100644
--- a/fs/xfs/xfs_attr_leaf.c
+++ b/fs/xfs/xfs_attr_leaf.c
@@ -317,7 +317,7 @@ xfs_attr_shortform_add(xfs_da_args_t *args, int forkoff)
317 memcpy(sfe->nameval, args->name, args->namelen); 317 memcpy(sfe->nameval, args->name, args->namelen);
318 memcpy(&sfe->nameval[args->namelen], args->value, args->valuelen); 318 memcpy(&sfe->nameval[args->namelen], args->value, args->valuelen);
319 sf->hdr.count++; 319 sf->hdr.count++;
320 be16_add(&sf->hdr.totsize, size); 320 be16_add_cpu(&sf->hdr.totsize, size);
321 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA); 321 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA);
322 322
323 xfs_sbversion_add_attr2(mp, args->trans); 323 xfs_sbversion_add_attr2(mp, args->trans);
@@ -363,7 +363,7 @@ xfs_attr_shortform_remove(xfs_da_args_t *args)
363 if (end != totsize) 363 if (end != totsize)
364 memmove(&((char *)sf)[base], &((char *)sf)[end], totsize - end); 364 memmove(&((char *)sf)[base], &((char *)sf)[end], totsize - end);
365 sf->hdr.count--; 365 sf->hdr.count--;
366 be16_add(&sf->hdr.totsize, -size); 366 be16_add_cpu(&sf->hdr.totsize, -size);
367 367
368 /* 368 /*
369 * Fix up the start offset of the attribute fork 369 * Fix up the start offset of the attribute fork
@@ -1133,7 +1133,7 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
1133 xfs_da_log_buf(args->trans, bp, 1133 xfs_da_log_buf(args->trans, bp,
1134 XFS_DA_LOGRANGE(leaf, entry, tmp + sizeof(*entry))); 1134 XFS_DA_LOGRANGE(leaf, entry, tmp + sizeof(*entry)));
1135 } 1135 }
1136 be16_add(&hdr->count, 1); 1136 be16_add_cpu(&hdr->count, 1);
1137 1137
1138 /* 1138 /*
1139 * Allocate space for the new string (at the end of the run). 1139 * Allocate space for the new string (at the end of the run).
@@ -1147,7 +1147,7 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
1147 mp->m_sb.sb_blocksize, NULL)); 1147 mp->m_sb.sb_blocksize, NULL));
1148 ASSERT(be16_to_cpu(map->size) < XFS_LBSIZE(mp)); 1148 ASSERT(be16_to_cpu(map->size) < XFS_LBSIZE(mp));
1149 ASSERT((be16_to_cpu(map->size) & 0x3) == 0); 1149 ASSERT((be16_to_cpu(map->size) & 0x3) == 0);
1150 be16_add(&map->size, 1150 be16_add_cpu(&map->size,
1151 -xfs_attr_leaf_newentsize(args->namelen, args->valuelen, 1151 -xfs_attr_leaf_newentsize(args->namelen, args->valuelen,
1152 mp->m_sb.sb_blocksize, &tmp)); 1152 mp->m_sb.sb_blocksize, &tmp));
1153 entry->nameidx = cpu_to_be16(be16_to_cpu(map->base) + 1153 entry->nameidx = cpu_to_be16(be16_to_cpu(map->base) +
@@ -1214,12 +1214,12 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
1214 map = &hdr->freemap[0]; 1214 map = &hdr->freemap[0];
1215 for (i = 0; i < XFS_ATTR_LEAF_MAPSIZE; map++, i++) { 1215 for (i = 0; i < XFS_ATTR_LEAF_MAPSIZE; map++, i++) {
1216 if (be16_to_cpu(map->base) == tmp) { 1216 if (be16_to_cpu(map->base) == tmp) {
1217 be16_add(&map->base, sizeof(xfs_attr_leaf_entry_t)); 1217 be16_add_cpu(&map->base, sizeof(xfs_attr_leaf_entry_t));
1218 be16_add(&map->size, 1218 be16_add_cpu(&map->size,
1219 -((int)sizeof(xfs_attr_leaf_entry_t))); 1219 -((int)sizeof(xfs_attr_leaf_entry_t)));
1220 } 1220 }
1221 } 1221 }
1222 be16_add(&hdr->usedbytes, xfs_attr_leaf_entsize(leaf, args->index)); 1222 be16_add_cpu(&hdr->usedbytes, xfs_attr_leaf_entsize(leaf, args->index));
1223 xfs_da_log_buf(args->trans, bp, 1223 xfs_da_log_buf(args->trans, bp,
1224 XFS_DA_LOGRANGE(leaf, hdr, sizeof(*hdr))); 1224 XFS_DA_LOGRANGE(leaf, hdr, sizeof(*hdr)));
1225 return(0); 1225 return(0);
@@ -1727,9 +1727,9 @@ xfs_attr_leaf_remove(xfs_dabuf_t *bp, xfs_da_args_t *args)
1727 ASSERT(be16_to_cpu(map->base) < XFS_LBSIZE(mp)); 1727 ASSERT(be16_to_cpu(map->base) < XFS_LBSIZE(mp));
1728 ASSERT(be16_to_cpu(map->size) < XFS_LBSIZE(mp)); 1728 ASSERT(be16_to_cpu(map->size) < XFS_LBSIZE(mp));
1729 if (be16_to_cpu(map->base) == tablesize) { 1729 if (be16_to_cpu(map->base) == tablesize) {
1730 be16_add(&map->base, 1730 be16_add_cpu(&map->base,
1731 -((int)sizeof(xfs_attr_leaf_entry_t))); 1731 -((int)sizeof(xfs_attr_leaf_entry_t)));
1732 be16_add(&map->size, sizeof(xfs_attr_leaf_entry_t)); 1732 be16_add_cpu(&map->size, sizeof(xfs_attr_leaf_entry_t));
1733 } 1733 }
1734 1734
1735 if ((be16_to_cpu(map->base) + be16_to_cpu(map->size)) 1735 if ((be16_to_cpu(map->base) + be16_to_cpu(map->size))
@@ -1751,19 +1751,19 @@ xfs_attr_leaf_remove(xfs_dabuf_t *bp, xfs_da_args_t *args)
1751 if ((before >= 0) || (after >= 0)) { 1751 if ((before >= 0) || (after >= 0)) {
1752 if ((before >= 0) && (after >= 0)) { 1752 if ((before >= 0) && (after >= 0)) {
1753 map = &hdr->freemap[before]; 1753 map = &hdr->freemap[before];
1754 be16_add(&map->size, entsize); 1754 be16_add_cpu(&map->size, entsize);
1755 be16_add(&map->size, 1755 be16_add_cpu(&map->size,
1756 be16_to_cpu(hdr->freemap[after].size)); 1756 be16_to_cpu(hdr->freemap[after].size));
1757 hdr->freemap[after].base = 0; 1757 hdr->freemap[after].base = 0;
1758 hdr->freemap[after].size = 0; 1758 hdr->freemap[after].size = 0;
1759 } else if (before >= 0) { 1759 } else if (before >= 0) {
1760 map = &hdr->freemap[before]; 1760 map = &hdr->freemap[before];
1761 be16_add(&map->size, entsize); 1761 be16_add_cpu(&map->size, entsize);
1762 } else { 1762 } else {
1763 map = &hdr->freemap[after]; 1763 map = &hdr->freemap[after];
1764 /* both on-disk, don't endian flip twice */ 1764 /* both on-disk, don't endian flip twice */
1765 map->base = entry->nameidx; 1765 map->base = entry->nameidx;
1766 be16_add(&map->size, entsize); 1766 be16_add_cpu(&map->size, entsize);
1767 } 1767 }
1768 } else { 1768 } else {
1769 /* 1769 /*
@@ -1788,7 +1788,7 @@ xfs_attr_leaf_remove(xfs_dabuf_t *bp, xfs_da_args_t *args)
1788 * Compress the remaining entries and zero out the removed stuff. 1788 * Compress the remaining entries and zero out the removed stuff.
1789 */ 1789 */
1790 memset(XFS_ATTR_LEAF_NAME(leaf, args->index), 0, entsize); 1790 memset(XFS_ATTR_LEAF_NAME(leaf, args->index), 0, entsize);
1791 be16_add(&hdr->usedbytes, -entsize); 1791 be16_add_cpu(&hdr->usedbytes, -entsize);
1792 xfs_da_log_buf(args->trans, bp, 1792 xfs_da_log_buf(args->trans, bp,
1793 XFS_DA_LOGRANGE(leaf, XFS_ATTR_LEAF_NAME(leaf, args->index), 1793 XFS_DA_LOGRANGE(leaf, XFS_ATTR_LEAF_NAME(leaf, args->index),
1794 entsize)); 1794 entsize));
@@ -1796,7 +1796,7 @@ xfs_attr_leaf_remove(xfs_dabuf_t *bp, xfs_da_args_t *args)
1796 tmp = (be16_to_cpu(hdr->count) - args->index) 1796 tmp = (be16_to_cpu(hdr->count) - args->index)
1797 * sizeof(xfs_attr_leaf_entry_t); 1797 * sizeof(xfs_attr_leaf_entry_t);
1798 memmove((char *)entry, (char *)(entry+1), tmp); 1798 memmove((char *)entry, (char *)(entry+1), tmp);
1799 be16_add(&hdr->count, -1); 1799 be16_add_cpu(&hdr->count, -1);
1800 xfs_da_log_buf(args->trans, bp, 1800 xfs_da_log_buf(args->trans, bp,
1801 XFS_DA_LOGRANGE(leaf, entry, tmp + sizeof(*entry))); 1801 XFS_DA_LOGRANGE(leaf, entry, tmp + sizeof(*entry)));
1802 entry = &leaf->entries[be16_to_cpu(hdr->count)]; 1802 entry = &leaf->entries[be16_to_cpu(hdr->count)];
@@ -2182,15 +2182,15 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s,
2182 */ 2182 */
2183 if (entry_s->flags & XFS_ATTR_INCOMPLETE) { /* skip partials? */ 2183 if (entry_s->flags & XFS_ATTR_INCOMPLETE) { /* skip partials? */
2184 memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp); 2184 memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp);
2185 be16_add(&hdr_s->usedbytes, -tmp); 2185 be16_add_cpu(&hdr_s->usedbytes, -tmp);
2186 be16_add(&hdr_s->count, -1); 2186 be16_add_cpu(&hdr_s->count, -1);
2187 entry_d--; /* to compensate for ++ in loop hdr */ 2187 entry_d--; /* to compensate for ++ in loop hdr */
2188 desti--; 2188 desti--;
2189 if ((start_s + i) < offset) 2189 if ((start_s + i) < offset)
2190 result++; /* insertion index adjustment */ 2190 result++; /* insertion index adjustment */
2191 } else { 2191 } else {
2192#endif /* GROT */ 2192#endif /* GROT */
2193 be16_add(&hdr_d->firstused, -tmp); 2193 be16_add_cpu(&hdr_d->firstused, -tmp);
2194 /* both on-disk, don't endian flip twice */ 2194 /* both on-disk, don't endian flip twice */
2195 entry_d->hashval = entry_s->hashval; 2195 entry_d->hashval = entry_s->hashval;
2196 /* both on-disk, don't endian flip twice */ 2196 /* both on-disk, don't endian flip twice */
@@ -2203,10 +2203,10 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s,
2203 ASSERT(be16_to_cpu(entry_s->nameidx) + tmp 2203 ASSERT(be16_to_cpu(entry_s->nameidx) + tmp
2204 <= XFS_LBSIZE(mp)); 2204 <= XFS_LBSIZE(mp));
2205 memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp); 2205 memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp);
2206 be16_add(&hdr_s->usedbytes, -tmp); 2206 be16_add_cpu(&hdr_s->usedbytes, -tmp);
2207 be16_add(&hdr_d->usedbytes, tmp); 2207 be16_add_cpu(&hdr_d->usedbytes, tmp);
2208 be16_add(&hdr_s->count, -1); 2208 be16_add_cpu(&hdr_s->count, -1);
2209 be16_add(&hdr_d->count, 1); 2209 be16_add_cpu(&hdr_d->count, 1);
2210 tmp = be16_to_cpu(hdr_d->count) 2210 tmp = be16_to_cpu(hdr_d->count)
2211 * sizeof(xfs_attr_leaf_entry_t) 2211 * sizeof(xfs_attr_leaf_entry_t)
2212 + sizeof(xfs_attr_leaf_hdr_t); 2212 + sizeof(xfs_attr_leaf_hdr_t);
@@ -2247,7 +2247,7 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s,
2247 * Fill in the freemap information 2247 * Fill in the freemap information
2248 */ 2248 */
2249 hdr_d->freemap[0].base = cpu_to_be16(sizeof(xfs_attr_leaf_hdr_t)); 2249 hdr_d->freemap[0].base = cpu_to_be16(sizeof(xfs_attr_leaf_hdr_t));
2250 be16_add(&hdr_d->freemap[0].base, be16_to_cpu(hdr_d->count) * 2250 be16_add_cpu(&hdr_d->freemap[0].base, be16_to_cpu(hdr_d->count) *
2251 sizeof(xfs_attr_leaf_entry_t)); 2251 sizeof(xfs_attr_leaf_entry_t));
2252 hdr_d->freemap[0].size = cpu_to_be16(be16_to_cpu(hdr_d->firstused) 2252 hdr_d->freemap[0].size = cpu_to_be16(be16_to_cpu(hdr_d->firstused)
2253 - be16_to_cpu(hdr_d->freemap[0].base)); 2253 - be16_to_cpu(hdr_d->freemap[0].base));
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index c4181d85605c..bd18987326a3 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -631,7 +631,7 @@ xfs_bmbt_delrec(
631 memcpy(lrp, rrp, numrrecs * sizeof(*lrp)); 631 memcpy(lrp, rrp, numrrecs * sizeof(*lrp));
632 xfs_bmbt_log_recs(cur, lbp, numlrecs + 1, numlrecs + numrrecs); 632 xfs_bmbt_log_recs(cur, lbp, numlrecs + 1, numlrecs + numrrecs);
633 } 633 }
634 be16_add(&left->bb_numrecs, numrrecs); 634 be16_add_cpu(&left->bb_numrecs, numrrecs);
635 left->bb_rightsib = right->bb_rightsib; 635 left->bb_rightsib = right->bb_rightsib;
636 xfs_bmbt_log_block(cur, lbp, XFS_BB_RIGHTSIB | XFS_BB_NUMRECS); 636 xfs_bmbt_log_block(cur, lbp, XFS_BB_RIGHTSIB | XFS_BB_NUMRECS);
637 if (be64_to_cpu(left->bb_rightsib) != NULLDFSBNO) { 637 if (be64_to_cpu(left->bb_rightsib) != NULLDFSBNO) {
@@ -924,7 +924,7 @@ xfs_bmbt_killroot(
924 xfs_iroot_realloc(ip, i, cur->bc_private.b.whichfork); 924 xfs_iroot_realloc(ip, i, cur->bc_private.b.whichfork);
925 block = ifp->if_broot; 925 block = ifp->if_broot;
926 } 926 }
927 be16_add(&block->bb_numrecs, i); 927 be16_add_cpu(&block->bb_numrecs, i);
928 ASSERT(block->bb_numrecs == cblock->bb_numrecs); 928 ASSERT(block->bb_numrecs == cblock->bb_numrecs);
929 kp = XFS_BMAP_KEY_IADDR(block, 1, cur); 929 kp = XFS_BMAP_KEY_IADDR(block, 1, cur);
930 ckp = XFS_BMAP_KEY_IADDR(cblock, 1, cur); 930 ckp = XFS_BMAP_KEY_IADDR(cblock, 1, cur);
@@ -947,7 +947,7 @@ xfs_bmbt_killroot(
947 XFS_TRANS_DQ_BCOUNT, -1L); 947 XFS_TRANS_DQ_BCOUNT, -1L);
948 xfs_trans_binval(cur->bc_tp, cbp); 948 xfs_trans_binval(cur->bc_tp, cbp);
949 cur->bc_bufs[level - 1] = NULL; 949 cur->bc_bufs[level - 1] = NULL;
950 be16_add(&block->bb_level, -1); 950 be16_add_cpu(&block->bb_level, -1);
951 xfs_trans_log_inode(cur->bc_tp, ip, 951 xfs_trans_log_inode(cur->bc_tp, ip,
952 XFS_ILOG_CORE | XFS_ILOG_FBROOT(cur->bc_private.b.whichfork)); 952 XFS_ILOG_CORE | XFS_ILOG_FBROOT(cur->bc_private.b.whichfork));
953 cur->bc_nlevels--; 953 cur->bc_nlevels--;
@@ -1401,9 +1401,9 @@ xfs_bmbt_rshift(
1401 key.br_startoff = cpu_to_be64(xfs_bmbt_disk_get_startoff(rrp)); 1401 key.br_startoff = cpu_to_be64(xfs_bmbt_disk_get_startoff(rrp));
1402 rkp = &key; 1402 rkp = &key;
1403 } 1403 }
1404 be16_add(&left->bb_numrecs, -1); 1404 be16_add_cpu(&left->bb_numrecs, -1);
1405 xfs_bmbt_log_block(cur, lbp, XFS_BB_NUMRECS); 1405 xfs_bmbt_log_block(cur, lbp, XFS_BB_NUMRECS);
1406 be16_add(&right->bb_numrecs, 1); 1406 be16_add_cpu(&right->bb_numrecs, 1);
1407#ifdef DEBUG 1407#ifdef DEBUG
1408 if (level > 0) 1408 if (level > 0)
1409 xfs_btree_check_key(XFS_BTNUM_BMAP, rkp, rkp + 1); 1409 xfs_btree_check_key(XFS_BTNUM_BMAP, rkp, rkp + 1);
@@ -1535,7 +1535,7 @@ xfs_bmbt_split(
1535 right->bb_numrecs = cpu_to_be16(be16_to_cpu(left->bb_numrecs) / 2); 1535 right->bb_numrecs = cpu_to_be16(be16_to_cpu(left->bb_numrecs) / 2);
1536 if ((be16_to_cpu(left->bb_numrecs) & 1) && 1536 if ((be16_to_cpu(left->bb_numrecs) & 1) &&
1537 cur->bc_ptrs[level] <= be16_to_cpu(right->bb_numrecs) + 1) 1537 cur->bc_ptrs[level] <= be16_to_cpu(right->bb_numrecs) + 1)
1538 be16_add(&right->bb_numrecs, 1); 1538 be16_add_cpu(&right->bb_numrecs, 1);
1539 i = be16_to_cpu(left->bb_numrecs) - be16_to_cpu(right->bb_numrecs) + 1; 1539 i = be16_to_cpu(left->bb_numrecs) - be16_to_cpu(right->bb_numrecs) + 1;
1540 if (level > 0) { 1540 if (level > 0) {
1541 lkp = XFS_BMAP_KEY_IADDR(left, i, cur); 1541 lkp = XFS_BMAP_KEY_IADDR(left, i, cur);
@@ -1562,7 +1562,7 @@ xfs_bmbt_split(
1562 xfs_bmbt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs)); 1562 xfs_bmbt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs));
1563 *startoff = xfs_bmbt_disk_get_startoff(rrp); 1563 *startoff = xfs_bmbt_disk_get_startoff(rrp);
1564 } 1564 }
1565 be16_add(&left->bb_numrecs, -(be16_to_cpu(right->bb_numrecs))); 1565 be16_add_cpu(&left->bb_numrecs, -(be16_to_cpu(right->bb_numrecs)));
1566 right->bb_rightsib = left->bb_rightsib; 1566 right->bb_rightsib = left->bb_rightsib;
1567 left->bb_rightsib = cpu_to_be64(args.fsbno); 1567 left->bb_rightsib = cpu_to_be64(args.fsbno);
1568 right->bb_leftsib = cpu_to_be64(lbno); 1568 right->bb_leftsib = cpu_to_be64(lbno);
@@ -2240,7 +2240,7 @@ xfs_bmbt_newroot(
2240 bp = xfs_btree_get_bufl(args.mp, cur->bc_tp, args.fsbno, 0); 2240 bp = xfs_btree_get_bufl(args.mp, cur->bc_tp, args.fsbno, 0);
2241 cblock = XFS_BUF_TO_BMBT_BLOCK(bp); 2241 cblock = XFS_BUF_TO_BMBT_BLOCK(bp);
2242 *cblock = *block; 2242 *cblock = *block;
2243 be16_add(&block->bb_level, 1); 2243 be16_add_cpu(&block->bb_level, 1);
2244 block->bb_numrecs = cpu_to_be16(1); 2244 block->bb_numrecs = cpu_to_be16(1);
2245 cur->bc_nlevels++; 2245 cur->bc_nlevels++;
2246 cur->bc_ptrs[level + 1] = 1; 2246 cur->bc_ptrs[level + 1] = 1;
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
index 1b446849fb3d..021a8f7e563f 100644
--- a/fs/xfs/xfs_da_btree.c
+++ b/fs/xfs/xfs_da_btree.c
@@ -511,12 +511,12 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1,
511 * Move the req'd B-tree elements from high in node1 to 511 * Move the req'd B-tree elements from high in node1 to
512 * low in node2. 512 * low in node2.
513 */ 513 */
514 be16_add(&node2->hdr.count, count); 514 be16_add_cpu(&node2->hdr.count, count);
515 tmp = count * (uint)sizeof(xfs_da_node_entry_t); 515 tmp = count * (uint)sizeof(xfs_da_node_entry_t);
516 btree_s = &node1->btree[be16_to_cpu(node1->hdr.count) - count]; 516 btree_s = &node1->btree[be16_to_cpu(node1->hdr.count) - count];
517 btree_d = &node2->btree[0]; 517 btree_d = &node2->btree[0];
518 memcpy(btree_d, btree_s, tmp); 518 memcpy(btree_d, btree_s, tmp);
519 be16_add(&node1->hdr.count, -count); 519 be16_add_cpu(&node1->hdr.count, -count);
520 } else { 520 } else {
521 /* 521 /*
522 * Move the req'd B-tree elements from low in node2 to 522 * Move the req'd B-tree elements from low in node2 to
@@ -527,7 +527,7 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1,
527 btree_s = &node2->btree[0]; 527 btree_s = &node2->btree[0];
528 btree_d = &node1->btree[be16_to_cpu(node1->hdr.count)]; 528 btree_d = &node1->btree[be16_to_cpu(node1->hdr.count)];
529 memcpy(btree_d, btree_s, tmp); 529 memcpy(btree_d, btree_s, tmp);
530 be16_add(&node1->hdr.count, count); 530 be16_add_cpu(&node1->hdr.count, count);
531 xfs_da_log_buf(tp, blk1->bp, 531 xfs_da_log_buf(tp, blk1->bp,
532 XFS_DA_LOGRANGE(node1, btree_d, tmp)); 532 XFS_DA_LOGRANGE(node1, btree_d, tmp));
533 533
@@ -539,7 +539,7 @@ xfs_da_node_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1,
539 btree_s = &node2->btree[count]; 539 btree_s = &node2->btree[count];
540 btree_d = &node2->btree[0]; 540 btree_d = &node2->btree[0];
541 memmove(btree_d, btree_s, tmp); 541 memmove(btree_d, btree_s, tmp);
542 be16_add(&node2->hdr.count, -count); 542 be16_add_cpu(&node2->hdr.count, -count);
543 } 543 }
544 544
545 /* 545 /*
@@ -604,7 +604,7 @@ xfs_da_node_add(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk,
604 btree->before = cpu_to_be32(newblk->blkno); 604 btree->before = cpu_to_be32(newblk->blkno);
605 xfs_da_log_buf(state->args->trans, oldblk->bp, 605 xfs_da_log_buf(state->args->trans, oldblk->bp,
606 XFS_DA_LOGRANGE(node, btree, tmp + sizeof(*btree))); 606 XFS_DA_LOGRANGE(node, btree, tmp + sizeof(*btree)));
607 be16_add(&node->hdr.count, 1); 607 be16_add_cpu(&node->hdr.count, 1);
608 xfs_da_log_buf(state->args->trans, oldblk->bp, 608 xfs_da_log_buf(state->args->trans, oldblk->bp,
609 XFS_DA_LOGRANGE(node, &node->hdr, sizeof(node->hdr))); 609 XFS_DA_LOGRANGE(node, &node->hdr, sizeof(node->hdr)));
610 610
@@ -959,7 +959,7 @@ xfs_da_node_remove(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk)
959 memset((char *)btree, 0, sizeof(xfs_da_node_entry_t)); 959 memset((char *)btree, 0, sizeof(xfs_da_node_entry_t));
960 xfs_da_log_buf(state->args->trans, drop_blk->bp, 960 xfs_da_log_buf(state->args->trans, drop_blk->bp,
961 XFS_DA_LOGRANGE(node, btree, sizeof(*btree))); 961 XFS_DA_LOGRANGE(node, btree, sizeof(*btree)));
962 be16_add(&node->hdr.count, -1); 962 be16_add_cpu(&node->hdr.count, -1);
963 xfs_da_log_buf(state->args->trans, drop_blk->bp, 963 xfs_da_log_buf(state->args->trans, drop_blk->bp,
964 XFS_DA_LOGRANGE(node, &node->hdr, sizeof(node->hdr))); 964 XFS_DA_LOGRANGE(node, &node->hdr, sizeof(node->hdr)));
965 965
@@ -1018,7 +1018,7 @@ xfs_da_node_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk,
1018 */ 1018 */
1019 tmp = be16_to_cpu(drop_node->hdr.count) * (uint)sizeof(xfs_da_node_entry_t); 1019 tmp = be16_to_cpu(drop_node->hdr.count) * (uint)sizeof(xfs_da_node_entry_t);
1020 memcpy(btree, &drop_node->btree[0], tmp); 1020 memcpy(btree, &drop_node->btree[0], tmp);
1021 be16_add(&save_node->hdr.count, be16_to_cpu(drop_node->hdr.count)); 1021 be16_add_cpu(&save_node->hdr.count, be16_to_cpu(drop_node->hdr.count));
1022 1022
1023 xfs_da_log_buf(tp, save_blk->bp, 1023 xfs_da_log_buf(tp, save_blk->bp,
1024 XFS_DA_LOGRANGE(save_node, &save_node->hdr, 1024 XFS_DA_LOGRANGE(save_node, &save_node->hdr,
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index a5f4f4fb8868..fb5a556725b3 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -271,7 +271,7 @@ xfs_dir2_block_addname(
271 } 271 }
272 lfloglow = toidx + 1 - (be32_to_cpu(btp->stale) - 1); 272 lfloglow = toidx + 1 - (be32_to_cpu(btp->stale) - 1);
273 lfloghigh -= be32_to_cpu(btp->stale) - 1; 273 lfloghigh -= be32_to_cpu(btp->stale) - 1;
274 be32_add(&btp->count, -(be32_to_cpu(btp->stale) - 1)); 274 be32_add_cpu(&btp->count, -(be32_to_cpu(btp->stale) - 1));
275 xfs_dir2_data_make_free(tp, bp, 275 xfs_dir2_data_make_free(tp, bp,
276 (xfs_dir2_data_aoff_t)((char *)blp - (char *)block), 276 (xfs_dir2_data_aoff_t)((char *)blp - (char *)block),
277 (xfs_dir2_data_aoff_t)((be32_to_cpu(btp->stale) - 1) * sizeof(*blp)), 277 (xfs_dir2_data_aoff_t)((be32_to_cpu(btp->stale) - 1) * sizeof(*blp)),
@@ -326,7 +326,7 @@ xfs_dir2_block_addname(
326 /* 326 /*
327 * Update the tail (entry count). 327 * Update the tail (entry count).
328 */ 328 */
329 be32_add(&btp->count, 1); 329 be32_add_cpu(&btp->count, 1);
330 /* 330 /*
331 * If we now need to rebuild the bestfree map, do so. 331 * If we now need to rebuild the bestfree map, do so.
332 * This needs to happen before the next call to use_free. 332 * This needs to happen before the next call to use_free.
@@ -387,7 +387,7 @@ xfs_dir2_block_addname(
387 lfloglow = MIN(mid, lfloglow); 387 lfloglow = MIN(mid, lfloglow);
388 lfloghigh = MAX(highstale, lfloghigh); 388 lfloghigh = MAX(highstale, lfloghigh);
389 } 389 }
390 be32_add(&btp->stale, -1); 390 be32_add_cpu(&btp->stale, -1);
391 } 391 }
392 /* 392 /*
393 * Point to the new data entry. 393 * Point to the new data entry.
@@ -767,7 +767,7 @@ xfs_dir2_block_removename(
767 /* 767 /*
768 * Fix up the block tail. 768 * Fix up the block tail.
769 */ 769 */
770 be32_add(&btp->stale, 1); 770 be32_add_cpu(&btp->stale, 1);
771 xfs_dir2_block_log_tail(tp, bp); 771 xfs_dir2_block_log_tail(tp, bp);
772 /* 772 /*
773 * Remove the leaf entry by marking it stale. 773 * Remove the leaf entry by marking it stale.
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c
index d2452699e9b1..fb8c9e08b23d 100644
--- a/fs/xfs/xfs_dir2_data.c
+++ b/fs/xfs/xfs_dir2_data.c
@@ -587,7 +587,7 @@ xfs_dir2_data_make_free(
587 /* 587 /*
588 * Fix up the new big freespace. 588 * Fix up the new big freespace.
589 */ 589 */
590 be16_add(&prevdup->length, len + be16_to_cpu(postdup->length)); 590 be16_add_cpu(&prevdup->length, len + be16_to_cpu(postdup->length));
591 *xfs_dir2_data_unused_tag_p(prevdup) = 591 *xfs_dir2_data_unused_tag_p(prevdup) =
592 cpu_to_be16((char *)prevdup - (char *)d); 592 cpu_to_be16((char *)prevdup - (char *)d);
593 xfs_dir2_data_log_unused(tp, bp, prevdup); 593 xfs_dir2_data_log_unused(tp, bp, prevdup);
@@ -621,7 +621,7 @@ xfs_dir2_data_make_free(
621 */ 621 */
622 else if (prevdup) { 622 else if (prevdup) {
623 dfp = xfs_dir2_data_freefind(d, prevdup); 623 dfp = xfs_dir2_data_freefind(d, prevdup);
624 be16_add(&prevdup->length, len); 624 be16_add_cpu(&prevdup->length, len);
625 *xfs_dir2_data_unused_tag_p(prevdup) = 625 *xfs_dir2_data_unused_tag_p(prevdup) =
626 cpu_to_be16((char *)prevdup - (char *)d); 626 cpu_to_be16((char *)prevdup - (char *)d);
627 xfs_dir2_data_log_unused(tp, bp, prevdup); 627 xfs_dir2_data_log_unused(tp, bp, prevdup);
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index 0ca0020ba09f..bc52b803d79b 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -359,7 +359,7 @@ xfs_dir2_leaf_addname(
359 bestsp--; 359 bestsp--;
360 memmove(&bestsp[0], &bestsp[1], 360 memmove(&bestsp[0], &bestsp[1],
361 be32_to_cpu(ltp->bestcount) * sizeof(bestsp[0])); 361 be32_to_cpu(ltp->bestcount) * sizeof(bestsp[0]));
362 be32_add(&ltp->bestcount, 1); 362 be32_add_cpu(&ltp->bestcount, 1);
363 xfs_dir2_leaf_log_tail(tp, lbp); 363 xfs_dir2_leaf_log_tail(tp, lbp);
364 xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); 364 xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
365 } 365 }
@@ -445,7 +445,7 @@ xfs_dir2_leaf_addname(
445 */ 445 */
446 lfloglow = index; 446 lfloglow = index;
447 lfloghigh = be16_to_cpu(leaf->hdr.count); 447 lfloghigh = be16_to_cpu(leaf->hdr.count);
448 be16_add(&leaf->hdr.count, 1); 448 be16_add_cpu(&leaf->hdr.count, 1);
449 } 449 }
450 /* 450 /*
451 * There are stale entries. 451 * There are stale entries.
@@ -523,7 +523,7 @@ xfs_dir2_leaf_addname(
523 lfloglow = MIN(index, lfloglow); 523 lfloglow = MIN(index, lfloglow);
524 lfloghigh = MAX(highstale, lfloghigh); 524 lfloghigh = MAX(highstale, lfloghigh);
525 } 525 }
526 be16_add(&leaf->hdr.stale, -1); 526 be16_add_cpu(&leaf->hdr.stale, -1);
527 } 527 }
528 /* 528 /*
529 * Fill in the new leaf entry. 529 * Fill in the new leaf entry.
@@ -626,7 +626,7 @@ xfs_dir2_leaf_compact(
626 * Update and log the header, log the leaf entries. 626 * Update and log the header, log the leaf entries.
627 */ 627 */
628 ASSERT(be16_to_cpu(leaf->hdr.stale) == from - to); 628 ASSERT(be16_to_cpu(leaf->hdr.stale) == from - to);
629 be16_add(&leaf->hdr.count, -(be16_to_cpu(leaf->hdr.stale))); 629 be16_add_cpu(&leaf->hdr.count, -(be16_to_cpu(leaf->hdr.stale)));
630 leaf->hdr.stale = 0; 630 leaf->hdr.stale = 0;
631 xfs_dir2_leaf_log_header(args->trans, bp); 631 xfs_dir2_leaf_log_header(args->trans, bp);
632 if (loglow != -1) 632 if (loglow != -1)
@@ -728,7 +728,7 @@ xfs_dir2_leaf_compact_x1(
728 /* 728 /*
729 * Adjust the leaf header values. 729 * Adjust the leaf header values.
730 */ 730 */
731 be16_add(&leaf->hdr.count, -(from - to)); 731 be16_add_cpu(&leaf->hdr.count, -(from - to));
732 leaf->hdr.stale = cpu_to_be16(1); 732 leaf->hdr.stale = cpu_to_be16(1);
733 /* 733 /*
734 * Remember the low/high stale value only in the "right" 734 * Remember the low/high stale value only in the "right"
@@ -1470,7 +1470,7 @@ xfs_dir2_leaf_removename(
1470 /* 1470 /*
1471 * We just mark the leaf entry stale by putting a null in it. 1471 * We just mark the leaf entry stale by putting a null in it.
1472 */ 1472 */
1473 be16_add(&leaf->hdr.stale, 1); 1473 be16_add_cpu(&leaf->hdr.stale, 1);
1474 xfs_dir2_leaf_log_header(tp, lbp); 1474 xfs_dir2_leaf_log_header(tp, lbp);
1475 lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR); 1475 lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR);
1476 xfs_dir2_leaf_log_ents(tp, lbp, index, index); 1476 xfs_dir2_leaf_log_ents(tp, lbp, index, index);
@@ -1531,7 +1531,7 @@ xfs_dir2_leaf_removename(
1531 */ 1531 */
1532 memmove(&bestsp[db - i], bestsp, 1532 memmove(&bestsp[db - i], bestsp,
1533 (be32_to_cpu(ltp->bestcount) - (db - i)) * sizeof(*bestsp)); 1533 (be32_to_cpu(ltp->bestcount) - (db - i)) * sizeof(*bestsp));
1534 be32_add(&ltp->bestcount, -(db - i)); 1534 be32_add_cpu(&ltp->bestcount, -(db - i));
1535 xfs_dir2_leaf_log_tail(tp, lbp); 1535 xfs_dir2_leaf_log_tail(tp, lbp);
1536 xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); 1536 xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
1537 } else 1537 } else
@@ -1712,7 +1712,7 @@ xfs_dir2_leaf_trim_data(
1712 * Eliminate the last bests entry from the table. 1712 * Eliminate the last bests entry from the table.
1713 */ 1713 */
1714 bestsp = xfs_dir2_leaf_bests_p(ltp); 1714 bestsp = xfs_dir2_leaf_bests_p(ltp);
1715 be32_add(&ltp->bestcount, -1); 1715 be32_add_cpu(&ltp->bestcount, -1);
1716 memmove(&bestsp[1], &bestsp[0], be32_to_cpu(ltp->bestcount) * sizeof(*bestsp)); 1716 memmove(&bestsp[1], &bestsp[0], be32_to_cpu(ltp->bestcount) * sizeof(*bestsp));
1717 xfs_dir2_leaf_log_tail(tp, lbp); 1717 xfs_dir2_leaf_log_tail(tp, lbp);
1718 xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); 1718 xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
index eb18e399e836..8dade711f099 100644
--- a/fs/xfs/xfs_dir2_node.c
+++ b/fs/xfs/xfs_dir2_node.c
@@ -254,7 +254,7 @@ xfs_dir2_leafn_add(
254 (be16_to_cpu(leaf->hdr.count) - index) * sizeof(*lep)); 254 (be16_to_cpu(leaf->hdr.count) - index) * sizeof(*lep));
255 lfloglow = index; 255 lfloglow = index;
256 lfloghigh = be16_to_cpu(leaf->hdr.count); 256 lfloghigh = be16_to_cpu(leaf->hdr.count);
257 be16_add(&leaf->hdr.count, 1); 257 be16_add_cpu(&leaf->hdr.count, 1);
258 } 258 }
259 /* 259 /*
260 * There are stale entries. We'll use one for the new entry. 260 * There are stale entries. We'll use one for the new entry.
@@ -322,7 +322,7 @@ xfs_dir2_leafn_add(
322 lfloglow = MIN(index, lfloglow); 322 lfloglow = MIN(index, lfloglow);
323 lfloghigh = MAX(highstale, lfloghigh); 323 lfloghigh = MAX(highstale, lfloghigh);
324 } 324 }
325 be16_add(&leaf->hdr.stale, -1); 325 be16_add_cpu(&leaf->hdr.stale, -1);
326 } 326 }
327 /* 327 /*
328 * Insert the new entry, log everything. 328 * Insert the new entry, log everything.
@@ -697,10 +697,10 @@ xfs_dir2_leafn_moveents(
697 /* 697 /*
698 * Update the headers and log them. 698 * Update the headers and log them.
699 */ 699 */
700 be16_add(&leaf_s->hdr.count, -(count)); 700 be16_add_cpu(&leaf_s->hdr.count, -(count));
701 be16_add(&leaf_s->hdr.stale, -(stale)); 701 be16_add_cpu(&leaf_s->hdr.stale, -(stale));
702 be16_add(&leaf_d->hdr.count, count); 702 be16_add_cpu(&leaf_d->hdr.count, count);
703 be16_add(&leaf_d->hdr.stale, stale); 703 be16_add_cpu(&leaf_d->hdr.stale, stale);
704 xfs_dir2_leaf_log_header(tp, bp_s); 704 xfs_dir2_leaf_log_header(tp, bp_s);
705 xfs_dir2_leaf_log_header(tp, bp_d); 705 xfs_dir2_leaf_log_header(tp, bp_d);
706 xfs_dir2_leafn_check(args->dp, bp_s); 706 xfs_dir2_leafn_check(args->dp, bp_s);
@@ -885,7 +885,7 @@ xfs_dir2_leafn_remove(
885 * Kill the leaf entry by marking it stale. 885 * Kill the leaf entry by marking it stale.
886 * Log the leaf block changes. 886 * Log the leaf block changes.
887 */ 887 */
888 be16_add(&leaf->hdr.stale, 1); 888 be16_add_cpu(&leaf->hdr.stale, 1);
889 xfs_dir2_leaf_log_header(tp, bp); 889 xfs_dir2_leaf_log_header(tp, bp);
890 lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR); 890 lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR);
891 xfs_dir2_leaf_log_ents(tp, bp, index, index); 891 xfs_dir2_leaf_log_ents(tp, bp, index, index);
@@ -971,7 +971,7 @@ xfs_dir2_leafn_remove(
971 /* 971 /*
972 * One less used entry in the free table. 972 * One less used entry in the free table.
973 */ 973 */
974 be32_add(&free->hdr.nused, -1); 974 be32_add_cpu(&free->hdr.nused, -1);
975 xfs_dir2_free_log_header(tp, fbp); 975 xfs_dir2_free_log_header(tp, fbp);
976 /* 976 /*
977 * If this was the last entry in the table, we can 977 * If this was the last entry in the table, we can
@@ -1642,7 +1642,7 @@ xfs_dir2_node_addname_int(
1642 * (this should always be true) then update the header. 1642 * (this should always be true) then update the header.
1643 */ 1643 */
1644 if (be16_to_cpu(free->bests[findex]) == NULLDATAOFF) { 1644 if (be16_to_cpu(free->bests[findex]) == NULLDATAOFF) {
1645 be32_add(&free->hdr.nused, 1); 1645 be32_add_cpu(&free->hdr.nused, 1);
1646 xfs_dir2_free_log_header(tp, fbp); 1646 xfs_dir2_free_log_header(tp, fbp);
1647 } 1647 }
1648 /* 1648 /*
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index b8de7f3cc17e..eadc1591c795 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -318,7 +318,7 @@ xfs_growfs_data_private(
318 } 318 }
319 ASSERT(bp); 319 ASSERT(bp);
320 agi = XFS_BUF_TO_AGI(bp); 320 agi = XFS_BUF_TO_AGI(bp);
321 be32_add(&agi->agi_length, new); 321 be32_add_cpu(&agi->agi_length, new);
322 ASSERT(nagcount == oagcount || 322 ASSERT(nagcount == oagcount ||
323 be32_to_cpu(agi->agi_length) == mp->m_sb.sb_agblocks); 323 be32_to_cpu(agi->agi_length) == mp->m_sb.sb_agblocks);
324 xfs_ialloc_log_agi(tp, bp, XFS_AGI_LENGTH); 324 xfs_ialloc_log_agi(tp, bp, XFS_AGI_LENGTH);
@@ -331,7 +331,7 @@ xfs_growfs_data_private(
331 } 331 }
332 ASSERT(bp); 332 ASSERT(bp);
333 agf = XFS_BUF_TO_AGF(bp); 333 agf = XFS_BUF_TO_AGF(bp);
334 be32_add(&agf->agf_length, new); 334 be32_add_cpu(&agf->agf_length, new);
335 ASSERT(be32_to_cpu(agf->agf_length) == 335 ASSERT(be32_to_cpu(agf->agf_length) ==
336 be32_to_cpu(agi->agi_length)); 336 be32_to_cpu(agi->agi_length));
337 xfs_alloc_log_agf(tp, bp, XFS_AGF_LENGTH); 337 xfs_alloc_log_agf(tp, bp, XFS_AGF_LENGTH);
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 1409c2d61c11..c5836b951d0c 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -301,8 +301,8 @@ xfs_ialloc_ag_alloc(
301 } 301 }
302 xfs_trans_inode_alloc_buf(tp, fbuf); 302 xfs_trans_inode_alloc_buf(tp, fbuf);
303 } 303 }
304 be32_add(&agi->agi_count, newlen); 304 be32_add_cpu(&agi->agi_count, newlen);
305 be32_add(&agi->agi_freecount, newlen); 305 be32_add_cpu(&agi->agi_freecount, newlen);
306 agno = be32_to_cpu(agi->agi_seqno); 306 agno = be32_to_cpu(agi->agi_seqno);
307 down_read(&args.mp->m_peraglock); 307 down_read(&args.mp->m_peraglock);
308 args.mp->m_perag[agno].pagi_freecount += newlen; 308 args.mp->m_perag[agno].pagi_freecount += newlen;
@@ -885,7 +885,7 @@ nextag:
885 if ((error = xfs_inobt_update(cur, rec.ir_startino, rec.ir_freecount, 885 if ((error = xfs_inobt_update(cur, rec.ir_startino, rec.ir_freecount,
886 rec.ir_free))) 886 rec.ir_free)))
887 goto error0; 887 goto error0;
888 be32_add(&agi->agi_freecount, -1); 888 be32_add_cpu(&agi->agi_freecount, -1);
889 xfs_ialloc_log_agi(tp, agbp, XFS_AGI_FREECOUNT); 889 xfs_ialloc_log_agi(tp, agbp, XFS_AGI_FREECOUNT);
890 down_read(&mp->m_peraglock); 890 down_read(&mp->m_peraglock);
891 mp->m_perag[tagno].pagi_freecount--; 891 mp->m_perag[tagno].pagi_freecount--;
@@ -1065,8 +1065,8 @@ xfs_difree(
1065 * to be freed when the transaction is committed. 1065 * to be freed when the transaction is committed.
1066 */ 1066 */
1067 ilen = XFS_IALLOC_INODES(mp); 1067 ilen = XFS_IALLOC_INODES(mp);
1068 be32_add(&agi->agi_count, -ilen); 1068 be32_add_cpu(&agi->agi_count, -ilen);
1069 be32_add(&agi->agi_freecount, -(ilen - 1)); 1069 be32_add_cpu(&agi->agi_freecount, -(ilen - 1));
1070 xfs_ialloc_log_agi(tp, agbp, XFS_AGI_COUNT | XFS_AGI_FREECOUNT); 1070 xfs_ialloc_log_agi(tp, agbp, XFS_AGI_COUNT | XFS_AGI_FREECOUNT);
1071 down_read(&mp->m_peraglock); 1071 down_read(&mp->m_peraglock);
1072 mp->m_perag[agno].pagi_freecount -= ilen - 1; 1072 mp->m_perag[agno].pagi_freecount -= ilen - 1;
@@ -1095,7 +1095,7 @@ xfs_difree(
1095 /* 1095 /*
1096 * Change the inode free counts and log the ag/sb changes. 1096 * Change the inode free counts and log the ag/sb changes.
1097 */ 1097 */
1098 be32_add(&agi->agi_freecount, 1); 1098 be32_add_cpu(&agi->agi_freecount, 1);
1099 xfs_ialloc_log_agi(tp, agbp, XFS_AGI_FREECOUNT); 1099 xfs_ialloc_log_agi(tp, agbp, XFS_AGI_FREECOUNT);
1100 down_read(&mp->m_peraglock); 1100 down_read(&mp->m_peraglock);
1101 mp->m_perag[agno].pagi_freecount++; 1101 mp->m_perag[agno].pagi_freecount++;
diff --git a/fs/xfs/xfs_ialloc_btree.c b/fs/xfs/xfs_ialloc_btree.c
index 8cdeeaf8632b..e5310c90e50f 100644
--- a/fs/xfs/xfs_ialloc_btree.c
+++ b/fs/xfs/xfs_ialloc_btree.c
@@ -189,7 +189,7 @@ xfs_inobt_delrec(
189 */ 189 */
190 bno = be32_to_cpu(agi->agi_root); 190 bno = be32_to_cpu(agi->agi_root);
191 agi->agi_root = *pp; 191 agi->agi_root = *pp;
192 be32_add(&agi->agi_level, -1); 192 be32_add_cpu(&agi->agi_level, -1);
193 /* 193 /*
194 * Free the block. 194 * Free the block.
195 */ 195 */
@@ -1132,7 +1132,7 @@ xfs_inobt_lshift(
1132 /* 1132 /*
1133 * Bump and log left's numrecs, decrement and log right's numrecs. 1133 * Bump and log left's numrecs, decrement and log right's numrecs.
1134 */ 1134 */
1135 be16_add(&left->bb_numrecs, 1); 1135 be16_add_cpu(&left->bb_numrecs, 1);
1136 xfs_inobt_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS); 1136 xfs_inobt_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS);
1137#ifdef DEBUG 1137#ifdef DEBUG
1138 if (level > 0) 1138 if (level > 0)
@@ -1140,7 +1140,7 @@ xfs_inobt_lshift(
1140 else 1140 else
1141 xfs_btree_check_rec(cur->bc_btnum, lrp - 1, lrp); 1141 xfs_btree_check_rec(cur->bc_btnum, lrp - 1, lrp);
1142#endif 1142#endif
1143 be16_add(&right->bb_numrecs, -1); 1143 be16_add_cpu(&right->bb_numrecs, -1);
1144 xfs_inobt_log_block(cur->bc_tp, rbp, XFS_BB_NUMRECS); 1144 xfs_inobt_log_block(cur->bc_tp, rbp, XFS_BB_NUMRECS);
1145 /* 1145 /*
1146 * Slide the contents of right down one entry. 1146 * Slide the contents of right down one entry.
@@ -1232,7 +1232,7 @@ xfs_inobt_newroot(
1232 * Set the root data in the a.g. inode structure. 1232 * Set the root data in the a.g. inode structure.
1233 */ 1233 */
1234 agi->agi_root = cpu_to_be32(args.agbno); 1234 agi->agi_root = cpu_to_be32(args.agbno);
1235 be32_add(&agi->agi_level, 1); 1235 be32_add_cpu(&agi->agi_level, 1);
1236 xfs_ialloc_log_agi(args.tp, cur->bc_private.i.agbp, 1236 xfs_ialloc_log_agi(args.tp, cur->bc_private.i.agbp,
1237 XFS_AGI_ROOT | XFS_AGI_LEVEL); 1237 XFS_AGI_ROOT | XFS_AGI_LEVEL);
1238 /* 1238 /*
@@ -1426,9 +1426,9 @@ xfs_inobt_rshift(
1426 /* 1426 /*
1427 * Decrement and log left's numrecs, bump and log right's numrecs. 1427 * Decrement and log left's numrecs, bump and log right's numrecs.
1428 */ 1428 */
1429 be16_add(&left->bb_numrecs, -1); 1429 be16_add_cpu(&left->bb_numrecs, -1);
1430 xfs_inobt_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS); 1430 xfs_inobt_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS);
1431 be16_add(&right->bb_numrecs, 1); 1431 be16_add_cpu(&right->bb_numrecs, 1);
1432#ifdef DEBUG 1432#ifdef DEBUG
1433 if (level > 0) 1433 if (level > 0)
1434 xfs_btree_check_key(cur->bc_btnum, rkp, rkp + 1); 1434 xfs_btree_check_key(cur->bc_btnum, rkp, rkp + 1);
@@ -1529,7 +1529,7 @@ xfs_inobt_split(
1529 */ 1529 */
1530 if ((be16_to_cpu(left->bb_numrecs) & 1) && 1530 if ((be16_to_cpu(left->bb_numrecs) & 1) &&
1531 cur->bc_ptrs[level] <= be16_to_cpu(right->bb_numrecs) + 1) 1531 cur->bc_ptrs[level] <= be16_to_cpu(right->bb_numrecs) + 1)
1532 be16_add(&right->bb_numrecs, 1); 1532 be16_add_cpu(&right->bb_numrecs, 1);
1533 i = be16_to_cpu(left->bb_numrecs) - be16_to_cpu(right->bb_numrecs) + 1; 1533 i = be16_to_cpu(left->bb_numrecs) - be16_to_cpu(right->bb_numrecs) + 1;
1534 /* 1534 /*
1535 * For non-leaf blocks, copy keys and addresses over to the new block. 1535 * For non-leaf blocks, copy keys and addresses over to the new block.
@@ -1565,7 +1565,7 @@ xfs_inobt_split(
1565 * Find the left block number by looking in the buffer. 1565 * Find the left block number by looking in the buffer.
1566 * Adjust numrecs, sibling pointers. 1566 * Adjust numrecs, sibling pointers.
1567 */ 1567 */
1568 be16_add(&left->bb_numrecs, -(be16_to_cpu(right->bb_numrecs))); 1568 be16_add_cpu(&left->bb_numrecs, -(be16_to_cpu(right->bb_numrecs)));
1569 right->bb_rightsib = left->bb_rightsib; 1569 right->bb_rightsib = left->bb_rightsib;
1570 left->bb_rightsib = cpu_to_be32(args.agbno); 1570 left->bb_rightsib = cpu_to_be32(args.agbno);
1571 right->bb_leftsib = cpu_to_be32(lbno); 1571 right->bb_leftsib = cpu_to_be32(lbno);
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index b3ac3805d3c4..a75edca1860f 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1509,9 +1509,9 @@ xlog_sync(xlog_t *log,
1509 * case, though. 1509 * case, though.
1510 */ 1510 */
1511 for (i = 0; i < split; i += BBSIZE) { 1511 for (i = 0; i < split; i += BBSIZE) {
1512 be32_add((__be32 *)dptr, 1); 1512 be32_add_cpu((__be32 *)dptr, 1);
1513 if (be32_to_cpu(*(__be32 *)dptr) == XLOG_HEADER_MAGIC_NUM) 1513 if (be32_to_cpu(*(__be32 *)dptr) == XLOG_HEADER_MAGIC_NUM)
1514 be32_add((__be32 *)dptr, 1); 1514 be32_add_cpu((__be32 *)dptr, 1);
1515 dptr += BBSIZE; 1515 dptr += BBSIZE;
1516 } 1516 }
1517 1517
@@ -1600,7 +1600,7 @@ xlog_state_finish_copy(xlog_t *log,
1600{ 1600{
1601 spin_lock(&log->l_icloglock); 1601 spin_lock(&log->l_icloglock);
1602 1602
1603 be32_add(&iclog->ic_header.h_num_logops, record_cnt); 1603 be32_add_cpu(&iclog->ic_header.h_num_logops, record_cnt);
1604 iclog->ic_offset += copy_bytes; 1604 iclog->ic_offset += copy_bytes;
1605 1605
1606 spin_unlock(&log->l_icloglock); 1606 spin_unlock(&log->l_icloglock);
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 71e4c8dcc69b..140386434aa3 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -567,26 +567,26 @@ xfs_trans_apply_sb_deltas(
567 */ 567 */
568 if (!xfs_sb_version_haslazysbcount(&(tp->t_mountp->m_sb))) { 568 if (!xfs_sb_version_haslazysbcount(&(tp->t_mountp->m_sb))) {
569 if (tp->t_icount_delta) 569 if (tp->t_icount_delta)
570 be64_add(&sbp->sb_icount, tp->t_icount_delta); 570 be64_add_cpu(&sbp->sb_icount, tp->t_icount_delta);
571 if (tp->t_ifree_delta) 571 if (tp->t_ifree_delta)
572 be64_add(&sbp->sb_ifree, tp->t_ifree_delta); 572 be64_add_cpu(&sbp->sb_ifree, tp->t_ifree_delta);
573 if (tp->t_fdblocks_delta) 573 if (tp->t_fdblocks_delta)
574 be64_add(&sbp->sb_fdblocks, tp->t_fdblocks_delta); 574 be64_add_cpu(&sbp->sb_fdblocks, tp->t_fdblocks_delta);
575 if (tp->t_res_fdblocks_delta) 575 if (tp->t_res_fdblocks_delta)
576 be64_add(&sbp->sb_fdblocks, tp->t_res_fdblocks_delta); 576 be64_add_cpu(&sbp->sb_fdblocks, tp->t_res_fdblocks_delta);
577 } 577 }
578 578
579 if (tp->t_frextents_delta) 579 if (tp->t_frextents_delta)
580 be64_add(&sbp->sb_frextents, tp->t_frextents_delta); 580 be64_add_cpu(&sbp->sb_frextents, tp->t_frextents_delta);
581 if (tp->t_res_frextents_delta) 581 if (tp->t_res_frextents_delta)
582 be64_add(&sbp->sb_frextents, tp->t_res_frextents_delta); 582 be64_add_cpu(&sbp->sb_frextents, tp->t_res_frextents_delta);
583 583
584 if (tp->t_dblocks_delta) { 584 if (tp->t_dblocks_delta) {
585 be64_add(&sbp->sb_dblocks, tp->t_dblocks_delta); 585 be64_add_cpu(&sbp->sb_dblocks, tp->t_dblocks_delta);
586 whole = 1; 586 whole = 1;
587 } 587 }
588 if (tp->t_agcount_delta) { 588 if (tp->t_agcount_delta) {
589 be32_add(&sbp->sb_agcount, tp->t_agcount_delta); 589 be32_add_cpu(&sbp->sb_agcount, tp->t_agcount_delta);
590 whole = 1; 590 whole = 1;
591 } 591 }
592 if (tp->t_imaxpct_delta) { 592 if (tp->t_imaxpct_delta) {
@@ -594,19 +594,19 @@ xfs_trans_apply_sb_deltas(
594 whole = 1; 594 whole = 1;
595 } 595 }
596 if (tp->t_rextsize_delta) { 596 if (tp->t_rextsize_delta) {
597 be32_add(&sbp->sb_rextsize, tp->t_rextsize_delta); 597 be32_add_cpu(&sbp->sb_rextsize, tp->t_rextsize_delta);
598 whole = 1; 598 whole = 1;
599 } 599 }
600 if (tp->t_rbmblocks_delta) { 600 if (tp->t_rbmblocks_delta) {
601 be32_add(&sbp->sb_rbmblocks, tp->t_rbmblocks_delta); 601 be32_add_cpu(&sbp->sb_rbmblocks, tp->t_rbmblocks_delta);
602 whole = 1; 602 whole = 1;
603 } 603 }
604 if (tp->t_rblocks_delta) { 604 if (tp->t_rblocks_delta) {
605 be64_add(&sbp->sb_rblocks, tp->t_rblocks_delta); 605 be64_add_cpu(&sbp->sb_rblocks, tp->t_rblocks_delta);
606 whole = 1; 606 whole = 1;
607 } 607 }
608 if (tp->t_rextents_delta) { 608 if (tp->t_rextents_delta) {
609 be64_add(&sbp->sb_rextents, tp->t_rextents_delta); 609 be64_add_cpu(&sbp->sb_rextents, tp->t_rextents_delta);
610 whole = 1; 610 whole = 1;
611 } 611 }
612 if (tp->t_rextslog_delta) { 612 if (tp->t_rextslog_delta) {