diff options
author | Dave Chinner <dchinner@redhat.com> | 2014-06-06 01:21:27 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-06-06 01:21:27 -0400 |
commit | c59f0ad23af0f4d7f64d2c2cdd85ceb49f6337fa (patch) | |
tree | 98d22fb1394aa1b55572ff2d708d4115ed1ace5c /fs/xfs | |
parent | 33a6039007af112509f48910e62640dadd064322 (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')
-rw-r--r-- | fs/xfs/xfs_attr.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_attr_leaf.c | 47 | ||||
-rw-r--r-- | fs/xfs/xfs_attr_leaf.h | 3 |
3 files changed, 19 insertions, 35 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index ccfc2c9700fa..3d8c03edf657 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -174,9 +174,7 @@ xfs_attr_calc_size( | |||
174 | * Determine space new attribute will use, and if it would be | 174 | * Determine space new attribute will use, and if it would be |
175 | * "local" or "remote" (note: local != inline). | 175 | * "local" or "remote" (note: local != inline). |
176 | */ | 176 | */ |
177 | size = xfs_attr_leaf_newentsize(args->namelen, args->valuelen, | 177 | size = xfs_attr_leaf_newentsize(args, local); |
178 | args->geo->blksize, local); | ||
179 | |||
180 | nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK); | 178 | nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK); |
181 | if (*local) { | 179 | if (*local) { |
182 | if (size > (args->geo->blksize / 2)) { | 180 | if (size > (args->geo->blksize / 2)) { |
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 | */ |
2443 | int | 2431 | int |
2444 | xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, int *local) | 2432 | xfs_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 | ||
diff --git a/fs/xfs/xfs_attr_leaf.h b/fs/xfs/xfs_attr_leaf.h index 3ec5ec0b8678..e2929da7c3ba 100644 --- a/fs/xfs/xfs_attr_leaf.h +++ b/fs/xfs/xfs_attr_leaf.h | |||
@@ -96,8 +96,7 @@ int xfs_attr3_root_inactive(struct xfs_trans **trans, struct xfs_inode *dp); | |||
96 | xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count); | 96 | xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count); |
97 | int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp, | 97 | int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp, |
98 | struct xfs_buf *leaf2_bp); | 98 | struct xfs_buf *leaf2_bp); |
99 | int xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, | 99 | int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local); |
100 | int *local); | ||
101 | int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp, | 100 | int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp, |
102 | xfs_dablk_t bno, xfs_daddr_t mappedbno, | 101 | xfs_dablk_t bno, xfs_daddr_t mappedbno, |
103 | struct xfs_buf **bpp); | 102 | struct xfs_buf **bpp); |