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;
11struct xfs_defer_capture;
12
13
14
15
16enum xfs_defer_ops_type {
17 XFS_DEFER_OPS_TYPE_BMAP,
18 XFS_DEFER_OPS_TYPE_REFCOUNT,
19 XFS_DEFER_OPS_TYPE_RMAP,
20 XFS_DEFER_OPS_TYPE_FREE,
21 XFS_DEFER_OPS_TYPE_AGFL_FREE,
22 XFS_DEFER_OPS_TYPE_MAX,
23};
24
25
26
27
28
29
30struct xfs_defer_pending {
31 struct list_head dfp_list;
32 struct list_head dfp_work;
33 struct xfs_log_item *dfp_intent;
34 struct xfs_log_item *dfp_done;
35 unsigned int dfp_count;
36 enum xfs_defer_ops_type dfp_type;
37};
38
39void xfs_defer_add(struct xfs_trans *tp, enum xfs_defer_ops_type type,
40 struct list_head *h);
41int xfs_defer_finish_noroll(struct xfs_trans **tp);
42int xfs_defer_finish(struct xfs_trans **tp);
43void xfs_defer_cancel(struct xfs_trans *);
44void xfs_defer_move(struct xfs_trans *dtp, struct xfs_trans *stp);
45
46
47struct xfs_defer_op_type {
48 struct xfs_log_item *(*create_intent)(struct xfs_trans *tp,
49 struct list_head *items, unsigned int count, bool sort);
50 void (*abort_intent)(struct xfs_log_item *intent);
51 struct xfs_log_item *(*create_done)(struct xfs_trans *tp,
52 struct xfs_log_item *intent, unsigned int count);
53 int (*finish_item)(struct xfs_trans *tp, struct xfs_log_item *done,
54 struct list_head *item, struct xfs_btree_cur **state);
55 void (*finish_cleanup)(struct xfs_trans *tp,
56 struct xfs_btree_cur *state, int error);
57 void (*cancel_item)(struct list_head *item);
58 unsigned int max_items;
59};
60
61extern const struct xfs_defer_op_type xfs_bmap_update_defer_type;
62extern const struct xfs_defer_op_type xfs_refcount_update_defer_type;
63extern const struct xfs_defer_op_type xfs_rmap_update_defer_type;
64extern const struct xfs_defer_op_type xfs_extent_free_defer_type;
65extern const struct xfs_defer_op_type xfs_agfl_free_defer_type;
66
67
68
69
70
71struct xfs_defer_capture {
72
73 struct list_head dfc_list;
74
75
76 struct list_head dfc_dfops;
77 unsigned int dfc_tpflags;
78
79
80 unsigned int dfc_blkres;
81 unsigned int dfc_rtxres;
82
83
84 unsigned int dfc_logres;
85
86
87
88
89
90 struct xfs_inode *dfc_capture_ip;
91};
92
93
94
95
96
97int xfs_defer_ops_capture_and_commit(struct xfs_trans *tp,
98 struct xfs_inode *capture_ip, struct list_head *capture_list);
99void xfs_defer_ops_continue(struct xfs_defer_capture *d, struct xfs_trans *tp,
100 struct xfs_inode **captured_ipp);
101void xfs_defer_ops_release(struct xfs_mount *mp, struct xfs_defer_capture *d);
102
103#endif
104