summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_attr.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-12-20 09:34:59 +0300
committerChandan Babu R <chandanbabu@kernel.org>2023-12-29 11:07:04 +0300
commit22b7b1f597a6a21fb7b3791a55f3a7ae54d2dfe4 (patch)
tree40310c27afd3dc6d3df8e816793ec484c90601b6 /fs/xfs/libxfs/xfs_attr.c
parent6c8d169bbd51fc10d1d0029d495962881315b4c2 (diff)
downloadlinux-22b7b1f597a6a21fb7b3791a55f3a7ae54d2dfe4.tar.xz
xfs: remove xfs_attr_shortform_lookup
xfs_attr_shortform_lookup is only used by xfs_attr_shortform_addname, which is much better served by calling xfs_attr_sf_findname. Switch it over and remove xfs_attr_shortform_lookup. 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/libxfs/xfs_attr.c')
-rw-r--r--fs/xfs/libxfs/xfs_attr.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index bcf8748cb1a3..e8b4317da830 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -1066,19 +1066,14 @@ xfs_attr_shortform_addname(
struct xfs_da_args *args)
{
int newsize, forkoff;
- int error;
trace_xfs_attr_sf_addname(args);
- error = xfs_attr_shortform_lookup(args);
- switch (error) {
- case -ENOATTR:
- if (args->op_flags & XFS_DA_OP_REPLACE)
- return error;
- break;
- case -EEXIST:
+ if (xfs_attr_sf_findname(args)) {
+ int error;
+
if (!(args->op_flags & XFS_DA_OP_REPLACE))
- return error;
+ return -EEXIST;
error = xfs_attr_sf_removename(args);
if (error)
@@ -1091,11 +1086,9 @@ xfs_attr_shortform_addname(
* around.
*/
args->op_flags &= ~XFS_DA_OP_REPLACE;
- break;
- case 0:
- break;
- default:
- return error;
+ } else {
+ if (args->op_flags & XFS_DA_OP_REPLACE)
+ return -ENOATTR;
}
if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||