[PATCH 09/55] libxfs: sync attr code with kernel

Dave Chinner
2013-09-04T22:21:54Z

From: Dave Chinner <dchinner@redhat.com>

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
libxfs/xfs_attr.c | 6 +++---
libxfs/xfs_attr_leaf.c | 7 +++----
2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c
index 6ef7809..c96083e 100644
--- a/libxfs/xfs_attr.c
+++ b/libxfs/xfs_attr.c
@@ -65,7 +65,7 @@ xfs_attr_name_to_xname(
return 0;
}

-STATIC int
+int
xfs_inode_hasattr(
struct xfs_inode *ip)
{
@@ -268,7 +268,6 @@ xfs_attr_set_int(
if (rsvd)
args.trans->t_flags |= XFS_TRANS_RESERVE;

-
error = xfs_trans_reserve(args.trans, args.total,
XFS_ATTRSETM_LOG_RES(mp) +
XFS_ATTRSETRT_LOG_RES(mp) * args.total,
@@ -587,6 +586,7 @@ xfs_attr_remove(
return xfs_attr_remove_int(dp, &xname, flags);
}

+
/*========================================================================
* External routines when attribute list is inside the inode
*========================================================================*/
@@ -854,7 +854,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
error = xfs_attr3_leaf_lookup_int(bp, args);
if (error == ENOATTR) {
xfs_trans_brelse(args->trans, bp);
- return(error);
+ return error;
}

xfs_attr3_leaf_remove(bp, args);
diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c
index 4e2951b..49a1764 100644
--- a/libxfs/xfs_attr_leaf.c
+++ b/libxfs/xfs_attr_leaf.c
@@ -51,7 +51,6 @@ STATIC int xfs_attr3_leaf_figure_balance(xfs_da_state_t *state,
int *number_entries_in_blk1,
int *number_usedbytes_in_blk1);

-
/*
* Utility routines.
*/
@@ -1120,7 +1119,6 @@ xfs_attr3_leaf_add_work(
struct xfs_attr_leaf_entry *entry;
struct xfs_attr_leaf_name_local *name_loc;
struct xfs_attr_leaf_name_remote *name_rmt;
- struct xfs_attr_leaf_map *map;
struct xfs_mount *mp;
int tmp;
int i;
@@ -1219,7 +1217,7 @@ xfs_attr3_leaf_add_work(
tmp = (ichdr->count - 1) * sizeof(xfs_attr_leaf_entry_t)
+ xfs_attr3_leaf_hdr_size(leaf);

- for (i = 0; i < XFS_ATTR_LEAF_MAPSIZE; map++, i++) {
+ for (i = 0; i < XFS_ATTR_LEAF_MAPSIZE; i++) {
if (ichdr->freemap[i].base == tmp) {
ichdr->freemap[i].base += sizeof(xfs_attr_leaf_entry_t);
ichdr->freemap[i].size -= sizeof(xfs_attr_leaf_entry_t);
@@ -2337,7 +2335,7 @@ xfs_attr3_leaf_moveents(
* Move the remaining entries down to fill the hole,
* then zero the entries at the top.
*/
- tmp = (ichdr_s->count - count) - sizeof(xfs_attr_leaf_entry_t);
+ tmp = (ichdr_s->count - count) * sizeof(xfs_attr_leaf_entry_t);
entry_s = &xfs_attr3_leaf_entryp(leaf_s)[start_s + count];
entry_d = &xfs_attr3_leaf_entryp(leaf_s)[start_s];
memmove(entry_d, entry_s, tmp);
@@ -2431,6 +2429,7 @@ xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, int *local)
return size;
}

+
/*========================================================================
* Manage the INCOMPLETE flag in a leaf entry
*========================================================================*/
--
1.8.3.2