Skip to content

Commit 22b7b1f

Browse files
Christoph HellwigChandan Babu R
authored andcommitted
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>
1 parent 6c8d169 commit 22b7b1f

File tree

3 files changed

+7
-39
lines changed

3 files changed

+7
-39
lines changed

fs/xfs/libxfs/xfs_attr.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,19 +1066,14 @@ xfs_attr_shortform_addname(
10661066
struct xfs_da_args *args)
10671067
{
10681068
int newsize, forkoff;
1069-
int error;
10701069

10711070
trace_xfs_attr_sf_addname(args);
10721071

1073-
error = xfs_attr_shortform_lookup(args);
1074-
switch (error) {
1075-
case -ENOATTR:
1076-
if (args->op_flags & XFS_DA_OP_REPLACE)
1077-
return error;
1078-
break;
1079-
case -EEXIST:
1072+
if (xfs_attr_sf_findname(args)) {
1073+
int error;
1074+
10801075
if (!(args->op_flags & XFS_DA_OP_REPLACE))
1081-
return error;
1076+
return -EEXIST;
10821077

10831078
error = xfs_attr_sf_removename(args);
10841079
if (error)
@@ -1091,11 +1086,9 @@ xfs_attr_shortform_addname(
10911086
* around.
10921087
*/
10931088
args->op_flags &= ~XFS_DA_OP_REPLACE;
1094-
break;
1095-
case 0:
1096-
break;
1097-
default:
1098-
return error;
1089+
} else {
1090+
if (args->op_flags & XFS_DA_OP_REPLACE)
1091+
return -ENOATTR;
10991092
}
11001093

11011094
if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||

fs/xfs/libxfs/xfs_attr_leaf.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -837,30 +837,6 @@ xfs_attr_sf_removename(
837837
return 0;
838838
}
839839

840-
/*
841-
* Look up a name in a shortform attribute list structure.
842-
*/
843-
/*ARGSUSED*/
844-
int
845-
xfs_attr_shortform_lookup(
846-
struct xfs_da_args *args)
847-
{
848-
struct xfs_ifork *ifp = &args->dp->i_af;
849-
struct xfs_attr_shortform *sf = ifp->if_data;
850-
struct xfs_attr_sf_entry *sfe;
851-
int i;
852-
853-
ASSERT(ifp->if_format == XFS_DINODE_FMT_LOCAL);
854-
sfe = &sf->list[0];
855-
for (i = 0; i < sf->hdr.count;
856-
sfe = xfs_attr_sf_nextentry(sfe), i++) {
857-
if (xfs_attr_match(args, sfe->namelen, sfe->nameval,
858-
sfe->flags))
859-
return -EEXIST;
860-
}
861-
return -ENOATTR;
862-
}
863-
864840
/*
865841
* Retrieve the attribute value and length.
866842
*

fs/xfs/libxfs/xfs_attr_leaf.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ struct xfs_attr3_icleaf_hdr {
4747
*/
4848
void xfs_attr_shortform_create(struct xfs_da_args *args);
4949
void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
50-
int xfs_attr_shortform_lookup(struct xfs_da_args *args);
5150
int xfs_attr_shortform_getvalue(struct xfs_da_args *args);
5251
int xfs_attr_shortform_to_leaf(struct xfs_da_args *args);
5352
int xfs_attr_sf_removename(struct xfs_da_args *args);

0 commit comments

Comments
 (0)