Commit 603ce8ab authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Chandan Babu R

xfs: pass the defer ops directly to xfs_defer_add

Pass a pointer to the xfs_defer_op_type structure to xfs_defer_add and
remove the indirection through the xfs_defer_ops_type enum and a global
table of all possible operations.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatar"Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>
parent dc22af64
...@@ -2514,7 +2514,7 @@ xfs_defer_agfl_block( ...@@ -2514,7 +2514,7 @@ xfs_defer_agfl_block(
trace_xfs_agfl_free_defer(mp, agno, 0, agbno, 1); trace_xfs_agfl_free_defer(mp, agno, 0, agbno, 1);
xfs_extent_free_get_group(mp, xefi); xfs_extent_free_get_group(mp, xefi);
xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_AGFL_FREE, &xefi->xefi_list); xfs_defer_add(tp, &xefi->xefi_list, &xfs_agfl_free_defer_type);
return 0; return 0;
} }
...@@ -2578,7 +2578,7 @@ xfs_defer_extent_free( ...@@ -2578,7 +2578,7 @@ xfs_defer_extent_free(
XFS_FSB_TO_AGBNO(tp->t_mountp, bno), len); XFS_FSB_TO_AGBNO(tp->t_mountp, bno), len);
xfs_extent_free_get_group(mp, xefi); xfs_extent_free_get_group(mp, xefi);
*dfpp = xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_FREE, &xefi->xefi_list); *dfpp = xfs_defer_add(tp, &xefi->xefi_list, &xfs_extent_free_defer_type);
return 0; return 0;
} }
......
...@@ -906,7 +906,7 @@ xfs_attr_defer_add( ...@@ -906,7 +906,7 @@ xfs_attr_defer_add(
ASSERT(0); ASSERT(0);
} }
xfs_defer_add(args->trans, XFS_DEFER_OPS_TYPE_ATTR, &new->xattri_list); xfs_defer_add(args->trans, &new->xattri_list, &xfs_attr_defer_type);
trace_xfs_attr_defer_add(new->xattri_dela_state, args->dp); trace_xfs_attr_defer_add(new->xattri_dela_state, args->dp);
} }
......
...@@ -6091,7 +6091,7 @@ __xfs_bmap_add( ...@@ -6091,7 +6091,7 @@ __xfs_bmap_add(
bi->bi_bmap = *bmap; bi->bi_bmap = *bmap;
xfs_bmap_update_get_group(tp->t_mountp, bi); xfs_bmap_update_get_group(tp->t_mountp, bi);
xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_BMAP, &bi->bi_list); xfs_defer_add(tp, &bi->bi_list, &xfs_bmap_update_defer_type);
return 0; return 0;
} }
......
...@@ -235,16 +235,6 @@ static const struct xfs_defer_op_type xfs_barrier_defer_type = { ...@@ -235,16 +235,6 @@ static const struct xfs_defer_op_type xfs_barrier_defer_type = {
.cancel_item = xfs_defer_barrier_cancel_item, .cancel_item = xfs_defer_barrier_cancel_item,
}; };
static const struct xfs_defer_op_type *defer_op_types[] = {
[XFS_DEFER_OPS_TYPE_BMAP] = &xfs_bmap_update_defer_type,
[XFS_DEFER_OPS_TYPE_REFCOUNT] = &xfs_refcount_update_defer_type,
[XFS_DEFER_OPS_TYPE_RMAP] = &xfs_rmap_update_defer_type,
[XFS_DEFER_OPS_TYPE_FREE] = &xfs_extent_free_defer_type,
[XFS_DEFER_OPS_TYPE_AGFL_FREE] = &xfs_agfl_free_defer_type,
[XFS_DEFER_OPS_TYPE_ATTR] = &xfs_attr_defer_type,
[XFS_DEFER_OPS_TYPE_BARRIER] = &xfs_barrier_defer_type,
};
/* Create a log intent done item for a log intent item. */ /* Create a log intent done item for a log intent item. */
static inline void static inline void
xfs_defer_create_done( xfs_defer_create_done(
...@@ -847,14 +837,12 @@ xfs_defer_alloc( ...@@ -847,14 +837,12 @@ xfs_defer_alloc(
struct xfs_defer_pending * struct xfs_defer_pending *
xfs_defer_add( xfs_defer_add(
struct xfs_trans *tp, struct xfs_trans *tp,
enum xfs_defer_ops_type type, struct list_head *li,
struct list_head *li) const struct xfs_defer_op_type *ops)
{ {
struct xfs_defer_pending *dfp = NULL; struct xfs_defer_pending *dfp = NULL;
const struct xfs_defer_op_type *ops = defer_op_types[type];
ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES);
BUILD_BUG_ON(ARRAY_SIZE(defer_op_types) != XFS_DEFER_OPS_TYPE_MAX);
dfp = xfs_defer_find_last(tp, ops); dfp = xfs_defer_find_last(tp, ops);
if (!dfp || !xfs_defer_can_append(dfp, ops)) if (!dfp || !xfs_defer_can_append(dfp, ops))
......
...@@ -10,20 +10,6 @@ struct xfs_btree_cur; ...@@ -10,20 +10,6 @@ struct xfs_btree_cur;
struct xfs_defer_op_type; struct xfs_defer_op_type;
struct xfs_defer_capture; struct xfs_defer_capture;
/*
* Header for deferred operation list.
*/
enum xfs_defer_ops_type {
XFS_DEFER_OPS_TYPE_BMAP,
XFS_DEFER_OPS_TYPE_REFCOUNT,
XFS_DEFER_OPS_TYPE_RMAP,
XFS_DEFER_OPS_TYPE_FREE,
XFS_DEFER_OPS_TYPE_AGFL_FREE,
XFS_DEFER_OPS_TYPE_ATTR,
XFS_DEFER_OPS_TYPE_BARRIER,
XFS_DEFER_OPS_TYPE_MAX,
};
/* /*
* Save a log intent item and a list of extents, so that we can replay * Save a log intent item and a list of extents, so that we can replay
* whatever action had to happen to the extent list and file the log done * whatever action had to happen to the extent list and file the log done
...@@ -51,8 +37,8 @@ struct xfs_defer_pending { ...@@ -51,8 +37,8 @@ struct xfs_defer_pending {
void xfs_defer_item_pause(struct xfs_trans *tp, struct xfs_defer_pending *dfp); void xfs_defer_item_pause(struct xfs_trans *tp, struct xfs_defer_pending *dfp);
void xfs_defer_item_unpause(struct xfs_trans *tp, struct xfs_defer_pending *dfp); void xfs_defer_item_unpause(struct xfs_trans *tp, struct xfs_defer_pending *dfp);
struct xfs_defer_pending *xfs_defer_add(struct xfs_trans *tp, struct xfs_defer_pending *xfs_defer_add(struct xfs_trans *tp, struct list_head *h,
enum xfs_defer_ops_type type, struct list_head *h); const struct xfs_defer_op_type *ops);
int xfs_defer_finish_noroll(struct xfs_trans **tp); int xfs_defer_finish_noroll(struct xfs_trans **tp);
int xfs_defer_finish(struct xfs_trans **tp); int xfs_defer_finish(struct xfs_trans **tp);
int xfs_defer_finish_one(struct xfs_trans *tp, struct xfs_defer_pending *dfp); int xfs_defer_finish_one(struct xfs_trans *tp, struct xfs_defer_pending *dfp);
......
...@@ -1458,7 +1458,7 @@ __xfs_refcount_add( ...@@ -1458,7 +1458,7 @@ __xfs_refcount_add(
ri->ri_blockcount = blockcount; ri->ri_blockcount = blockcount;
xfs_refcount_update_get_group(tp->t_mountp, ri); xfs_refcount_update_get_group(tp->t_mountp, ri);
xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_REFCOUNT, &ri->ri_list); xfs_defer_add(tp, &ri->ri_list, &xfs_refcount_update_defer_type);
} }
/* /*
......
...@@ -2567,7 +2567,7 @@ __xfs_rmap_add( ...@@ -2567,7 +2567,7 @@ __xfs_rmap_add(
ri->ri_bmap = *bmap; ri->ri_bmap = *bmap;
xfs_rmap_update_get_group(tp->t_mountp, ri); xfs_rmap_update_get_group(tp->t_mountp, ri);
xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_RMAP, &ri->ri_list); xfs_defer_add(tp, &ri->ri_list, &xfs_rmap_update_defer_type);
} }
/* Map an extent into a file. */ /* Map an extent into a file. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment