diff options
author | Darrick J. Wong <djwong@kernel.org> | 2023-11-30 21:17:37 +0100 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2023-12-07 03:45:16 +0100 |
commit | 8a9aa763e17c5490d3526cbf4c9484d76ecbbe39 (patch) | |
tree | b01fcb4383deed03f3ea5734b501ea09cd271be0 /fs/xfs/xfs_attr_item.c | |
parent | xfs: hoist xfs_trans_add_item calls to defer ops functions (diff) | |
download | linux-8a9aa763e17c5490d3526cbf4c9484d76ecbbe39.tar.xz linux-8a9aa763e17c5490d3526cbf4c9484d76ecbbe39.zip |
xfs: collapse the ->create_done functions
Move the meat of the ->create_done function helpers into ->create_done
to reduce the amount of boilerplate.
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.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index c815811d937a..27553388da99 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -33,8 +33,6 @@ struct kmem_cache *xfs_attrd_cache; static const struct xfs_item_ops xfs_attri_item_ops; static const struct xfs_item_ops xfs_attrd_item_ops; -static struct xfs_attrd_log_item *xfs_trans_get_attrd(struct xfs_trans *tp, - struct xfs_attri_log_item *attrip); static inline struct xfs_attri_log_item *ATTRI_ITEM(struct xfs_log_item *lip) { @@ -732,27 +730,6 @@ xlog_recover_attri_commit_pass2( return 0; } -/* - * This routine is called to allocate an "attr free done" log item. - */ -static struct xfs_attrd_log_item * -xfs_trans_get_attrd(struct xfs_trans *tp, - struct xfs_attri_log_item *attrip) -{ - struct xfs_attrd_log_item *attrdp; - - ASSERT(tp != NULL); - - attrdp = kmem_cache_zalloc(xfs_attrd_cache, GFP_NOFS | __GFP_NOFAIL); - - xfs_log_item_init(tp->t_mountp, &attrdp->attrd_item, XFS_LI_ATTRD, - &xfs_attrd_item_ops); - attrdp->attrd_attrip = attrip; - attrdp->attrd_format.alfd_alf_id = attrip->attri_format.alfi_id; - - return attrdp; -} - /* Get an ATTRD so we can process all the attrs. */ static struct xfs_log_item * xfs_attr_create_done( @@ -760,10 +737,22 @@ xfs_attr_create_done( struct xfs_log_item *intent, unsigned int count) { + struct xfs_attri_log_item *attrip; + struct xfs_attrd_log_item *attrdp; + if (!intent) return NULL; - return &xfs_trans_get_attrd(tp, ATTRI_ITEM(intent))->attrd_item; + attrip = ATTRI_ITEM(intent); + + attrdp = kmem_cache_zalloc(xfs_attrd_cache, GFP_NOFS | __GFP_NOFAIL); + + xfs_log_item_init(tp->t_mountp, &attrdp->attrd_item, XFS_LI_ATTRD, + &xfs_attrd_item_ops); + attrdp->attrd_attrip = attrip; + attrdp->attrd_format.alfd_alf_id = attrip->attri_format.alfi_id; + + return &attrdp->attrd_item; } const struct xfs_defer_op_type xfs_attr_defer_type = { |