]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - libxfs/xfs_defer.h
xfs_repair: initialize non-leaf finobt blocks with correct magic
[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
11/*
12 * Save a log intent item and a list of extents, so that we can replay
13 * whatever action had to happen to the extent list and file the log done
14 * item.
15 */
16struct xfs_defer_pending {
17 const struct xfs_defer_op_type *dfp_type; /* function pointers */
18 struct list_head dfp_list; /* pending items */
a18e1f79 19 void *dfp_intent; /* log intent item */
11d87237 20 void *dfp_done; /* log done item */
a18e1f79
DW
21 struct list_head dfp_work; /* work items */
22 unsigned int dfp_count; /* # extent items */
23};
24
25/*
26 * Header for deferred operation list.
a18e1f79
DW
27 */
28enum xfs_defer_ops_type {
aeb88300 29 XFS_DEFER_OPS_TYPE_BMAP,
23a15a6c 30 XFS_DEFER_OPS_TYPE_REFCOUNT,
589b52d6 31 XFS_DEFER_OPS_TYPE_RMAP,
31a6b02a 32 XFS_DEFER_OPS_TYPE_FREE,
d5c1b462 33 XFS_DEFER_OPS_TYPE_AGFL_FREE,
a18e1f79
DW
34 XFS_DEFER_OPS_TYPE_MAX,
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 {
46 enum xfs_defer_ops_type type;
47 unsigned int max_items;
48 void (*abort_intent)(void *);
49 void *(*create_done)(struct xfs_trans *, void *, unsigned int);
7b3ab230
BF
50 int (*finish_item)(struct xfs_trans *, struct list_head *, void *,
51 void **);
a18e1f79
DW
52 void (*finish_cleanup)(struct xfs_trans *, void *, int);
53 void (*cancel_item)(struct list_head *);
54 int (*diff_items)(void *, struct list_head *, struct list_head *);
55 void *(*create_intent)(struct xfs_trans *, uint);
56 void (*log_item)(struct xfs_trans *, void *, struct list_head *);
57};
58
59void xfs_defer_init_op_type(const struct xfs_defer_op_type *type);
60
61#endif /* __XFS_DEFER_H__ */