]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - libxfs/xfs_defer.h
libxfs: refactor manage_zones()
[thirdparty/xfsprogs-dev.git] / libxfs / xfs_defer.h
CommitLineData
37b3b4d6 1// SPDX-License-Identifier: GPL-2.0+
a18e1f79
DW
2/*
3 * Copyright (C) 2016 Oracle. All Rights Reserved.
a18e1f79 4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
a18e1f79
DW
5 */
6#ifndef __XFS_DEFER_H__
7#define __XFS_DEFER_H__
8
9struct xfs_defer_op_type;
10
a18e1f79
DW
11/*
12 * Header for deferred operation list.
a18e1f79
DW
13 */
14enum xfs_defer_ops_type {
aeb88300 15 XFS_DEFER_OPS_TYPE_BMAP,
23a15a6c 16 XFS_DEFER_OPS_TYPE_REFCOUNT,
589b52d6 17 XFS_DEFER_OPS_TYPE_RMAP,
31a6b02a 18 XFS_DEFER_OPS_TYPE_FREE,
d5c1b462 19 XFS_DEFER_OPS_TYPE_AGFL_FREE,
a18e1f79
DW
20 XFS_DEFER_OPS_TYPE_MAX,
21};
22
c3514397
DW
23/*
24 * Save a log intent item and a list of extents, so that we can replay
25 * whatever action had to happen to the extent list and file the log done
26 * item.
27 */
28struct xfs_defer_pending {
29 struct list_head dfp_list; /* pending items */
30 struct list_head dfp_work; /* work items */
31 void *dfp_intent; /* log intent item */
32 void *dfp_done; /* log done item */
33 unsigned int dfp_count; /* # extent items */
34 enum xfs_defer_ops_type dfp_type;
35};
36
21375e5d 37void xfs_defer_add(struct xfs_trans *tp, enum xfs_defer_ops_type type,
a18e1f79 38 struct list_head *h);
ca7e896f 39int xfs_defer_finish_noroll(struct xfs_trans **tp);
ac0a2228 40int xfs_defer_finish(struct xfs_trans **tp);
22913550 41void xfs_defer_cancel(struct xfs_trans *);
76a3c33d 42void xfs_defer_move(struct xfs_trans *dtp, struct xfs_trans *stp);
a18e1f79
DW
43
44/* Description of a deferred type. */
45struct xfs_defer_op_type {
a18e1f79
DW
46 void (*abort_intent)(void *);
47 void *(*create_done)(struct xfs_trans *, void *, unsigned int);
7b3ab230
BF
48 int (*finish_item)(struct xfs_trans *, struct list_head *, void *,
49 void **);
a18e1f79
DW
50 void (*finish_cleanup)(struct xfs_trans *, void *, int);
51 void (*cancel_item)(struct list_head *);
52 int (*diff_items)(void *, struct list_head *, struct list_head *);
53 void *(*create_intent)(struct xfs_trans *, uint);
54 void (*log_item)(struct xfs_trans *, void *, struct list_head *);
c3514397 55 unsigned int max_items;
a18e1f79
DW
56};
57
29ce8c42
DW
58extern const struct xfs_defer_op_type xfs_bmap_update_defer_type;
59extern const struct xfs_defer_op_type xfs_refcount_update_defer_type;
60extern const struct xfs_defer_op_type xfs_rmap_update_defer_type;
61extern const struct xfs_defer_op_type xfs_extent_free_defer_type;
62extern const struct xfs_defer_op_type xfs_agfl_free_defer_type;
a18e1f79
DW
63
64#endif /* __XFS_DEFER_H__ */