^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #ifndef __XFS_TRANS_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define __XFS_TRANS_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) /* kernel only transaction subsystem defines */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct xfs_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) struct xfs_buftarg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct xfs_efd_log_item;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct xfs_efi_log_item;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct xfs_inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct xfs_item_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct xfs_log_iovec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) struct xfs_mount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) struct xfs_trans;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct xfs_trans_res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) struct xfs_dquot_acct;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct xfs_rud_log_item;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct xfs_rui_log_item;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct xfs_btree_cur;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct xfs_cui_log_item;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct xfs_cud_log_item;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct xfs_bui_log_item;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct xfs_bud_log_item;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct xfs_log_item {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct list_head li_ail; /* AIL pointers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct list_head li_trans; /* transaction list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) xfs_lsn_t li_lsn; /* last on-disk lsn */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) struct xfs_mount *li_mountp; /* ptr to fs mount */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct xfs_ail *li_ailp; /* ptr to AIL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) uint li_type; /* item type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) unsigned long li_flags; /* misc flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) struct xfs_buf *li_buf; /* real buffer pointer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct list_head li_bio_list; /* buffer item list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) const struct xfs_item_ops *li_ops; /* function list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) /* delayed logging */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct list_head li_cil; /* CIL pointers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct xfs_log_vec *li_lv; /* active log vector */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct xfs_log_vec *li_lv_shadow; /* standby vector */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) xfs_lsn_t li_seq; /* CIL commit seq */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) * li_flags use the (set/test/clear)_bit atomic interfaces because updates can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * race with each other and we don't want to have to use the AIL lock to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) * serialise all updates.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #define XFS_LI_IN_AIL 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #define XFS_LI_ABORTED 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #define XFS_LI_FAILED 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #define XFS_LI_DIRTY 3 /* log item dirty in transaction */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #define XFS_LI_FLAGS \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) { (1 << XFS_LI_IN_AIL), "IN_AIL" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) { (1 << XFS_LI_ABORTED), "ABORTED" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) { (1 << XFS_LI_FAILED), "FAILED" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) { (1 << XFS_LI_DIRTY), "DIRTY" }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) struct xfs_item_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) unsigned flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) void (*iop_size)(struct xfs_log_item *, int *, int *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) void (*iop_format)(struct xfs_log_item *, struct xfs_log_vec *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) void (*iop_pin)(struct xfs_log_item *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) void (*iop_unpin)(struct xfs_log_item *, int remove);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) uint (*iop_push)(struct xfs_log_item *, struct list_head *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) void (*iop_committing)(struct xfs_log_item *, xfs_lsn_t commit_lsn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) void (*iop_release)(struct xfs_log_item *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) xfs_lsn_t (*iop_committed)(struct xfs_log_item *, xfs_lsn_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) int (*iop_recover)(struct xfs_log_item *lip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) struct list_head *capture_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) bool (*iop_match)(struct xfs_log_item *item, uint64_t id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) struct xfs_log_item *(*iop_relog)(struct xfs_log_item *intent,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) struct xfs_trans *tp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) /* Is this log item a deferred action intent? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) static inline bool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) xlog_item_is_intent(struct xfs_log_item *lip)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) return lip->li_ops->iop_recover != NULL &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) lip->li_ops->iop_match != NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) /* Is this a log intent-done item? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) static inline bool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) xlog_item_is_intent_done(struct xfs_log_item *lip)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) return lip->li_ops->iop_unpin == NULL &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) lip->li_ops->iop_push == NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) * Release the log item as soon as committed. This is for items just logging
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * intents that never need to be written back in place.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #define XFS_ITEM_RELEASE_WHEN_COMMITTED (1 << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) void xfs_log_item_init(struct xfs_mount *mp, struct xfs_log_item *item,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) int type, const struct xfs_item_ops *ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) * Return values for the iop_push() routines.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) #define XFS_ITEM_SUCCESS 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) #define XFS_ITEM_PINNED 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #define XFS_ITEM_LOCKED 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #define XFS_ITEM_FLUSHING 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) * Deferred operation item relogging limits.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) #define XFS_DEFER_OPS_NR_INODES 2 /* join up to two inodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #define XFS_DEFER_OPS_NR_BUFS 2 /* join up to two buffers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) * This is the structure maintained for every active transaction.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) typedef struct xfs_trans {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) unsigned int t_magic; /* magic number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) unsigned int t_log_res; /* amt of log space resvd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) unsigned int t_log_count; /* count for perm log res */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) unsigned int t_blk_res; /* # of blocks resvd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) unsigned int t_blk_res_used; /* # of resvd blocks used */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) unsigned int t_rtx_res; /* # of rt extents resvd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) unsigned int t_rtx_res_used; /* # of resvd rt extents used */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) unsigned int t_flags; /* misc flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) xfs_fsblock_t t_firstblock; /* first block allocated */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) struct xlog_ticket *t_ticket; /* log mgr ticket */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) struct xfs_mount *t_mountp; /* ptr to fs mount struct */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) struct xfs_dquot_acct *t_dqinfo; /* acctg info for dquots */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) int64_t t_icount_delta; /* superblock icount change */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) int64_t t_ifree_delta; /* superblock ifree change */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) int64_t t_fdblocks_delta; /* superblock fdblocks chg */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) int64_t t_res_fdblocks_delta; /* on-disk only chg */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) int64_t t_frextents_delta;/* superblock freextents chg*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) int64_t t_res_frextents_delta; /* on-disk only chg */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) #if defined(DEBUG) || defined(XFS_WARN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) int64_t t_ag_freeblks_delta; /* debugging counter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) int64_t t_ag_flist_delta; /* debugging counter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) int64_t t_ag_btree_delta; /* debugging counter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) int64_t t_dblocks_delta;/* superblock dblocks change */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) int64_t t_agcount_delta;/* superblock agcount change */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) int64_t t_imaxpct_delta;/* superblock imaxpct change */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) int64_t t_rextsize_delta;/* superblock rextsize chg */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) int64_t t_rbmblocks_delta;/* superblock rbmblocks chg */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) int64_t t_rblocks_delta;/* superblock rblocks change */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) int64_t t_rextents_delta;/* superblocks rextents chg */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) int64_t t_rextslog_delta;/* superblocks rextslog chg */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) struct list_head t_items; /* log item descriptors */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) struct list_head t_busy; /* list of busy extents */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) struct list_head t_dfops; /* deferred operations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) unsigned long t_pflags; /* saved process flags state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) } xfs_trans_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) * XFS transaction mechanism exported interfaces that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) * actually macros.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) #define xfs_trans_set_sync(tp) ((tp)->t_flags |= XFS_TRANS_SYNC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) #if defined(DEBUG) || defined(XFS_WARN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) #define xfs_trans_agblocks_delta(tp, d) ((tp)->t_ag_freeblks_delta += (int64_t)d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) #define xfs_trans_agflist_delta(tp, d) ((tp)->t_ag_flist_delta += (int64_t)d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) #define xfs_trans_agbtree_delta(tp, d) ((tp)->t_ag_btree_delta += (int64_t)d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) #define xfs_trans_agblocks_delta(tp, d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) #define xfs_trans_agflist_delta(tp, d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) #define xfs_trans_agbtree_delta(tp, d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) * XFS transaction mechanism exported interfaces.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) int xfs_trans_alloc(struct xfs_mount *mp, struct xfs_trans_res *resp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) uint blocks, uint rtextents, uint flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) struct xfs_trans **tpp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) int xfs_trans_alloc_empty(struct xfs_mount *mp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) struct xfs_trans **tpp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) void xfs_trans_mod_sb(xfs_trans_t *, uint, int64_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) int xfs_trans_get_buf_map(struct xfs_trans *tp, struct xfs_buftarg *target,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) struct xfs_buf_map *map, int nmaps, xfs_buf_flags_t flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) struct xfs_buf **bpp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) xfs_trans_get_buf(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) struct xfs_trans *tp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) struct xfs_buftarg *target,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) xfs_daddr_t blkno,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) int numblks,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) uint flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) struct xfs_buf **bpp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) return xfs_trans_get_buf_map(tp, target, &map, 1, flags, bpp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) int xfs_trans_read_buf_map(struct xfs_mount *mp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) struct xfs_trans *tp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) struct xfs_buftarg *target,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) struct xfs_buf_map *map, int nmaps,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) xfs_buf_flags_t flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) struct xfs_buf **bpp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) const struct xfs_buf_ops *ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) xfs_trans_read_buf(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) struct xfs_mount *mp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) struct xfs_trans *tp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) struct xfs_buftarg *target,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) xfs_daddr_t blkno,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) int numblks,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) xfs_buf_flags_t flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) struct xfs_buf **bpp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) const struct xfs_buf_ops *ops)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) return xfs_trans_read_buf_map(mp, tp, target, &map, 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) flags, bpp, ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) struct xfs_buf *xfs_trans_getsb(struct xfs_trans *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) void xfs_trans_brelse(xfs_trans_t *, struct xfs_buf *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) void xfs_trans_bjoin(xfs_trans_t *, struct xfs_buf *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) void xfs_trans_bhold(xfs_trans_t *, struct xfs_buf *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) void xfs_trans_bhold_release(xfs_trans_t *, struct xfs_buf *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) void xfs_trans_binval(xfs_trans_t *, struct xfs_buf *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) void xfs_trans_inode_buf(xfs_trans_t *, struct xfs_buf *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) void xfs_trans_stale_inode_buf(xfs_trans_t *, struct xfs_buf *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) bool xfs_trans_ordered_buf(xfs_trans_t *, struct xfs_buf *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) void xfs_trans_dquot_buf(xfs_trans_t *, struct xfs_buf *, uint);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) void xfs_trans_inode_alloc_buf(xfs_trans_t *, struct xfs_buf *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) void xfs_trans_ichgtime(struct xfs_trans *, struct xfs_inode *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) void xfs_trans_ijoin(struct xfs_trans *, struct xfs_inode *, uint);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) void xfs_trans_log_buf(struct xfs_trans *, struct xfs_buf *, uint,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) uint);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) void xfs_trans_dirty_buf(struct xfs_trans *, struct xfs_buf *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) bool xfs_trans_buf_is_dirty(struct xfs_buf *bp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) void xfs_trans_log_inode(xfs_trans_t *, struct xfs_inode *, uint);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) int xfs_trans_commit(struct xfs_trans *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) int xfs_trans_roll(struct xfs_trans **);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) int xfs_trans_roll_inode(struct xfs_trans **, struct xfs_inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) void xfs_trans_cancel(xfs_trans_t *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) int xfs_trans_ail_init(struct xfs_mount *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) void xfs_trans_ail_destroy(struct xfs_mount *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) void xfs_trans_buf_set_type(struct xfs_trans *, struct xfs_buf *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) enum xfs_blft);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) void xfs_trans_buf_copy_type(struct xfs_buf *dst_bp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) struct xfs_buf *src_bp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) extern kmem_zone_t *xfs_trans_zone;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) static inline struct xfs_log_item *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) xfs_trans_item_relog(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) struct xfs_log_item *lip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) struct xfs_trans *tp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) return lip->li_ops->iop_relog(lip, tp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) #endif /* __XFS_TRANS_H__ */