提交 3ec1b26c 编写于 作者: C Christoph Hellwig 提交者: Darrick J. Wong

xfs: use a xfs_btree_cur for the ->finish_cleanup state

Given how XFS is all based around btrees it doesn't make much sense
to offer a totally generic state when we can just use the btree cursor.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NBrian Foster <bfoster@redhat.com>
Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
上级 f09d167c
...@@ -361,7 +361,7 @@ xfs_defer_finish_one( ...@@ -361,7 +361,7 @@ xfs_defer_finish_one(
struct xfs_defer_pending *dfp) struct xfs_defer_pending *dfp)
{ {
const struct xfs_defer_op_type *ops = defer_op_types[dfp->dfp_type]; const struct xfs_defer_op_type *ops = defer_op_types[dfp->dfp_type];
void *state = NULL; struct xfs_btree_cur *state = NULL;
struct list_head *li, *n; struct list_head *li, *n;
int error; int error;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#ifndef __XFS_DEFER_H__ #ifndef __XFS_DEFER_H__
#define __XFS_DEFER_H__ #define __XFS_DEFER_H__
struct xfs_btree_cur;
struct xfs_defer_op_type; struct xfs_defer_op_type;
/* /*
...@@ -49,8 +50,9 @@ struct xfs_defer_op_type { ...@@ -49,8 +50,9 @@ struct xfs_defer_op_type {
struct xfs_log_item *(*create_done)(struct xfs_trans *tp, struct xfs_log_item *(*create_done)(struct xfs_trans *tp,
struct xfs_log_item *intent, unsigned int count); struct xfs_log_item *intent, unsigned int count);
int (*finish_item)(struct xfs_trans *tp, struct xfs_log_item *done, int (*finish_item)(struct xfs_trans *tp, struct xfs_log_item *done,
struct list_head *item, void **state); struct list_head *item, struct xfs_btree_cur **state);
void (*finish_cleanup)(struct xfs_trans *, void *, int); void (*finish_cleanup)(struct xfs_trans *tp,
struct xfs_btree_cur *state, int error);
void (*cancel_item)(struct list_head *); void (*cancel_item)(struct list_head *);
unsigned int max_items; unsigned int max_items;
}; };
......
...@@ -367,7 +367,7 @@ xfs_bmap_update_finish_item( ...@@ -367,7 +367,7 @@ xfs_bmap_update_finish_item(
struct xfs_trans *tp, struct xfs_trans *tp,
struct xfs_log_item *done, struct xfs_log_item *done,
struct list_head *item, struct list_head *item,
void **state) struct xfs_btree_cur **state)
{ {
struct xfs_bmap_intent *bmap; struct xfs_bmap_intent *bmap;
xfs_filblks_t count; xfs_filblks_t count;
......
...@@ -474,7 +474,7 @@ xfs_extent_free_finish_item( ...@@ -474,7 +474,7 @@ xfs_extent_free_finish_item(
struct xfs_trans *tp, struct xfs_trans *tp,
struct xfs_log_item *done, struct xfs_log_item *done,
struct list_head *item, struct list_head *item,
void **state) struct xfs_btree_cur **state)
{ {
struct xfs_extent_free_item *free; struct xfs_extent_free_item *free;
int error; int error;
...@@ -525,7 +525,7 @@ xfs_agfl_free_finish_item( ...@@ -525,7 +525,7 @@ xfs_agfl_free_finish_item(
struct xfs_trans *tp, struct xfs_trans *tp,
struct xfs_log_item *done, struct xfs_log_item *done,
struct list_head *item, struct list_head *item,
void **state) struct xfs_btree_cur **state)
{ {
struct xfs_mount *mp = tp->t_mountp; struct xfs_mount *mp = tp->t_mountp;
struct xfs_efd_log_item *efdp = EFD_ITEM(done); struct xfs_efd_log_item *efdp = EFD_ITEM(done);
......
...@@ -366,7 +366,7 @@ xfs_refcount_update_finish_item( ...@@ -366,7 +366,7 @@ xfs_refcount_update_finish_item(
struct xfs_trans *tp, struct xfs_trans *tp,
struct xfs_log_item *done, struct xfs_log_item *done,
struct list_head *item, struct list_head *item,
void **state) struct xfs_btree_cur **state)
{ {
struct xfs_refcount_intent *refc; struct xfs_refcount_intent *refc;
xfs_fsblock_t new_fsb; xfs_fsblock_t new_fsb;
...@@ -375,11 +375,9 @@ xfs_refcount_update_finish_item( ...@@ -375,11 +375,9 @@ xfs_refcount_update_finish_item(
refc = container_of(item, struct xfs_refcount_intent, ri_list); refc = container_of(item, struct xfs_refcount_intent, ri_list);
error = xfs_trans_log_finish_refcount_update(tp, CUD_ITEM(done), error = xfs_trans_log_finish_refcount_update(tp, CUD_ITEM(done),
refc->ri_type, refc->ri_type, refc->ri_startblock, refc->ri_blockcount,
refc->ri_startblock, &new_fsb, &new_aglen, state);
refc->ri_blockcount,
&new_fsb, &new_aglen,
(struct xfs_btree_cur **)state);
/* Did we run out of reservation? Requeue what we didn't finish. */ /* Did we run out of reservation? Requeue what we didn't finish. */
if (!error && new_aglen > 0) { if (!error && new_aglen > 0) {
ASSERT(refc->ri_type == XFS_REFCOUNT_INCREASE || ASSERT(refc->ri_type == XFS_REFCOUNT_INCREASE ||
...@@ -392,18 +390,6 @@ xfs_refcount_update_finish_item( ...@@ -392,18 +390,6 @@ xfs_refcount_update_finish_item(
return error; return error;
} }
/* Clean up after processing deferred refcounts. */
STATIC void
xfs_refcount_update_finish_cleanup(
struct xfs_trans *tp,
void *state,
int error)
{
struct xfs_btree_cur *rcur = state;
xfs_refcount_finish_one_cleanup(tp, rcur, error);
}
/* Abort all pending CUIs. */ /* Abort all pending CUIs. */
STATIC void STATIC void
xfs_refcount_update_abort_intent( xfs_refcount_update_abort_intent(
...@@ -429,7 +415,7 @@ const struct xfs_defer_op_type xfs_refcount_update_defer_type = { ...@@ -429,7 +415,7 @@ const struct xfs_defer_op_type xfs_refcount_update_defer_type = {
.abort_intent = xfs_refcount_update_abort_intent, .abort_intent = xfs_refcount_update_abort_intent,
.create_done = xfs_refcount_update_create_done, .create_done = xfs_refcount_update_create_done,
.finish_item = xfs_refcount_update_finish_item, .finish_item = xfs_refcount_update_finish_item,
.finish_cleanup = xfs_refcount_update_finish_cleanup, .finish_cleanup = xfs_refcount_finish_one_cleanup,
.cancel_item = xfs_refcount_update_cancel_item, .cancel_item = xfs_refcount_update_cancel_item,
}; };
......
...@@ -418,36 +418,21 @@ xfs_rmap_update_finish_item( ...@@ -418,36 +418,21 @@ xfs_rmap_update_finish_item(
struct xfs_trans *tp, struct xfs_trans *tp,
struct xfs_log_item *done, struct xfs_log_item *done,
struct list_head *item, struct list_head *item,
void **state) struct xfs_btree_cur **state)
{ {
struct xfs_rmap_intent *rmap; struct xfs_rmap_intent *rmap;
int error; int error;
rmap = container_of(item, struct xfs_rmap_intent, ri_list); rmap = container_of(item, struct xfs_rmap_intent, ri_list);
error = xfs_trans_log_finish_rmap_update(tp, RUD_ITEM(done), error = xfs_trans_log_finish_rmap_update(tp, RUD_ITEM(done),
rmap->ri_type, rmap->ri_type, rmap->ri_owner, rmap->ri_whichfork,
rmap->ri_owner, rmap->ri_whichfork, rmap->ri_bmap.br_startoff, rmap->ri_bmap.br_startblock,
rmap->ri_bmap.br_startoff, rmap->ri_bmap.br_blockcount, rmap->ri_bmap.br_state,
rmap->ri_bmap.br_startblock, state);
rmap->ri_bmap.br_blockcount,
rmap->ri_bmap.br_state,
(struct xfs_btree_cur **)state);
kmem_free(rmap); kmem_free(rmap);
return error; return error;
} }
/* Clean up after processing deferred rmaps. */
STATIC void
xfs_rmap_update_finish_cleanup(
struct xfs_trans *tp,
void *state,
int error)
{
struct xfs_btree_cur *rcur = state;
xfs_rmap_finish_one_cleanup(tp, rcur, error);
}
/* Abort all pending RUIs. */ /* Abort all pending RUIs. */
STATIC void STATIC void
xfs_rmap_update_abort_intent( xfs_rmap_update_abort_intent(
...@@ -473,7 +458,7 @@ const struct xfs_defer_op_type xfs_rmap_update_defer_type = { ...@@ -473,7 +458,7 @@ const struct xfs_defer_op_type xfs_rmap_update_defer_type = {
.abort_intent = xfs_rmap_update_abort_intent, .abort_intent = xfs_rmap_update_abort_intent,
.create_done = xfs_rmap_update_create_done, .create_done = xfs_rmap_update_create_done,
.finish_item = xfs_rmap_update_finish_item, .finish_item = xfs_rmap_update_finish_item,
.finish_cleanup = xfs_rmap_update_finish_cleanup, .finish_cleanup = xfs_rmap_finish_one_cleanup,
.cancel_item = xfs_rmap_update_cancel_item, .cancel_item = xfs_rmap_update_cancel_item,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册