diff options
author | Eric Sandeen <sandeen@sandeen.net> | 2016-04-05 17:57:47 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-04-05 17:57:47 -0400 |
commit | 3ab3ffcaca99e0b77480d77bd393fc227b09069f (patch) | |
tree | 6814f8e68961f16659116de9407756f64fb60add | |
parent | 7af5ad28a603f2d1ef4c579b8ab0a9d4767a348e (diff) |
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>
-rw-r--r-- | fs/xfs/xfs_attr_list.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c index cbf4f5d072f6..d25f26b22ac9 100644 --- a/fs/xfs/xfs_attr_list.c +++ b/fs/xfs/xfs_attr_list.c | |||
@@ -412,6 +412,9 @@ xfs_attr3_leaf_list_int( | |||
412 | */ | 412 | */ |
413 | retval = 0; | 413 | retval = 0; |
414 | for (; i < ichdr.count; entry++, i++) { | 414 | for (; i < ichdr.count; entry++, i++) { |
415 | char *name; | ||
416 | int namelen, valuelen; | ||
417 | |||
415 | if (be32_to_cpu(entry->hashval) != cursor->hashval) { | 418 | if (be32_to_cpu(entry->hashval) != cursor->hashval) { |
416 | cursor->hashval = be32_to_cpu(entry->hashval); | 419 | cursor->hashval = be32_to_cpu(entry->hashval); |
417 | cursor->offset = 0; | 420 | cursor->offset = 0; |
@@ -421,26 +424,23 @@ xfs_attr3_leaf_list_int( | |||
421 | continue; /* skip incomplete entries */ | 424 | continue; /* skip incomplete entries */ |
422 | 425 | ||
423 | if (entry->flags & XFS_ATTR_LOCAL) { | 426 | if (entry->flags & XFS_ATTR_LOCAL) { |
424 | xfs_attr_leaf_name_local_t *name_loc = | 427 | xfs_attr_leaf_name_local_t *name_loc; |
425 | xfs_attr3_leaf_name_local(leaf, i); | ||
426 | |||
427 | retval = context->put_listent(context, | ||
428 | entry->flags, | ||
429 | name_loc->nameval, | ||
430 | (int)name_loc->namelen, | ||
431 | be16_to_cpu(name_loc->valuelen)); | ||
432 | } else { | ||
433 | xfs_attr_leaf_name_remote_t *name_rmt = | ||
434 | xfs_attr3_leaf_name_remote(leaf, i); | ||
435 | 428 | ||
436 | int valuelen = be32_to_cpu(name_rmt->valuelen); | 429 | name_loc = xfs_attr3_leaf_name_local(leaf, i); |
430 | name = name_loc->nameval; | ||
431 | namelen = name_loc->namelen; | ||
432 | valuelen = be16_to_cpu(name_loc->valuelen); | ||
433 | } else { | ||
434 | xfs_attr_leaf_name_remote_t *name_rmt; | ||
437 | 435 | ||
438 | retval = context->put_listent(context, | 436 | name_rmt = xfs_attr3_leaf_name_remote(leaf, i); |
439 | entry->flags, | 437 | name = name_rmt->name; |
440 | name_rmt->name, | 438 | namelen = name_rmt->namelen; |
441 | (int)name_rmt->namelen, | 439 | valuelen = be32_to_cpu(name_rmt->valuelen); |
442 | valuelen); | ||
443 | } | 440 | } |
441 | |||
442 | retval = context->put_listent(context, entry->flags, | ||
443 | name, namelen, valuelen); | ||
444 | if (retval) | 444 | if (retval) |
445 | break; | 445 | break; |
446 | if (context->seen_enough) | 446 | if (context->seen_enough) |