18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
48c2ecf20Sopenharmony_ci * All Rights Reserved.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci#ifndef	__XFS_TRANS_H__
78c2ecf20Sopenharmony_ci#define	__XFS_TRANS_H__
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci/* kernel only transaction subsystem defines */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_cistruct xfs_buf;
128c2ecf20Sopenharmony_cistruct xfs_buftarg;
138c2ecf20Sopenharmony_cistruct xfs_efd_log_item;
148c2ecf20Sopenharmony_cistruct xfs_efi_log_item;
158c2ecf20Sopenharmony_cistruct xfs_inode;
168c2ecf20Sopenharmony_cistruct xfs_item_ops;
178c2ecf20Sopenharmony_cistruct xfs_log_iovec;
188c2ecf20Sopenharmony_cistruct xfs_mount;
198c2ecf20Sopenharmony_cistruct xfs_trans;
208c2ecf20Sopenharmony_cistruct xfs_trans_res;
218c2ecf20Sopenharmony_cistruct xfs_dquot_acct;
228c2ecf20Sopenharmony_cistruct xfs_rud_log_item;
238c2ecf20Sopenharmony_cistruct xfs_rui_log_item;
248c2ecf20Sopenharmony_cistruct xfs_btree_cur;
258c2ecf20Sopenharmony_cistruct xfs_cui_log_item;
268c2ecf20Sopenharmony_cistruct xfs_cud_log_item;
278c2ecf20Sopenharmony_cistruct xfs_bui_log_item;
288c2ecf20Sopenharmony_cistruct xfs_bud_log_item;
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistruct xfs_log_item {
318c2ecf20Sopenharmony_ci	struct list_head		li_ail;		/* AIL pointers */
328c2ecf20Sopenharmony_ci	struct list_head		li_trans;	/* transaction list */
338c2ecf20Sopenharmony_ci	xfs_lsn_t			li_lsn;		/* last on-disk lsn */
348c2ecf20Sopenharmony_ci	struct xfs_mount		*li_mountp;	/* ptr to fs mount */
358c2ecf20Sopenharmony_ci	struct xfs_ail			*li_ailp;	/* ptr to AIL */
368c2ecf20Sopenharmony_ci	uint				li_type;	/* item type */
378c2ecf20Sopenharmony_ci	unsigned long			li_flags;	/* misc flags */
388c2ecf20Sopenharmony_ci	struct xfs_buf			*li_buf;	/* real buffer pointer */
398c2ecf20Sopenharmony_ci	struct list_head		li_bio_list;	/* buffer item list */
408c2ecf20Sopenharmony_ci	const struct xfs_item_ops	*li_ops;	/* function list */
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci	/* delayed logging */
438c2ecf20Sopenharmony_ci	struct list_head		li_cil;		/* CIL pointers */
448c2ecf20Sopenharmony_ci	struct xfs_log_vec		*li_lv;		/* active log vector */
458c2ecf20Sopenharmony_ci	struct xfs_log_vec		*li_lv_shadow;	/* standby vector */
468c2ecf20Sopenharmony_ci	xfs_csn_t			li_seq;		/* CIL commit seq */
478c2ecf20Sopenharmony_ci};
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/*
508c2ecf20Sopenharmony_ci * li_flags use the (set/test/clear)_bit atomic interfaces because updates can
518c2ecf20Sopenharmony_ci * race with each other and we don't want to have to use the AIL lock to
528c2ecf20Sopenharmony_ci * serialise all updates.
538c2ecf20Sopenharmony_ci */
548c2ecf20Sopenharmony_ci#define	XFS_LI_IN_AIL	0
558c2ecf20Sopenharmony_ci#define	XFS_LI_ABORTED	1
568c2ecf20Sopenharmony_ci#define	XFS_LI_FAILED	2
578c2ecf20Sopenharmony_ci#define	XFS_LI_DIRTY	3	/* log item dirty in transaction */
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define XFS_LI_FLAGS \
608c2ecf20Sopenharmony_ci	{ (1 << XFS_LI_IN_AIL),		"IN_AIL" }, \
618c2ecf20Sopenharmony_ci	{ (1 << XFS_LI_ABORTED),	"ABORTED" }, \
628c2ecf20Sopenharmony_ci	{ (1 << XFS_LI_FAILED),		"FAILED" }, \
638c2ecf20Sopenharmony_ci	{ (1 << XFS_LI_DIRTY),		"DIRTY" }
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_cistruct xfs_item_ops {
668c2ecf20Sopenharmony_ci	unsigned flags;
678c2ecf20Sopenharmony_ci	void (*iop_size)(struct xfs_log_item *, int *, int *);
688c2ecf20Sopenharmony_ci	void (*iop_format)(struct xfs_log_item *, struct xfs_log_vec *);
698c2ecf20Sopenharmony_ci	void (*iop_pin)(struct xfs_log_item *);
708c2ecf20Sopenharmony_ci	void (*iop_unpin)(struct xfs_log_item *, int remove);
718c2ecf20Sopenharmony_ci	uint (*iop_push)(struct xfs_log_item *, struct list_head *);
728c2ecf20Sopenharmony_ci	void (*iop_committing)(struct xfs_log_item *lip, xfs_csn_t seq);
738c2ecf20Sopenharmony_ci	void (*iop_release)(struct xfs_log_item *);
748c2ecf20Sopenharmony_ci	xfs_lsn_t (*iop_committed)(struct xfs_log_item *, xfs_lsn_t);
758c2ecf20Sopenharmony_ci	int (*iop_recover)(struct xfs_log_item *lip,
768c2ecf20Sopenharmony_ci			   struct list_head *capture_list);
778c2ecf20Sopenharmony_ci	bool (*iop_match)(struct xfs_log_item *item, uint64_t id);
788c2ecf20Sopenharmony_ci	struct xfs_log_item *(*iop_relog)(struct xfs_log_item *intent,
798c2ecf20Sopenharmony_ci			struct xfs_trans *tp);
808c2ecf20Sopenharmony_ci};
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci/* Is this log item a deferred action intent? */
838c2ecf20Sopenharmony_cistatic inline bool
848c2ecf20Sopenharmony_cixlog_item_is_intent(struct xfs_log_item *lip)
858c2ecf20Sopenharmony_ci{
868c2ecf20Sopenharmony_ci	return lip->li_ops->iop_recover != NULL &&
878c2ecf20Sopenharmony_ci	       lip->li_ops->iop_match != NULL;
888c2ecf20Sopenharmony_ci}
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci/* Is this a log intent-done item? */
918c2ecf20Sopenharmony_cistatic inline bool
928c2ecf20Sopenharmony_cixlog_item_is_intent_done(struct xfs_log_item *lip)
938c2ecf20Sopenharmony_ci{
948c2ecf20Sopenharmony_ci	return lip->li_ops->iop_unpin == NULL &&
958c2ecf20Sopenharmony_ci	       lip->li_ops->iop_push == NULL;
968c2ecf20Sopenharmony_ci}
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/*
998c2ecf20Sopenharmony_ci * Release the log item as soon as committed.  This is for items just logging
1008c2ecf20Sopenharmony_ci * intents that never need to be written back in place.
1018c2ecf20Sopenharmony_ci */
1028c2ecf20Sopenharmony_ci#define XFS_ITEM_RELEASE_WHEN_COMMITTED	(1 << 0)
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_civoid	xfs_log_item_init(struct xfs_mount *mp, struct xfs_log_item *item,
1058c2ecf20Sopenharmony_ci			  int type, const struct xfs_item_ops *ops);
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci/*
1088c2ecf20Sopenharmony_ci * Return values for the iop_push() routines.
1098c2ecf20Sopenharmony_ci */
1108c2ecf20Sopenharmony_ci#define XFS_ITEM_SUCCESS	0
1118c2ecf20Sopenharmony_ci#define XFS_ITEM_PINNED		1
1128c2ecf20Sopenharmony_ci#define XFS_ITEM_LOCKED		2
1138c2ecf20Sopenharmony_ci#define XFS_ITEM_FLUSHING	3
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci/*
1168c2ecf20Sopenharmony_ci * Deferred operation item relogging limits.
1178c2ecf20Sopenharmony_ci */
1188c2ecf20Sopenharmony_ci#define XFS_DEFER_OPS_NR_INODES	2	/* join up to two inodes */
1198c2ecf20Sopenharmony_ci#define XFS_DEFER_OPS_NR_BUFS	2	/* join up to two buffers */
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci/*
1228c2ecf20Sopenharmony_ci * This is the structure maintained for every active transaction.
1238c2ecf20Sopenharmony_ci */
1248c2ecf20Sopenharmony_citypedef struct xfs_trans {
1258c2ecf20Sopenharmony_ci	unsigned int		t_magic;	/* magic number */
1268c2ecf20Sopenharmony_ci	unsigned int		t_log_res;	/* amt of log space resvd */
1278c2ecf20Sopenharmony_ci	unsigned int		t_log_count;	/* count for perm log res */
1288c2ecf20Sopenharmony_ci	unsigned int		t_blk_res;	/* # of blocks resvd */
1298c2ecf20Sopenharmony_ci	unsigned int		t_blk_res_used;	/* # of resvd blocks used */
1308c2ecf20Sopenharmony_ci	unsigned int		t_rtx_res;	/* # of rt extents resvd */
1318c2ecf20Sopenharmony_ci	unsigned int		t_rtx_res_used;	/* # of resvd rt extents used */
1328c2ecf20Sopenharmony_ci	unsigned int		t_flags;	/* misc flags */
1338c2ecf20Sopenharmony_ci	xfs_fsblock_t		t_firstblock;	/* first block allocated */
1348c2ecf20Sopenharmony_ci	struct xlog_ticket	*t_ticket;	/* log mgr ticket */
1358c2ecf20Sopenharmony_ci	struct xfs_mount	*t_mountp;	/* ptr to fs mount struct */
1368c2ecf20Sopenharmony_ci	struct xfs_dquot_acct   *t_dqinfo;	/* acctg info for dquots */
1378c2ecf20Sopenharmony_ci	int64_t			t_icount_delta;	/* superblock icount change */
1388c2ecf20Sopenharmony_ci	int64_t			t_ifree_delta;	/* superblock ifree change */
1398c2ecf20Sopenharmony_ci	int64_t			t_fdblocks_delta; /* superblock fdblocks chg */
1408c2ecf20Sopenharmony_ci	int64_t			t_res_fdblocks_delta; /* on-disk only chg */
1418c2ecf20Sopenharmony_ci	int64_t			t_frextents_delta;/* superblock freextents chg*/
1428c2ecf20Sopenharmony_ci	int64_t			t_res_frextents_delta; /* on-disk only chg */
1438c2ecf20Sopenharmony_ci#if defined(DEBUG) || defined(XFS_WARN)
1448c2ecf20Sopenharmony_ci	int64_t			t_ag_freeblks_delta; /* debugging counter */
1458c2ecf20Sopenharmony_ci	int64_t			t_ag_flist_delta; /* debugging counter */
1468c2ecf20Sopenharmony_ci	int64_t			t_ag_btree_delta; /* debugging counter */
1478c2ecf20Sopenharmony_ci#endif
1488c2ecf20Sopenharmony_ci	int64_t			t_dblocks_delta;/* superblock dblocks change */
1498c2ecf20Sopenharmony_ci	int64_t			t_agcount_delta;/* superblock agcount change */
1508c2ecf20Sopenharmony_ci	int64_t			t_imaxpct_delta;/* superblock imaxpct change */
1518c2ecf20Sopenharmony_ci	int64_t			t_rextsize_delta;/* superblock rextsize chg */
1528c2ecf20Sopenharmony_ci	int64_t			t_rbmblocks_delta;/* superblock rbmblocks chg */
1538c2ecf20Sopenharmony_ci	int64_t			t_rblocks_delta;/* superblock rblocks change */
1548c2ecf20Sopenharmony_ci	int64_t			t_rextents_delta;/* superblocks rextents chg */
1558c2ecf20Sopenharmony_ci	int64_t			t_rextslog_delta;/* superblocks rextslog chg */
1568c2ecf20Sopenharmony_ci	struct list_head	t_items;	/* log item descriptors */
1578c2ecf20Sopenharmony_ci	struct list_head	t_busy;		/* list of busy extents */
1588c2ecf20Sopenharmony_ci	struct list_head	t_dfops;	/* deferred operations */
1598c2ecf20Sopenharmony_ci	unsigned long		t_pflags;	/* saved process flags state */
1608c2ecf20Sopenharmony_ci} xfs_trans_t;
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci/*
1638c2ecf20Sopenharmony_ci * XFS transaction mechanism exported interfaces that are
1648c2ecf20Sopenharmony_ci * actually macros.
1658c2ecf20Sopenharmony_ci */
1668c2ecf20Sopenharmony_ci#define	xfs_trans_set_sync(tp)		((tp)->t_flags |= XFS_TRANS_SYNC)
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci#if defined(DEBUG) || defined(XFS_WARN)
1698c2ecf20Sopenharmony_ci#define	xfs_trans_agblocks_delta(tp, d)	((tp)->t_ag_freeblks_delta += (int64_t)d)
1708c2ecf20Sopenharmony_ci#define	xfs_trans_agflist_delta(tp, d)	((tp)->t_ag_flist_delta += (int64_t)d)
1718c2ecf20Sopenharmony_ci#define	xfs_trans_agbtree_delta(tp, d)	((tp)->t_ag_btree_delta += (int64_t)d)
1728c2ecf20Sopenharmony_ci#else
1738c2ecf20Sopenharmony_ci#define	xfs_trans_agblocks_delta(tp, d)
1748c2ecf20Sopenharmony_ci#define	xfs_trans_agflist_delta(tp, d)
1758c2ecf20Sopenharmony_ci#define	xfs_trans_agbtree_delta(tp, d)
1768c2ecf20Sopenharmony_ci#endif
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci/*
1798c2ecf20Sopenharmony_ci * XFS transaction mechanism exported interfaces.
1808c2ecf20Sopenharmony_ci */
1818c2ecf20Sopenharmony_ciint		xfs_trans_alloc(struct xfs_mount *mp, struct xfs_trans_res *resp,
1828c2ecf20Sopenharmony_ci			uint blocks, uint rtextents, uint flags,
1838c2ecf20Sopenharmony_ci			struct xfs_trans **tpp);
1848c2ecf20Sopenharmony_ciint		xfs_trans_alloc_empty(struct xfs_mount *mp,
1858c2ecf20Sopenharmony_ci			struct xfs_trans **tpp);
1868c2ecf20Sopenharmony_civoid		xfs_trans_mod_sb(xfs_trans_t *, uint, int64_t);
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ciint xfs_trans_get_buf_map(struct xfs_trans *tp, struct xfs_buftarg *target,
1898c2ecf20Sopenharmony_ci		struct xfs_buf_map *map, int nmaps, xfs_buf_flags_t flags,
1908c2ecf20Sopenharmony_ci		struct xfs_buf **bpp);
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_cistatic inline int
1938c2ecf20Sopenharmony_cixfs_trans_get_buf(
1948c2ecf20Sopenharmony_ci	struct xfs_trans	*tp,
1958c2ecf20Sopenharmony_ci	struct xfs_buftarg	*target,
1968c2ecf20Sopenharmony_ci	xfs_daddr_t		blkno,
1978c2ecf20Sopenharmony_ci	int			numblks,
1988c2ecf20Sopenharmony_ci	uint			flags,
1998c2ecf20Sopenharmony_ci	struct xfs_buf		**bpp)
2008c2ecf20Sopenharmony_ci{
2018c2ecf20Sopenharmony_ci	DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
2028c2ecf20Sopenharmony_ci	return xfs_trans_get_buf_map(tp, target, &map, 1, flags, bpp);
2038c2ecf20Sopenharmony_ci}
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ciint		xfs_trans_read_buf_map(struct xfs_mount *mp,
2068c2ecf20Sopenharmony_ci				       struct xfs_trans *tp,
2078c2ecf20Sopenharmony_ci				       struct xfs_buftarg *target,
2088c2ecf20Sopenharmony_ci				       struct xfs_buf_map *map, int nmaps,
2098c2ecf20Sopenharmony_ci				       xfs_buf_flags_t flags,
2108c2ecf20Sopenharmony_ci				       struct xfs_buf **bpp,
2118c2ecf20Sopenharmony_ci				       const struct xfs_buf_ops *ops);
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_cistatic inline int
2148c2ecf20Sopenharmony_cixfs_trans_read_buf(
2158c2ecf20Sopenharmony_ci	struct xfs_mount	*mp,
2168c2ecf20Sopenharmony_ci	struct xfs_trans	*tp,
2178c2ecf20Sopenharmony_ci	struct xfs_buftarg	*target,
2188c2ecf20Sopenharmony_ci	xfs_daddr_t		blkno,
2198c2ecf20Sopenharmony_ci	int			numblks,
2208c2ecf20Sopenharmony_ci	xfs_buf_flags_t		flags,
2218c2ecf20Sopenharmony_ci	struct xfs_buf		**bpp,
2228c2ecf20Sopenharmony_ci	const struct xfs_buf_ops *ops)
2238c2ecf20Sopenharmony_ci{
2248c2ecf20Sopenharmony_ci	DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
2258c2ecf20Sopenharmony_ci	return xfs_trans_read_buf_map(mp, tp, target, &map, 1,
2268c2ecf20Sopenharmony_ci				      flags, bpp, ops);
2278c2ecf20Sopenharmony_ci}
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_cistruct xfs_buf	*xfs_trans_getsb(struct xfs_trans *);
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_civoid		xfs_trans_brelse(xfs_trans_t *, struct xfs_buf *);
2328c2ecf20Sopenharmony_civoid		xfs_trans_bjoin(xfs_trans_t *, struct xfs_buf *);
2338c2ecf20Sopenharmony_civoid		xfs_trans_bhold(xfs_trans_t *, struct xfs_buf *);
2348c2ecf20Sopenharmony_civoid		xfs_trans_bhold_release(xfs_trans_t *, struct xfs_buf *);
2358c2ecf20Sopenharmony_civoid		xfs_trans_binval(xfs_trans_t *, struct xfs_buf *);
2368c2ecf20Sopenharmony_civoid		xfs_trans_inode_buf(xfs_trans_t *, struct xfs_buf *);
2378c2ecf20Sopenharmony_civoid		xfs_trans_stale_inode_buf(xfs_trans_t *, struct xfs_buf *);
2388c2ecf20Sopenharmony_cibool		xfs_trans_ordered_buf(xfs_trans_t *, struct xfs_buf *);
2398c2ecf20Sopenharmony_civoid		xfs_trans_dquot_buf(xfs_trans_t *, struct xfs_buf *, uint);
2408c2ecf20Sopenharmony_civoid		xfs_trans_inode_alloc_buf(xfs_trans_t *, struct xfs_buf *);
2418c2ecf20Sopenharmony_civoid		xfs_trans_ichgtime(struct xfs_trans *, struct xfs_inode *, int);
2428c2ecf20Sopenharmony_civoid		xfs_trans_ijoin(struct xfs_trans *, struct xfs_inode *, uint);
2438c2ecf20Sopenharmony_civoid		xfs_trans_log_buf(struct xfs_trans *, struct xfs_buf *, uint,
2448c2ecf20Sopenharmony_ci				  uint);
2458c2ecf20Sopenharmony_civoid		xfs_trans_dirty_buf(struct xfs_trans *, struct xfs_buf *);
2468c2ecf20Sopenharmony_cibool		xfs_trans_buf_is_dirty(struct xfs_buf *bp);
2478c2ecf20Sopenharmony_civoid		xfs_trans_log_inode(xfs_trans_t *, struct xfs_inode *, uint);
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ciint		xfs_trans_commit(struct xfs_trans *);
2508c2ecf20Sopenharmony_ciint		xfs_trans_roll(struct xfs_trans **);
2518c2ecf20Sopenharmony_ciint		xfs_trans_roll_inode(struct xfs_trans **, struct xfs_inode *);
2528c2ecf20Sopenharmony_civoid		xfs_trans_cancel(xfs_trans_t *);
2538c2ecf20Sopenharmony_ciint		xfs_trans_ail_init(struct xfs_mount *);
2548c2ecf20Sopenharmony_civoid		xfs_trans_ail_destroy(struct xfs_mount *);
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_civoid		xfs_trans_buf_set_type(struct xfs_trans *, struct xfs_buf *,
2578c2ecf20Sopenharmony_ci				       enum xfs_blft);
2588c2ecf20Sopenharmony_civoid		xfs_trans_buf_copy_type(struct xfs_buf *dst_bp,
2598c2ecf20Sopenharmony_ci					struct xfs_buf *src_bp);
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_ciextern kmem_zone_t	*xfs_trans_zone;
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_cistatic inline struct xfs_log_item *
2648c2ecf20Sopenharmony_cixfs_trans_item_relog(
2658c2ecf20Sopenharmony_ci	struct xfs_log_item	*lip,
2668c2ecf20Sopenharmony_ci	struct xfs_trans	*tp)
2678c2ecf20Sopenharmony_ci{
2688c2ecf20Sopenharmony_ci	return lip->li_ops->iop_relog(lip, tp);
2698c2ecf20Sopenharmony_ci}
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_cistatic inline void
2728c2ecf20Sopenharmony_cixfs_trans_set_context(
2738c2ecf20Sopenharmony_ci	struct xfs_trans	*tp)
2748c2ecf20Sopenharmony_ci{
2758c2ecf20Sopenharmony_ci	ASSERT(current->journal_info == NULL);
2768c2ecf20Sopenharmony_ci	tp->t_pflags = memalloc_nofs_save();
2778c2ecf20Sopenharmony_ci	current->journal_info = tp;
2788c2ecf20Sopenharmony_ci}
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_cistatic inline void
2818c2ecf20Sopenharmony_cixfs_trans_clear_context(
2828c2ecf20Sopenharmony_ci	struct xfs_trans	*tp)
2838c2ecf20Sopenharmony_ci{
2848c2ecf20Sopenharmony_ci	if (current->journal_info == tp) {
2858c2ecf20Sopenharmony_ci		memalloc_nofs_restore(tp->t_pflags);
2868c2ecf20Sopenharmony_ci		current->journal_info = NULL;
2878c2ecf20Sopenharmony_ci	}
2888c2ecf20Sopenharmony_ci}
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_cistatic inline void
2918c2ecf20Sopenharmony_cixfs_trans_switch_context(
2928c2ecf20Sopenharmony_ci	struct xfs_trans	*old_tp,
2938c2ecf20Sopenharmony_ci	struct xfs_trans	*new_tp)
2948c2ecf20Sopenharmony_ci{
2958c2ecf20Sopenharmony_ci	ASSERT(current->journal_info == old_tp);
2968c2ecf20Sopenharmony_ci	new_tp->t_pflags = old_tp->t_pflags;
2978c2ecf20Sopenharmony_ci	old_tp->t_pflags = 0;
2988c2ecf20Sopenharmony_ci	current->journal_info = new_tp;
2998c2ecf20Sopenharmony_ci}
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci#endif	/* __XFS_TRANS_H__ */
302