aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_attr_leaf.c
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2008-02-13 18:03:29 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-13 19:21:19 -0500
commit413d57c9907c72ed608df2be72ef8ed13a3eeb46 (patch)
tree92f98a1219915d2d72589b24a04232fccf3a40f2 /fs/xfs/xfs_attr_leaf.c
parent91d35dd93e14c34539a8005183ea500f25caad02 (diff)
xfs: convert beX_add to beX_add_cpu (new common API)
remove beX_add functions and replace all uses with beX_add_cpu Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Cc: Mark Fasheh <mark.fasheh@oracle.com> Reviewed-by: Dave Chinner <dgc@sgi.com> Cc: Timothy Shimmin <tes@sgi.com> Cc: <linux-ext4@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/xfs/xfs_attr_leaf.c')
-rw-r--r--fs/xfs/xfs_attr_leaf.c46
1 files changed, 23 insertions, 23 deletions
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));