Skip to content

Commit f44df68

Browse files
allisonhendersondjwong
authored andcommitted
xfs: Add helper function xfs_attr_leaf_mark_incomplete
This patch helps to simplify xfs_attr_node_removename by modularizing the code around the transactions into helper functions. This will make the function easier to follow when we introduce delayed attributes. Signed-off-by: Allison Collins <[email protected]> Reviewed-by: Amir Goldstein <[email protected]> Reviewed-by: Chandan Rajendra <[email protected]> Reviewed-by: Brian Foster <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]> Acked-by: Dave Chinner <[email protected]>
1 parent db1a28c commit f44df68

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

fs/xfs/libxfs/xfs_attr.c

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,32 @@ xfs_attr_node_shrink(
11311131
return error;
11321132
}
11331133

1134+
/*
1135+
* Mark an attribute entry INCOMPLETE and save pointers to the relevant buffers
1136+
* for later deletion of the entry.
1137+
*/
1138+
STATIC int
1139+
xfs_attr_leaf_mark_incomplete(
1140+
struct xfs_da_args *args,
1141+
struct xfs_da_state *state)
1142+
{
1143+
int error;
1144+
1145+
/*
1146+
* Fill in disk block numbers in the state structure
1147+
* so that we can get the buffers back after we commit
1148+
* several transactions in the following calls.
1149+
*/
1150+
error = xfs_attr_fillstate(state);
1151+
if (error)
1152+
return error;
1153+
1154+
/*
1155+
* Mark the attribute as INCOMPLETE
1156+
*/
1157+
return xfs_attr3_leaf_setflag(args);
1158+
}
1159+
11341160
/*
11351161
* Remove a name from a B-tree attribute list.
11361162
*
@@ -1162,20 +1188,7 @@ xfs_attr_node_removename(
11621188
ASSERT(blk->bp != NULL);
11631189
ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC);
11641190
if (args->rmtblkno > 0) {
1165-
/*
1166-
* Fill in disk block numbers in the state structure
1167-
* so that we can get the buffers back after we commit
1168-
* several transactions in the following calls.
1169-
*/
1170-
error = xfs_attr_fillstate(state);
1171-
if (error)
1172-
goto out;
1173-
1174-
/*
1175-
* Mark the attribute as INCOMPLETE, then bunmapi() the
1176-
* remote value.
1177-
*/
1178-
error = xfs_attr3_leaf_setflag(args);
1191+
error = xfs_attr_leaf_mark_incomplete(args, state);
11791192
if (error)
11801193
goto out;
11811194

0 commit comments

Comments
 (0)