aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_attr_leaf.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2014-06-06 01:21:27 -0400
committerDave Chinner <david@fromorbit.com>2014-06-06 01:21:27 -0400
commitc59f0ad23af0f4d7f64d2c2cdd85ceb49f6337fa (patch)
tree98d22fb1394aa1b55572ff2d708d4115ed1ace5c /fs/xfs/xfs_attr_leaf.c
parent33a6039007af112509f48910e62640dadd064322 (diff)
xfs: pass xfs_da_args to xfs_attr_leaf_newentsize
As it's only ever called from contexts where the xfs_da_args is present and contains all the information needed inside the args structure. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_attr_leaf.c')
-rw-r--r--fs/xfs/xfs_attr_leaf.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
index 88cd84a31f82..77611032586d 100644
--- a/fs/xfs/xfs_attr_leaf.c
+++ b/fs/xfs/xfs_attr_leaf.c
@@ -1076,8 +1076,7 @@ xfs_attr3_leaf_add(
1076 leaf = bp->b_addr; 1076 leaf = bp->b_addr;
1077 xfs_attr3_leaf_hdr_from_disk(&ichdr, leaf); 1077 xfs_attr3_leaf_hdr_from_disk(&ichdr, leaf);
1078 ASSERT(args->index >= 0 && args->index <= ichdr.count); 1078 ASSERT(args->index >= 0 && args->index <= ichdr.count);
1079 entsize = xfs_attr_leaf_newentsize(args->namelen, args->valuelen, 1079 entsize = xfs_attr_leaf_newentsize(args, NULL);
1080 args->geo->blksize, NULL);
1081 1080
1082 /* 1081 /*
1083 * Search through freemap for first-fit on new name length. 1082 * Search through freemap for first-fit on new name length.
@@ -1179,14 +1178,11 @@ xfs_attr3_leaf_add_work(
1179 ASSERT(ichdr->freemap[mapindex].base < XFS_LBSIZE(mp)); 1178 ASSERT(ichdr->freemap[mapindex].base < XFS_LBSIZE(mp));
1180 ASSERT((ichdr->freemap[mapindex].base & 0x3) == 0); 1179 ASSERT((ichdr->freemap[mapindex].base & 0x3) == 0);
1181 ASSERT(ichdr->freemap[mapindex].size >= 1180 ASSERT(ichdr->freemap[mapindex].size >=
1182 xfs_attr_leaf_newentsize(args->namelen, args->valuelen, 1181 xfs_attr_leaf_newentsize(args, NULL));
1183 args->geo->blksize, NULL));
1184 ASSERT(ichdr->freemap[mapindex].size < XFS_LBSIZE(mp)); 1182 ASSERT(ichdr->freemap[mapindex].size < XFS_LBSIZE(mp));
1185 ASSERT((ichdr->freemap[mapindex].size & 0x3) == 0); 1183 ASSERT((ichdr->freemap[mapindex].size & 0x3) == 0);
1186 1184
1187 ichdr->freemap[mapindex].size -= 1185 ichdr->freemap[mapindex].size -= xfs_attr_leaf_newentsize(args, &tmp);
1188 xfs_attr_leaf_newentsize(args->namelen, args->valuelen,
1189 args->geo->blksize, &tmp);
1190 1186
1191 entry->nameidx = cpu_to_be16(ichdr->freemap[mapindex].base + 1187 entry->nameidx = cpu_to_be16(ichdr->freemap[mapindex].base +
1192 ichdr->freemap[mapindex].size); 1188 ichdr->freemap[mapindex].size);
@@ -1594,9 +1590,7 @@ xfs_attr3_leaf_figure_balance(
1594 max = ichdr1->count + ichdr2->count; 1590 max = ichdr1->count + ichdr2->count;
1595 half = (max + 1) * sizeof(*entry); 1591 half = (max + 1) * sizeof(*entry);
1596 half += ichdr1->usedbytes + ichdr2->usedbytes + 1592 half += ichdr1->usedbytes + ichdr2->usedbytes +
1597 xfs_attr_leaf_newentsize(state->args->namelen, 1593 xfs_attr_leaf_newentsize(state->args, NULL);
1598 state->args->valuelen,
1599 state->blocksize, NULL);
1600 half /= 2; 1594 half /= 2;
1601 lastdelta = state->blocksize; 1595 lastdelta = state->blocksize;
1602 entry = xfs_attr3_leaf_entryp(leaf1); 1596 entry = xfs_attr3_leaf_entryp(leaf1);
@@ -1608,10 +1602,7 @@ xfs_attr3_leaf_figure_balance(
1608 */ 1602 */
1609 if (count == blk1->index) { 1603 if (count == blk1->index) {
1610 tmp = totallen + sizeof(*entry) + 1604 tmp = totallen + sizeof(*entry) +
1611 xfs_attr_leaf_newentsize( 1605 xfs_attr_leaf_newentsize(state->args, NULL);
1612 state->args->namelen,
1613 state->args->valuelen,
1614 state->blocksize, NULL);
1615 if (XFS_ATTR_ABS(half - tmp) > lastdelta) 1606 if (XFS_ATTR_ABS(half - tmp) > lastdelta)
1616 break; 1607 break;
1617 lastdelta = XFS_ATTR_ABS(half - tmp); 1608 lastdelta = XFS_ATTR_ABS(half - tmp);
@@ -1647,10 +1638,7 @@ xfs_attr3_leaf_figure_balance(
1647 totallen -= count * sizeof(*entry); 1638 totallen -= count * sizeof(*entry);
1648 if (foundit) { 1639 if (foundit) {
1649 totallen -= sizeof(*entry) + 1640 totallen -= sizeof(*entry) +
1650 xfs_attr_leaf_newentsize( 1641 xfs_attr_leaf_newentsize(state->args, NULL);
1651 state->args->namelen,
1652 state->args->valuelen,
1653 state->blocksize, NULL);
1654 } 1642 }
1655 1643
1656 *countarg = count; 1644 *countarg = count;
@@ -2441,22 +2429,21 @@ xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index)
2441 * a "local" or a "remote" attribute. 2429 * a "local" or a "remote" attribute.
2442 */ 2430 */
2443int 2431int
2444xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, int *local) 2432xfs_attr_leaf_newentsize(
2433 struct xfs_da_args *args,
2434 int *local)
2445{ 2435{
2446 int size; 2436 int size;
2447 2437
2448 size = xfs_attr_leaf_entsize_local(namelen, valuelen); 2438 size = xfs_attr_leaf_entsize_local(args->namelen, args->valuelen);
2449 if (size < xfs_attr_leaf_entsize_local_max(blocksize)) { 2439 if (size < xfs_attr_leaf_entsize_local_max(args->geo->blksize)) {
2450 if (local) { 2440 if (local)
2451 *local = 1; 2441 *local = 1;
2452 } 2442 return size;
2453 } else {
2454 size = xfs_attr_leaf_entsize_remote(namelen);
2455 if (local) {
2456 *local = 0;
2457 }
2458 } 2443 }
2459 return size; 2444 if (local)
2445 *local = 0;
2446 return xfs_attr_leaf_entsize_remote(args->namelen);
2460} 2447}
2461 2448
2462 2449