summaryrefslogtreecommitdiff
path: root/fs/xfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-12-20 07:35:00 +0100
committerChandan Babu R <chandanbabu@kernel.org>2023-12-29 13:37:04 +0530
commit1fb4b0def7b5a5bf91ad62a112d8d3f6dc76585f (patch)
tree1c8a878904a82a916fa26de39f09c8a411873530 /fs/xfs
parent22b7b1f597a6a21fb7b3791a55f3a7ae54d2dfe4 (diff)
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>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_attr_leaf.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
index 75c597805ffa..82e183033416 100644
--- a/fs/xfs/libxfs/xfs_attr_leaf.c
+++ b/fs/xfs/libxfs/xfs_attr_leaf.c
@@ -848,23 +848,17 @@ int
xfs_attr_shortform_getvalue(
struct xfs_da_args *args)
{
- struct xfs_attr_shortform *sf = args->dp->i_af.if_data;
struct xfs_attr_sf_entry *sfe;
- int i;
ASSERT(args->dp->i_af.if_format == XFS_DINODE_FMT_LOCAL);
trace_xfs_attr_sf_lookup(args);
- sfe = &sf->list[0];
- for (i = 0; i < sf->hdr.count;
- sfe = xfs_attr_sf_nextentry(sfe), i++) {
- if (xfs_attr_match(args, sfe->namelen, sfe->nameval,
- sfe->flags))
- return xfs_attr_copy_value(args,
- &sfe->nameval[args->namelen], sfe->valuelen);
- }
- return -ENOATTR;
+ sfe = xfs_attr_sf_findname(args);
+ if (!sfe)
+ return -ENOATTR;
+ return xfs_attr_copy_value(args, &sfe->nameval[args->namelen],
+ sfe->valuelen);
}
/* Convert from using the shortform to the leaf format. */