2018-06-06 02:42:14 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2016-08-03 01:12:25 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Oracle. All Rights Reserved.
|
|
|
|
* Author: Darrick J. Wong <darrick.wong@oracle.com>
|
|
|
|
*/
|
|
|
|
#ifndef __XFS_DEFER_H__
|
|
|
|
#define __XFS_DEFER_H__
|
|
|
|
|
|
|
|
struct xfs_defer_op_type;
|
2018-07-24 20:43:11 +00:00
|
|
|
struct xfs_defer_ops;
|
2016-08-03 01:12:25 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Save a log intent item and a list of extents, so that we can replay
|
|
|
|
* whatever action had to happen to the extent list and file the log done
|
|
|
|
* item.
|
|
|
|
*/
|
|
|
|
struct xfs_defer_pending {
|
|
|
|
const struct xfs_defer_op_type *dfp_type; /* function pointers */
|
|
|
|
struct list_head dfp_list; /* pending items */
|
|
|
|
void *dfp_intent; /* log intent item */
|
2016-08-30 03:51:39 +00:00
|
|
|
void *dfp_done; /* log done item */
|
2016-08-03 01:12:25 +00:00
|
|
|
struct list_head dfp_work; /* work items */
|
|
|
|
unsigned int dfp_count; /* # extent items */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Header for deferred operation list.
|
|
|
|
*/
|
|
|
|
enum xfs_defer_ops_type {
|
2016-10-03 16:11:28 +00:00
|
|
|
XFS_DEFER_OPS_TYPE_BMAP,
|
2016-10-03 16:11:22 +00:00
|
|
|
XFS_DEFER_OPS_TYPE_REFCOUNT,
|
2016-08-03 02:11:01 +00:00
|
|
|
XFS_DEFER_OPS_TYPE_RMAP,
|
2016-08-03 01:14:35 +00:00
|
|
|
XFS_DEFER_OPS_TYPE_FREE,
|
2018-05-08 00:38:47 +00:00
|
|
|
XFS_DEFER_OPS_TYPE_AGFL_FREE,
|
2016-08-03 01:12:25 +00:00
|
|
|
XFS_DEFER_OPS_TYPE_MAX,
|
|
|
|
};
|
|
|
|
|
2018-08-01 14:20:34 +00:00
|
|
|
void xfs_defer_add(struct xfs_trans *tp, enum xfs_defer_ops_type type,
|
2016-08-03 01:12:25 +00:00
|
|
|
struct list_head *h);
|
2018-07-24 20:43:15 +00:00
|
|
|
int xfs_defer_finish_noroll(struct xfs_trans **tp);
|
2018-07-24 20:43:15 +00:00
|
|
|
int xfs_defer_finish(struct xfs_trans **tp);
|
2018-08-01 14:20:30 +00:00
|
|
|
void xfs_defer_cancel(struct xfs_trans *);
|
2018-07-12 05:26:33 +00:00
|
|
|
void xfs_defer_init(struct xfs_trans *tp, struct xfs_defer_ops *dop);
|
2018-08-01 14:20:30 +00:00
|
|
|
void xfs_defer_move(struct xfs_trans *dtp, struct xfs_trans *stp);
|
2016-08-03 01:12:25 +00:00
|
|
|
|
|
|
|
/* Description of a deferred type. */
|
|
|
|
struct xfs_defer_op_type {
|
|
|
|
enum xfs_defer_ops_type type;
|
|
|
|
unsigned int max_items;
|
|
|
|
void (*abort_intent)(void *);
|
|
|
|
void *(*create_done)(struct xfs_trans *, void *, unsigned int);
|
2018-08-01 14:20:32 +00:00
|
|
|
int (*finish_item)(struct xfs_trans *, struct list_head *, void *,
|
|
|
|
void **);
|
2016-08-03 01:12:25 +00:00
|
|
|
void (*finish_cleanup)(struct xfs_trans *, void *, int);
|
|
|
|
void (*cancel_item)(struct list_head *);
|
|
|
|
int (*diff_items)(void *, struct list_head *, struct list_head *);
|
|
|
|
void *(*create_intent)(struct xfs_trans *, uint);
|
|
|
|
void (*log_item)(struct xfs_trans *, void *, struct list_head *);
|
|
|
|
};
|
|
|
|
|
|
|
|
void xfs_defer_init_op_type(const struct xfs_defer_op_type *type);
|
|
|
|
|
|
|
|
#endif /* __XFS_DEFER_H__ */
|