Skip to content

Commit 1fb4b0d

Browse files
Christoph HellwigChandan Babu R
authored andcommitted
xfs: use xfs_attr_sf_findname in xfs_attr_shortform_getvalue
xfs_attr_shortform_getvalue duplicates the logic in xfs_attr_sf_findname. Use the helper instead. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
1 parent 22b7b1f commit 1fb4b0d

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

fs/xfs/libxfs/xfs_attr_leaf.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -848,23 +848,17 @@ int
848848
xfs_attr_shortform_getvalue(
849849
struct xfs_da_args *args)
850850
{
851-
struct xfs_attr_shortform *sf = args->dp->i_af.if_data;
852851
struct xfs_attr_sf_entry *sfe;
853-
int i;
854852

855853
ASSERT(args->dp->i_af.if_format == XFS_DINODE_FMT_LOCAL);
856854

857855
trace_xfs_attr_sf_lookup(args);
858856

859-
sfe = &sf->list[0];
860-
for (i = 0; i < sf->hdr.count;
861-
sfe = xfs_attr_sf_nextentry(sfe), i++) {
862-
if (xfs_attr_match(args, sfe->namelen, sfe->nameval,
863-
sfe->flags))
864-
return xfs_attr_copy_value(args,
865-
&sfe->nameval[args->namelen], sfe->valuelen);
866-
}
867-
return -ENOATTR;
857+
sfe = xfs_attr_sf_findname(args);
858+
if (!sfe)
859+
return -ENOATTR;
860+
return xfs_attr_copy_value(args, &sfe->nameval[args->namelen],
861+
sfe->valuelen);
868862
}
869863

870864
/* Convert from using the shortform to the leaf format. */

0 commit comments

Comments
 (0)