summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_attr_item.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-04-22 19:47:37 +0300
committerDarrick J. Wong <djwong@kernel.org>2024-04-23 17:46:55 +0300
commit9713dc88773d066413ae23aa474b13241507a89e (patch)
tree5483b4731affbcd3a70e84c3bd3768e841a417dc /fs/xfs/xfs_attr_item.c
parentf49af061f49c004fb6df7f791f39f9ed370f767b (diff)
downloadlinux-9713dc88773d066413ae23aa474b13241507a89e.tar.xz
xfs: move xfs_attr_defer_add to xfs_attr_item.c
Move the code that adds the incore xfs_attr_item deferred work data to a transaction live with the ATTRI log item code. This means that the upper level extended attribute code no longer has to know about the inner workings of the ATTRI log items. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_attr_item.c')
-rw-r--r--fs/xfs/xfs_attr_item.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
index a65ac7479768..a7d6c9af47e8 100644
--- a/fs/xfs/xfs_attr_item.c
+++ b/fs/xfs/xfs_attr_item.c
@@ -727,6 +727,36 @@ xfs_attr_create_done(
return &attrdp->attrd_item;
}
+void
+xfs_attr_defer_add(
+ struct xfs_da_args *args,
+ enum xfs_attr_defer_op op)
+{
+ struct xfs_attr_intent *new;
+
+ new = kmem_cache_zalloc(xfs_attr_intent_cache,
+ GFP_NOFS | __GFP_NOFAIL);
+ new->xattri_da_args = args;
+
+ switch (op) {
+ case XFS_ATTR_DEFER_SET:
+ new->xattri_op_flags = XFS_ATTRI_OP_FLAGS_SET;
+ new->xattri_dela_state = xfs_attr_init_add_state(args);
+ break;
+ case XFS_ATTR_DEFER_REPLACE:
+ new->xattri_op_flags = XFS_ATTRI_OP_FLAGS_REPLACE;
+ new->xattri_dela_state = xfs_attr_init_replace_state(args);
+ break;
+ case XFS_ATTR_DEFER_REMOVE:
+ new->xattri_op_flags = XFS_ATTRI_OP_FLAGS_REMOVE;
+ new->xattri_dela_state = xfs_attr_init_remove_state(args);
+ break;
+ }
+
+ xfs_defer_add(args->trans, &new->xattri_list, &xfs_attr_defer_type);
+ trace_xfs_attr_defer_add(new->xattri_dela_state, args->dp);
+}
+
const struct xfs_defer_op_type xfs_attr_defer_type = {
.name = "attr",
.max_items = 1,