+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
* All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __XFS_TRANS_H__
*/
typedef struct xfs_log_item {
- struct xfs_log_item_desc *li_desc; /* ptr to current desc*/
+ struct list_head li_trans; /* transaction list */
+ xfs_lsn_t li_lsn; /* last on-disk lsn */
struct xfs_mount *li_mountp; /* ptr to fs mount */
uint li_type; /* item type */
- xfs_lsn_t li_lsn;
+ unsigned long li_flags; /* misc flags */
} xfs_log_item_t;
+#define XFS_LI_DIRTY 3 /* log item dirty in transaction */
+
typedef struct xfs_inode_log_item {
xfs_log_item_t ili_item; /* common portion */
struct xfs_inode *ili_inode; /* inode pointer */
xfs_qoff_logformat_t qql_format; /* logged structure */
} xfs_qoff_logitem_t;
+#define XFS_DEFER_OPS_NR_INODES 2 /* join up to two inodes */
+#define XFS_DEFER_OPS_NR_BUFS 2 /* join up to two buffers */
+
+struct xfs_defer_ops {
+ struct list_head dop_intake; /* unlogged pending work */
+ struct list_head dop_pending; /* logged pending work */
+
+ /* relog these with each roll */
+ struct xfs_inode *dop_inodes[XFS_DEFER_OPS_NR_INODES];
+};
+
typedef struct xfs_trans {
unsigned int t_type; /* transaction type */
unsigned int t_log_res; /* amt of log space resvd */
unsigned int t_log_count; /* count for perm log res */
unsigned int t_blk_res; /* # of blocks resvd */
+ xfs_fsblock_t t_firstblock; /* first block allocated */
struct xfs_mount *t_mountp; /* ptr to fs mount struct */
+ unsigned int t_blk_res_used; /* # of resvd blocks used */
unsigned int t_flags; /* misc flags */
long t_icount_delta; /* superblock icount change */
long t_ifree_delta; /* superblock ifree change */
long t_fdblocks_delta; /* superblock fdblocks chg */
long t_frextents_delta; /* superblock freextents chg */
struct list_head t_items; /* first log item desc chunk */
+ struct xfs_defer_ops *t_dfops; /* deferred operations */
+ struct xfs_defer_ops t_dfops_internal;
+
} xfs_trans_t;
void xfs_trans_init(struct xfs_mount *);
int libxfs_trans_alloc(struct xfs_mount *mp, struct xfs_trans_res *resp,
uint blocks, uint rtextents, uint flags,
struct xfs_trans **tpp);
+int libxfs_trans_alloc_rollable(struct xfs_mount *mp, uint blocks,
+ struct xfs_trans **tpp);
int libxfs_trans_alloc_empty(struct xfs_mount *mp, struct xfs_trans **tpp);
int libxfs_trans_commit(struct xfs_trans *);
void libxfs_trans_cancel(struct xfs_trans *);
+
+/* cancel dfops associated with a transaction */
+void xfs_defer_cancel(struct xfs_trans *);
+
struct xfs_buf *libxfs_trans_getsb(struct xfs_trans *, struct xfs_mount *, int);
int libxfs_trans_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
void libxfs_trans_binval(struct xfs_trans *, struct xfs_buf *);
void libxfs_trans_bjoin(struct xfs_trans *, struct xfs_buf *);
void libxfs_trans_bhold(struct xfs_trans *, struct xfs_buf *);
+void libxfs_trans_dirty_buf(struct xfs_trans *, struct xfs_buf *);
void libxfs_trans_log_buf(struct xfs_trans *, struct xfs_buf *,
uint, uint);
bool libxfs_trans_ordered_buf(xfs_trans_t *, struct xfs_buf *);