xfs: collapse cases in xfs_attr3_leaf_list_int

Consolidate the 2 calls to ->put_listent in
xfs_attr3_leaf_list_int(), by setting up name, namelen, and
valuelen for the local vs remote cases, then call ->put_listent
and do the error handling all in one spot.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
This commit is contained in:
Eric Sandeen
2016-04-06 07:57:47 +10:00
committed by Dave Chinner
parent 7af5ad28a6
commit 3ab3ffcaca

View File

@@ -412,6 +412,9 @@ xfs_attr3_leaf_list_int(
*/ */
retval = 0; retval = 0;
for (; i < ichdr.count; entry++, i++) { for (; i < ichdr.count; entry++, i++) {
char *name;
int namelen, valuelen;
if (be32_to_cpu(entry->hashval) != cursor->hashval) { if (be32_to_cpu(entry->hashval) != cursor->hashval) {
cursor->hashval = be32_to_cpu(entry->hashval); cursor->hashval = be32_to_cpu(entry->hashval);
cursor->offset = 0; cursor->offset = 0;
@@ -421,26 +424,23 @@ xfs_attr3_leaf_list_int(
continue; /* skip incomplete entries */ continue; /* skip incomplete entries */
if (entry->flags & XFS_ATTR_LOCAL) { if (entry->flags & XFS_ATTR_LOCAL) {
xfs_attr_leaf_name_local_t *name_loc = xfs_attr_leaf_name_local_t *name_loc;
xfs_attr3_leaf_name_local(leaf, i);
retval = context->put_listent(context, name_loc = xfs_attr3_leaf_name_local(leaf, i);
entry->flags, name = name_loc->nameval;
name_loc->nameval, namelen = name_loc->namelen;
(int)name_loc->namelen, valuelen = be16_to_cpu(name_loc->valuelen);
be16_to_cpu(name_loc->valuelen));
} else { } else {
xfs_attr_leaf_name_remote_t *name_rmt = xfs_attr_leaf_name_remote_t *name_rmt;
xfs_attr3_leaf_name_remote(leaf, i);
int valuelen = be32_to_cpu(name_rmt->valuelen); name_rmt = xfs_attr3_leaf_name_remote(leaf, i);
name = name_rmt->name;
retval = context->put_listent(context, namelen = name_rmt->namelen;
entry->flags, valuelen = be32_to_cpu(name_rmt->valuelen);
name_rmt->name,
(int)name_rmt->namelen,
valuelen);
} }
retval = context->put_listent(context, entry->flags,
name, namelen, valuelen);
if (retval) if (retval)
break; break;
if (context->seen_enough) if (context->seen_enough)