1
2
3
4
5
6#ifndef __XFS_DEFER_H__
7#define __XFS_DEFER_H__
8
9struct xfs_btree_cur;
10struct xfs_defer_op_type;
11
12
13
14
15enum xfs_defer_ops_type {
16 XFS_DEFER_OPS_TYPE_BMAP,
17 XFS_DEFER_OPS_TYPE_REFCOUNT,
18 XFS_DEFER_OPS_TYPE_RMAP,
19 XFS_DEFER_OPS_TYPE_FREE,
20 XFS_DEFER_OPS_TYPE_AGFL_FREE,
21 XFS_DEFER_OPS_TYPE_MAX,
22};
23
24
25
26
27
28
29struct xfs_defer_pending {
30 struct list_head dfp_list;
31 struct list_head dfp_work;
32 struct xfs_log_item *dfp_intent;
33 struct xfs_log_item *dfp_done;
34 unsigned int dfp_count;
35 enum xfs_defer_ops_type dfp_type;
36};
37
38void xfs_defer_add(struct xfs_trans *tp, enum xfs_defer_ops_type type,
39 struct list_head *h);
40int xfs_defer_finish_noroll(struct xfs_trans **tp);
41int xfs_defer_finish(struct xfs_trans **tp);
42void xfs_defer_cancel(struct xfs_trans *);
43void xfs_defer_move(struct xfs_trans *dtp, struct xfs_trans *stp);
44
45
46struct xfs_defer_op_type {
47 struct xfs_log_item *(*create_intent)(struct xfs_trans *tp,
48 struct list_head *items, unsigned int count, bool sort);
49 void (*abort_intent)(struct xfs_log_item *intent);
50 struct xfs_log_item *(*create_done)(struct xfs_trans *tp,
51 struct xfs_log_item *intent, unsigned int count);
52 int (*finish_item)(struct xfs_trans *tp, struct xfs_log_item *done,
53 struct list_head *item, struct xfs_btree_cur **state);
54 void (*finish_cleanup)(struct xfs_trans *tp,
55 struct xfs_btree_cur *state, int error);
56 void (*cancel_item)(struct list_head *item);
57 unsigned int max_items;
58};
59
60extern const struct xfs_defer_op_type xfs_bmap_update_defer_type;
61extern const struct xfs_defer_op_type xfs_refcount_update_defer_type;
62extern const struct xfs_defer_op_type xfs_rmap_update_defer_type;
63extern const struct xfs_defer_op_type xfs_extent_free_defer_type;
64extern const struct xfs_defer_op_type xfs_agfl_free_defer_type;
65
66#endif
67