diff options
author | Eric Sandeen <sandeen@sandeen.net> | 2009-01-01 17:40:11 -0500 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2009-01-08 23:46:44 -0500 |
commit | c9fb86a917640d66ba2e0613a12f3a76eda8a30f (patch) | |
tree | 4fcea0b84b1d5f9ca6e3974c7dd3228e0c71eb63 | |
parent | 9800b550355e99c9bcaba7ec6540751dce0823d7 (diff) |
[XFS] Remove macro-to-function indirections in attr code
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
-rw-r--r-- | fs/xfs/xfs_attr_leaf.c | 72 | ||||
-rw-r--r-- | fs/xfs/xfs_attr_leaf.h | 12 |
2 files changed, 36 insertions, 48 deletions
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c index 79da6b2ea99e..6c323f8a4cd1 100644 --- a/fs/xfs/xfs_attr_leaf.c +++ b/fs/xfs/xfs_attr_leaf.c | |||
@@ -736,7 +736,7 @@ xfs_attr_shortform_allfit(xfs_dabuf_t *bp, xfs_inode_t *dp) | |||
736 | continue; /* don't copy partial entries */ | 736 | continue; /* don't copy partial entries */ |
737 | if (!(entry->flags & XFS_ATTR_LOCAL)) | 737 | if (!(entry->flags & XFS_ATTR_LOCAL)) |
738 | return(0); | 738 | return(0); |
739 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, i); | 739 | name_loc = xfs_attr_leaf_name_local(leaf, i); |
740 | if (name_loc->namelen >= XFS_ATTR_SF_ENTSIZE_MAX) | 740 | if (name_loc->namelen >= XFS_ATTR_SF_ENTSIZE_MAX) |
741 | return(0); | 741 | return(0); |
742 | if (be16_to_cpu(name_loc->valuelen) >= XFS_ATTR_SF_ENTSIZE_MAX) | 742 | if (be16_to_cpu(name_loc->valuelen) >= XFS_ATTR_SF_ENTSIZE_MAX) |
@@ -823,7 +823,7 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff) | |||
823 | if (!entry->nameidx) | 823 | if (!entry->nameidx) |
824 | continue; | 824 | continue; |
825 | ASSERT(entry->flags & XFS_ATTR_LOCAL); | 825 | ASSERT(entry->flags & XFS_ATTR_LOCAL); |
826 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, i); | 826 | name_loc = xfs_attr_leaf_name_local(leaf, i); |
827 | nargs.name = (char *)name_loc->nameval; | 827 | nargs.name = (char *)name_loc->nameval; |
828 | nargs.namelen = name_loc->namelen; | 828 | nargs.namelen = name_loc->namelen; |
829 | nargs.value = (char *)&name_loc->nameval[nargs.namelen]; | 829 | nargs.value = (char *)&name_loc->nameval[nargs.namelen]; |
@@ -1141,14 +1141,14 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex) | |||
1141 | * as part of this transaction (a split operation for example). | 1141 | * as part of this transaction (a split operation for example). |
1142 | */ | 1142 | */ |
1143 | if (entry->flags & XFS_ATTR_LOCAL) { | 1143 | if (entry->flags & XFS_ATTR_LOCAL) { |
1144 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, args->index); | 1144 | name_loc = xfs_attr_leaf_name_local(leaf, args->index); |
1145 | name_loc->namelen = args->namelen; | 1145 | name_loc->namelen = args->namelen; |
1146 | name_loc->valuelen = cpu_to_be16(args->valuelen); | 1146 | name_loc->valuelen = cpu_to_be16(args->valuelen); |
1147 | memcpy((char *)name_loc->nameval, args->name, args->namelen); | 1147 | memcpy((char *)name_loc->nameval, args->name, args->namelen); |
1148 | memcpy((char *)&name_loc->nameval[args->namelen], args->value, | 1148 | memcpy((char *)&name_loc->nameval[args->namelen], args->value, |
1149 | be16_to_cpu(name_loc->valuelen)); | 1149 | be16_to_cpu(name_loc->valuelen)); |
1150 | } else { | 1150 | } else { |
1151 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); | 1151 | name_rmt = xfs_attr_leaf_name_remote(leaf, args->index); |
1152 | name_rmt->namelen = args->namelen; | 1152 | name_rmt->namelen = args->namelen; |
1153 | memcpy((char *)name_rmt->name, args->name, args->namelen); | 1153 | memcpy((char *)name_rmt->name, args->name, args->namelen); |
1154 | entry->flags |= XFS_ATTR_INCOMPLETE; | 1154 | entry->flags |= XFS_ATTR_INCOMPLETE; |
@@ -1159,7 +1159,7 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex) | |||
1159 | args->rmtblkcnt = XFS_B_TO_FSB(mp, args->valuelen); | 1159 | args->rmtblkcnt = XFS_B_TO_FSB(mp, args->valuelen); |
1160 | } | 1160 | } |
1161 | xfs_da_log_buf(args->trans, bp, | 1161 | xfs_da_log_buf(args->trans, bp, |
1162 | XFS_DA_LOGRANGE(leaf, XFS_ATTR_LEAF_NAME(leaf, args->index), | 1162 | XFS_DA_LOGRANGE(leaf, xfs_attr_leaf_name(leaf, args->index), |
1163 | xfs_attr_leaf_entsize(leaf, args->index))); | 1163 | xfs_attr_leaf_entsize(leaf, args->index))); |
1164 | 1164 | ||
1165 | /* | 1165 | /* |
@@ -1749,10 +1749,10 @@ xfs_attr_leaf_remove(xfs_dabuf_t *bp, xfs_da_args_t *args) | |||
1749 | /* | 1749 | /* |
1750 | * Compress the remaining entries and zero out the removed stuff. | 1750 | * Compress the remaining entries and zero out the removed stuff. |
1751 | */ | 1751 | */ |
1752 | memset(XFS_ATTR_LEAF_NAME(leaf, args->index), 0, entsize); | 1752 | memset(xfs_attr_leaf_name(leaf, args->index), 0, entsize); |
1753 | be16_add_cpu(&hdr->usedbytes, -entsize); | 1753 | be16_add_cpu(&hdr->usedbytes, -entsize); |
1754 | xfs_da_log_buf(args->trans, bp, | 1754 | xfs_da_log_buf(args->trans, bp, |
1755 | XFS_DA_LOGRANGE(leaf, XFS_ATTR_LEAF_NAME(leaf, args->index), | 1755 | XFS_DA_LOGRANGE(leaf, xfs_attr_leaf_name(leaf, args->index), |
1756 | entsize)); | 1756 | entsize)); |
1757 | 1757 | ||
1758 | tmp = (be16_to_cpu(hdr->count) - args->index) | 1758 | tmp = (be16_to_cpu(hdr->count) - args->index) |
@@ -1985,7 +1985,7 @@ xfs_attr_leaf_lookup_int(xfs_dabuf_t *bp, xfs_da_args_t *args) | |||
1985 | continue; | 1985 | continue; |
1986 | } | 1986 | } |
1987 | if (entry->flags & XFS_ATTR_LOCAL) { | 1987 | if (entry->flags & XFS_ATTR_LOCAL) { |
1988 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, probe); | 1988 | name_loc = xfs_attr_leaf_name_local(leaf, probe); |
1989 | if (name_loc->namelen != args->namelen) | 1989 | if (name_loc->namelen != args->namelen) |
1990 | continue; | 1990 | continue; |
1991 | if (memcmp(args->name, (char *)name_loc->nameval, args->namelen) != 0) | 1991 | if (memcmp(args->name, (char *)name_loc->nameval, args->namelen) != 0) |
@@ -1995,7 +1995,7 @@ xfs_attr_leaf_lookup_int(xfs_dabuf_t *bp, xfs_da_args_t *args) | |||
1995 | args->index = probe; | 1995 | args->index = probe; |
1996 | return(XFS_ERROR(EEXIST)); | 1996 | return(XFS_ERROR(EEXIST)); |
1997 | } else { | 1997 | } else { |
1998 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, probe); | 1998 | name_rmt = xfs_attr_leaf_name_remote(leaf, probe); |
1999 | if (name_rmt->namelen != args->namelen) | 1999 | if (name_rmt->namelen != args->namelen) |
2000 | continue; | 2000 | continue; |
2001 | if (memcmp(args->name, (char *)name_rmt->name, | 2001 | if (memcmp(args->name, (char *)name_rmt->name, |
@@ -2035,7 +2035,7 @@ xfs_attr_leaf_getvalue(xfs_dabuf_t *bp, xfs_da_args_t *args) | |||
2035 | 2035 | ||
2036 | entry = &leaf->entries[args->index]; | 2036 | entry = &leaf->entries[args->index]; |
2037 | if (entry->flags & XFS_ATTR_LOCAL) { | 2037 | if (entry->flags & XFS_ATTR_LOCAL) { |
2038 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, args->index); | 2038 | name_loc = xfs_attr_leaf_name_local(leaf, args->index); |
2039 | ASSERT(name_loc->namelen == args->namelen); | 2039 | ASSERT(name_loc->namelen == args->namelen); |
2040 | ASSERT(memcmp(args->name, name_loc->nameval, args->namelen) == 0); | 2040 | ASSERT(memcmp(args->name, name_loc->nameval, args->namelen) == 0); |
2041 | valuelen = be16_to_cpu(name_loc->valuelen); | 2041 | valuelen = be16_to_cpu(name_loc->valuelen); |
@@ -2050,7 +2050,7 @@ xfs_attr_leaf_getvalue(xfs_dabuf_t *bp, xfs_da_args_t *args) | |||
2050 | args->valuelen = valuelen; | 2050 | args->valuelen = valuelen; |
2051 | memcpy(args->value, &name_loc->nameval[args->namelen], valuelen); | 2051 | memcpy(args->value, &name_loc->nameval[args->namelen], valuelen); |
2052 | } else { | 2052 | } else { |
2053 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); | 2053 | name_rmt = xfs_attr_leaf_name_remote(leaf, args->index); |
2054 | ASSERT(name_rmt->namelen == args->namelen); | 2054 | ASSERT(name_rmt->namelen == args->namelen); |
2055 | ASSERT(memcmp(args->name, name_rmt->name, args->namelen) == 0); | 2055 | ASSERT(memcmp(args->name, name_rmt->name, args->namelen) == 0); |
2056 | valuelen = be32_to_cpu(name_rmt->valuelen); | 2056 | valuelen = be32_to_cpu(name_rmt->valuelen); |
@@ -2143,7 +2143,7 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s, | |||
2143 | * off for 6.2, should be revisited later. | 2143 | * off for 6.2, should be revisited later. |
2144 | */ | 2144 | */ |
2145 | if (entry_s->flags & XFS_ATTR_INCOMPLETE) { /* skip partials? */ | 2145 | if (entry_s->flags & XFS_ATTR_INCOMPLETE) { /* skip partials? */ |
2146 | memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp); | 2146 | memset(xfs_attr_leaf_name(leaf_s, start_s + i), 0, tmp); |
2147 | be16_add_cpu(&hdr_s->usedbytes, -tmp); | 2147 | be16_add_cpu(&hdr_s->usedbytes, -tmp); |
2148 | be16_add_cpu(&hdr_s->count, -1); | 2148 | be16_add_cpu(&hdr_s->count, -1); |
2149 | entry_d--; /* to compensate for ++ in loop hdr */ | 2149 | entry_d--; /* to compensate for ++ in loop hdr */ |
@@ -2160,11 +2160,11 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s, | |||
2160 | entry_d->flags = entry_s->flags; | 2160 | entry_d->flags = entry_s->flags; |
2161 | ASSERT(be16_to_cpu(entry_d->nameidx) + tmp | 2161 | ASSERT(be16_to_cpu(entry_d->nameidx) + tmp |
2162 | <= XFS_LBSIZE(mp)); | 2162 | <= XFS_LBSIZE(mp)); |
2163 | memmove(XFS_ATTR_LEAF_NAME(leaf_d, desti), | 2163 | memmove(xfs_attr_leaf_name(leaf_d, desti), |
2164 | XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), tmp); | 2164 | xfs_attr_leaf_name(leaf_s, start_s + i), tmp); |
2165 | ASSERT(be16_to_cpu(entry_s->nameidx) + tmp | 2165 | ASSERT(be16_to_cpu(entry_s->nameidx) + tmp |
2166 | <= XFS_LBSIZE(mp)); | 2166 | <= XFS_LBSIZE(mp)); |
2167 | memset(XFS_ATTR_LEAF_NAME(leaf_s, start_s + i), 0, tmp); | 2167 | memset(xfs_attr_leaf_name(leaf_s, start_s + i), 0, tmp); |
2168 | be16_add_cpu(&hdr_s->usedbytes, -tmp); | 2168 | be16_add_cpu(&hdr_s->usedbytes, -tmp); |
2169 | be16_add_cpu(&hdr_d->usedbytes, tmp); | 2169 | be16_add_cpu(&hdr_d->usedbytes, tmp); |
2170 | be16_add_cpu(&hdr_s->count, -1); | 2170 | be16_add_cpu(&hdr_s->count, -1); |
@@ -2276,12 +2276,12 @@ xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index) | |||
2276 | 2276 | ||
2277 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); | 2277 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_ATTR_LEAF_MAGIC); |
2278 | if (leaf->entries[index].flags & XFS_ATTR_LOCAL) { | 2278 | if (leaf->entries[index].flags & XFS_ATTR_LOCAL) { |
2279 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, index); | 2279 | name_loc = xfs_attr_leaf_name_local(leaf, index); |
2280 | size = XFS_ATTR_LEAF_ENTSIZE_LOCAL(name_loc->namelen, | 2280 | size = xfs_attr_leaf_entsize_local(name_loc->namelen, |
2281 | be16_to_cpu(name_loc->valuelen)); | 2281 | be16_to_cpu(name_loc->valuelen)); |
2282 | } else { | 2282 | } else { |
2283 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, index); | 2283 | name_rmt = xfs_attr_leaf_name_remote(leaf, index); |
2284 | size = XFS_ATTR_LEAF_ENTSIZE_REMOTE(name_rmt->namelen); | 2284 | size = xfs_attr_leaf_entsize_remote(name_rmt->namelen); |
2285 | } | 2285 | } |
2286 | return(size); | 2286 | return(size); |
2287 | } | 2287 | } |
@@ -2297,13 +2297,13 @@ xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, int *local) | |||
2297 | { | 2297 | { |
2298 | int size; | 2298 | int size; |
2299 | 2299 | ||
2300 | size = XFS_ATTR_LEAF_ENTSIZE_LOCAL(namelen, valuelen); | 2300 | size = xfs_attr_leaf_entsize_local(namelen, valuelen); |
2301 | if (size < XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(blocksize)) { | 2301 | if (size < xfs_attr_leaf_entsize_local_max(blocksize)) { |
2302 | if (local) { | 2302 | if (local) { |
2303 | *local = 1; | 2303 | *local = 1; |
2304 | } | 2304 | } |
2305 | } else { | 2305 | } else { |
2306 | size = XFS_ATTR_LEAF_ENTSIZE_REMOTE(namelen); | 2306 | size = xfs_attr_leaf_entsize_remote(namelen); |
2307 | if (local) { | 2307 | if (local) { |
2308 | *local = 0; | 2308 | *local = 0; |
2309 | } | 2309 | } |
@@ -2372,7 +2372,7 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context) | |||
2372 | 2372 | ||
2373 | if (entry->flags & XFS_ATTR_LOCAL) { | 2373 | if (entry->flags & XFS_ATTR_LOCAL) { |
2374 | xfs_attr_leaf_name_local_t *name_loc = | 2374 | xfs_attr_leaf_name_local_t *name_loc = |
2375 | XFS_ATTR_LEAF_NAME_LOCAL(leaf, i); | 2375 | xfs_attr_leaf_name_local(leaf, i); |
2376 | 2376 | ||
2377 | retval = context->put_listent(context, | 2377 | retval = context->put_listent(context, |
2378 | entry->flags, | 2378 | entry->flags, |
@@ -2384,7 +2384,7 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context) | |||
2384 | return retval; | 2384 | return retval; |
2385 | } else { | 2385 | } else { |
2386 | xfs_attr_leaf_name_remote_t *name_rmt = | 2386 | xfs_attr_leaf_name_remote_t *name_rmt = |
2387 | XFS_ATTR_LEAF_NAME_REMOTE(leaf, i); | 2387 | xfs_attr_leaf_name_remote(leaf, i); |
2388 | 2388 | ||
2389 | int valuelen = be32_to_cpu(name_rmt->valuelen); | 2389 | int valuelen = be32_to_cpu(name_rmt->valuelen); |
2390 | 2390 | ||
@@ -2468,11 +2468,11 @@ xfs_attr_leaf_clearflag(xfs_da_args_t *args) | |||
2468 | 2468 | ||
2469 | #ifdef DEBUG | 2469 | #ifdef DEBUG |
2470 | if (entry->flags & XFS_ATTR_LOCAL) { | 2470 | if (entry->flags & XFS_ATTR_LOCAL) { |
2471 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf, args->index); | 2471 | name_loc = xfs_attr_leaf_name_local(leaf, args->index); |
2472 | namelen = name_loc->namelen; | 2472 | namelen = name_loc->namelen; |
2473 | name = (char *)name_loc->nameval; | 2473 | name = (char *)name_loc->nameval; |
2474 | } else { | 2474 | } else { |
2475 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); | 2475 | name_rmt = xfs_attr_leaf_name_remote(leaf, args->index); |
2476 | namelen = name_rmt->namelen; | 2476 | namelen = name_rmt->namelen; |
2477 | name = (char *)name_rmt->name; | 2477 | name = (char *)name_rmt->name; |
2478 | } | 2478 | } |
@@ -2487,7 +2487,7 @@ xfs_attr_leaf_clearflag(xfs_da_args_t *args) | |||
2487 | 2487 | ||
2488 | if (args->rmtblkno) { | 2488 | if (args->rmtblkno) { |
2489 | ASSERT((entry->flags & XFS_ATTR_LOCAL) == 0); | 2489 | ASSERT((entry->flags & XFS_ATTR_LOCAL) == 0); |
2490 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); | 2490 | name_rmt = xfs_attr_leaf_name_remote(leaf, args->index); |
2491 | name_rmt->valueblk = cpu_to_be32(args->rmtblkno); | 2491 | name_rmt->valueblk = cpu_to_be32(args->rmtblkno); |
2492 | name_rmt->valuelen = cpu_to_be32(args->valuelen); | 2492 | name_rmt->valuelen = cpu_to_be32(args->valuelen); |
2493 | xfs_da_log_buf(args->trans, bp, | 2493 | xfs_da_log_buf(args->trans, bp, |
@@ -2534,7 +2534,7 @@ xfs_attr_leaf_setflag(xfs_da_args_t *args) | |||
2534 | xfs_da_log_buf(args->trans, bp, | 2534 | xfs_da_log_buf(args->trans, bp, |
2535 | XFS_DA_LOGRANGE(leaf, entry, sizeof(*entry))); | 2535 | XFS_DA_LOGRANGE(leaf, entry, sizeof(*entry))); |
2536 | if ((entry->flags & XFS_ATTR_LOCAL) == 0) { | 2536 | if ((entry->flags & XFS_ATTR_LOCAL) == 0) { |
2537 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, args->index); | 2537 | name_rmt = xfs_attr_leaf_name_remote(leaf, args->index); |
2538 | name_rmt->valueblk = 0; | 2538 | name_rmt->valueblk = 0; |
2539 | name_rmt->valuelen = 0; | 2539 | name_rmt->valuelen = 0; |
2540 | xfs_da_log_buf(args->trans, bp, | 2540 | xfs_da_log_buf(args->trans, bp, |
@@ -2607,20 +2607,20 @@ xfs_attr_leaf_flipflags(xfs_da_args_t *args) | |||
2607 | 2607 | ||
2608 | #ifdef DEBUG | 2608 | #ifdef DEBUG |
2609 | if (entry1->flags & XFS_ATTR_LOCAL) { | 2609 | if (entry1->flags & XFS_ATTR_LOCAL) { |
2610 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf1, args->index); | 2610 | name_loc = xfs_attr_leaf_name_local(leaf1, args->index); |
2611 | namelen1 = name_loc->namelen; | 2611 | namelen1 = name_loc->namelen; |
2612 | name1 = (char *)name_loc->nameval; | 2612 | name1 = (char *)name_loc->nameval; |
2613 | } else { | 2613 | } else { |
2614 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf1, args->index); | 2614 | name_rmt = xfs_attr_leaf_name_remote(leaf1, args->index); |
2615 | namelen1 = name_rmt->namelen; | 2615 | namelen1 = name_rmt->namelen; |
2616 | name1 = (char *)name_rmt->name; | 2616 | name1 = (char *)name_rmt->name; |
2617 | } | 2617 | } |
2618 | if (entry2->flags & XFS_ATTR_LOCAL) { | 2618 | if (entry2->flags & XFS_ATTR_LOCAL) { |
2619 | name_loc = XFS_ATTR_LEAF_NAME_LOCAL(leaf2, args->index2); | 2619 | name_loc = xfs_attr_leaf_name_local(leaf2, args->index2); |
2620 | namelen2 = name_loc->namelen; | 2620 | namelen2 = name_loc->namelen; |
2621 | name2 = (char *)name_loc->nameval; | 2621 | name2 = (char *)name_loc->nameval; |
2622 | } else { | 2622 | } else { |
2623 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf2, args->index2); | 2623 | name_rmt = xfs_attr_leaf_name_remote(leaf2, args->index2); |
2624 | namelen2 = name_rmt->namelen; | 2624 | namelen2 = name_rmt->namelen; |
2625 | name2 = (char *)name_rmt->name; | 2625 | name2 = (char *)name_rmt->name; |
2626 | } | 2626 | } |
@@ -2637,7 +2637,7 @@ xfs_attr_leaf_flipflags(xfs_da_args_t *args) | |||
2637 | XFS_DA_LOGRANGE(leaf1, entry1, sizeof(*entry1))); | 2637 | XFS_DA_LOGRANGE(leaf1, entry1, sizeof(*entry1))); |
2638 | if (args->rmtblkno) { | 2638 | if (args->rmtblkno) { |
2639 | ASSERT((entry1->flags & XFS_ATTR_LOCAL) == 0); | 2639 | ASSERT((entry1->flags & XFS_ATTR_LOCAL) == 0); |
2640 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf1, args->index); | 2640 | name_rmt = xfs_attr_leaf_name_remote(leaf1, args->index); |
2641 | name_rmt->valueblk = cpu_to_be32(args->rmtblkno); | 2641 | name_rmt->valueblk = cpu_to_be32(args->rmtblkno); |
2642 | name_rmt->valuelen = cpu_to_be32(args->valuelen); | 2642 | name_rmt->valuelen = cpu_to_be32(args->valuelen); |
2643 | xfs_da_log_buf(args->trans, bp1, | 2643 | xfs_da_log_buf(args->trans, bp1, |
@@ -2648,7 +2648,7 @@ xfs_attr_leaf_flipflags(xfs_da_args_t *args) | |||
2648 | xfs_da_log_buf(args->trans, bp2, | 2648 | xfs_da_log_buf(args->trans, bp2, |
2649 | XFS_DA_LOGRANGE(leaf2, entry2, sizeof(*entry2))); | 2649 | XFS_DA_LOGRANGE(leaf2, entry2, sizeof(*entry2))); |
2650 | if ((entry2->flags & XFS_ATTR_LOCAL) == 0) { | 2650 | if ((entry2->flags & XFS_ATTR_LOCAL) == 0) { |
2651 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf2, args->index2); | 2651 | name_rmt = xfs_attr_leaf_name_remote(leaf2, args->index2); |
2652 | name_rmt->valueblk = 0; | 2652 | name_rmt->valueblk = 0; |
2653 | name_rmt->valuelen = 0; | 2653 | name_rmt->valuelen = 0; |
2654 | xfs_da_log_buf(args->trans, bp2, | 2654 | xfs_da_log_buf(args->trans, bp2, |
@@ -2855,7 +2855,7 @@ xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp) | |||
2855 | for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) { | 2855 | for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) { |
2856 | if (be16_to_cpu(entry->nameidx) && | 2856 | if (be16_to_cpu(entry->nameidx) && |
2857 | ((entry->flags & XFS_ATTR_LOCAL) == 0)) { | 2857 | ((entry->flags & XFS_ATTR_LOCAL) == 0)) { |
2858 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, i); | 2858 | name_rmt = xfs_attr_leaf_name_remote(leaf, i); |
2859 | if (name_rmt->valueblk) | 2859 | if (name_rmt->valueblk) |
2860 | count++; | 2860 | count++; |
2861 | } | 2861 | } |
@@ -2883,7 +2883,7 @@ xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp) | |||
2883 | for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) { | 2883 | for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) { |
2884 | if (be16_to_cpu(entry->nameidx) && | 2884 | if (be16_to_cpu(entry->nameidx) && |
2885 | ((entry->flags & XFS_ATTR_LOCAL) == 0)) { | 2885 | ((entry->flags & XFS_ATTR_LOCAL) == 0)) { |
2886 | name_rmt = XFS_ATTR_LEAF_NAME_REMOTE(leaf, i); | 2886 | name_rmt = xfs_attr_leaf_name_remote(leaf, i); |
2887 | if (name_rmt->valueblk) { | 2887 | if (name_rmt->valueblk) { |
2888 | lp->valueblk = be32_to_cpu(name_rmt->valueblk); | 2888 | lp->valueblk = be32_to_cpu(name_rmt->valueblk); |
2889 | lp->valuelen = XFS_B_TO_FSB(dp->i_mount, | 2889 | lp->valuelen = XFS_B_TO_FSB(dp->i_mount, |
diff --git a/fs/xfs/xfs_attr_leaf.h b/fs/xfs/xfs_attr_leaf.h index 83e9af417ca2..9c7d22fdcf4d 100644 --- a/fs/xfs/xfs_attr_leaf.h +++ b/fs/xfs/xfs_attr_leaf.h | |||
@@ -151,8 +151,6 @@ typedef struct xfs_attr_leafblock { | |||
151 | /* | 151 | /* |
152 | * Cast typed pointers for "local" and "remote" name/value structs. | 152 | * Cast typed pointers for "local" and "remote" name/value structs. |
153 | */ | 153 | */ |
154 | #define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) \ | ||
155 | xfs_attr_leaf_name_remote(leafp,idx) | ||
156 | static inline xfs_attr_leaf_name_remote_t * | 154 | static inline xfs_attr_leaf_name_remote_t * |
157 | xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx) | 155 | xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx) |
158 | { | 156 | { |
@@ -160,8 +158,6 @@ xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx) | |||
160 | &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; | 158 | &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; |
161 | } | 159 | } |
162 | 160 | ||
163 | #define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) \ | ||
164 | xfs_attr_leaf_name_local(leafp,idx) | ||
165 | static inline xfs_attr_leaf_name_local_t * | 161 | static inline xfs_attr_leaf_name_local_t * |
166 | xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx) | 162 | xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx) |
167 | { | 163 | { |
@@ -169,8 +165,6 @@ xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx) | |||
169 | &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; | 165 | &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; |
170 | } | 166 | } |
171 | 167 | ||
172 | #define XFS_ATTR_LEAF_NAME(leafp,idx) \ | ||
173 | xfs_attr_leaf_name(leafp,idx) | ||
174 | static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx) | 168 | static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx) |
175 | { | 169 | { |
176 | return &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; | 170 | return &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; |
@@ -181,24 +175,18 @@ static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx) | |||
181 | * a "local" name/value structure, a "remote" name/value structure, and | 175 | * a "local" name/value structure, a "remote" name/value structure, and |
182 | * a pointer which might be either. | 176 | * a pointer which might be either. |
183 | */ | 177 | */ |
184 | #define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) \ | ||
185 | xfs_attr_leaf_entsize_remote(nlen) | ||
186 | static inline int xfs_attr_leaf_entsize_remote(int nlen) | 178 | static inline int xfs_attr_leaf_entsize_remote(int nlen) |
187 | { | 179 | { |
188 | return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ | 180 | return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ |
189 | XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); | 181 | XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); |
190 | } | 182 | } |
191 | 183 | ||
192 | #define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) \ | ||
193 | xfs_attr_leaf_entsize_local(nlen,vlen) | ||
194 | static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen) | 184 | static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen) |
195 | { | 185 | { |
196 | return ((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) + | 186 | return ((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) + |
197 | XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); | 187 | XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); |
198 | } | 188 | } |
199 | 189 | ||
200 | #define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) \ | ||
201 | xfs_attr_leaf_entsize_local_max(bsize) | ||
202 | static inline int xfs_attr_leaf_entsize_local_max(int bsize) | 190 | static inline int xfs_attr_leaf_entsize_local_max(int bsize) |
203 | { | 191 | { |
204 | return (((bsize) >> 1) + ((bsize) >> 2)); | 192 | return (((bsize) >> 1) + ((bsize) >> 2)); |