]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - include/xfs_trans.h
xfs_scrub: include unicrash.h in unicrash.c
[thirdparty/xfsprogs-dev.git] / include / xfs_trans.h
index 9180575403a804630a8b622193f5e9e244fd2013..e6bb74c481ca915bc98f2f6c7fb7e2222eb3f982 100644 (file)
@@ -1,19 +1,7 @@
+// 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__
@@ -29,19 +17,22 @@ struct xfs_buf_map;
  */
 
 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 */
        unsigned short          ili_flags;              /* misc flags */
+       unsigned short          ili_lock_flags;         /* lock flags */
        unsigned int            ili_fields;             /* fields to be logged */
        unsigned int            ili_last_fields;        /* fields when flushed*/
-       xfs_inode_log_format_t  ili_format;             /* logged structure */
 } xfs_inode_log_item_t;
 
 typedef struct xfs_buf_log_item {
@@ -70,42 +61,57 @@ typedef struct xfs_qoff_logitem {
        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 */
+
 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 list_head        t_dfops;        /* deferred operations */
 } xfs_trans_t;
 
 void   xfs_trans_init(struct xfs_mount *);
-int    xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
-
-xfs_trans_t    *libxfs_trans_alloc(struct xfs_mount *, int);
-int    libxfs_trans_reserve(struct xfs_trans *, struct xfs_trans_res *,
-                                    uint, uint);
-int    libxfs_trans_commit(struct xfs_trans *, uint);
+int    xfs_trans_roll(struct xfs_trans **);
+
+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,
-                               uint, uint, struct xfs_inode **);
 void   libxfs_trans_ijoin(struct xfs_trans *, struct xfs_inode *, uint);
 void   libxfs_trans_ijoin_ref(struct xfs_trans *, struct xfs_inode *, int);
 void   libxfs_trans_log_inode (struct xfs_trans *, struct xfs_inode *,
                                uint);
+int    libxfs_trans_roll_inode (struct xfs_trans **, struct xfs_inode *);
 
 void   libxfs_trans_brelse(struct xfs_trans *, struct xfs_buf *);
 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 *);
 
 struct xfs_buf *libxfs_trans_get_buf_map(struct xfs_trans *tp,
                                        struct xfs_buftarg *btp,