]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - libxfs/xfs_log_format.h
xfs: create bmbt update intent log items
[thirdparty/xfsprogs-dev.git] / libxfs / xfs_log_format.h
index 2653146904153178d474172bcacfec55e7742907..8bb250281b83755bd33cecb7a20cd9d8336ba8ab 100644 (file)
@@ -110,7 +110,13 @@ static inline uint xlog_get_cycle(char *ptr)
 #define XLOG_REG_TYPE_COMMIT           18
 #define XLOG_REG_TYPE_TRANSHDR         19
 #define XLOG_REG_TYPE_ICREATE          20
-#define XLOG_REG_TYPE_MAX              20
+#define XLOG_REG_TYPE_RUI_FORMAT       21
+#define XLOG_REG_TYPE_RUD_FORMAT       22
+#define XLOG_REG_TYPE_CUI_FORMAT       23
+#define XLOG_REG_TYPE_CUD_FORMAT       24
+#define XLOG_REG_TYPE_BUI_FORMAT       25
+#define XLOG_REG_TYPE_BUD_FORMAT       26
+#define XLOG_REG_TYPE_MAX              26
 
 /*
  * Flags to log operation header
@@ -211,6 +217,11 @@ typedef struct xfs_trans_header {
 
 #define        XFS_TRANS_HEADER_MAGIC  0x5452414e      /* TRAN */
 
+/*
+ * The only type valid for th_type in CIL-enabled file system logs:
+ */
+#define XFS_TRANS_CHECKPOINT   40
+
 /*
  * Log item types.
  */
@@ -222,6 +233,12 @@ typedef struct xfs_trans_header {
 #define        XFS_LI_DQUOT            0x123d
 #define        XFS_LI_QUOTAOFF         0x123e
 #define        XFS_LI_ICREATE          0x123f
+#define        XFS_LI_RUI              0x1240  /* rmap update intent */
+#define        XFS_LI_RUD              0x1241
+#define        XFS_LI_CUI              0x1242  /* refcount update intent */
+#define        XFS_LI_CUD              0x1243
+#define        XFS_LI_BUI              0x1244  /* bmbt update intent */
+#define        XFS_LI_BUD              0x1245
 
 #define XFS_LI_TYPE_DESC \
        { XFS_LI_EFI,           "XFS_LI_EFI" }, \
@@ -231,7 +248,13 @@ typedef struct xfs_trans_header {
        { XFS_LI_BUF,           "XFS_LI_BUF" }, \
        { XFS_LI_DQUOT,         "XFS_LI_DQUOT" }, \
        { XFS_LI_QUOTAOFF,      "XFS_LI_QUOTAOFF" }, \
-       { XFS_LI_ICREATE,       "XFS_LI_ICREATE" }
+       { XFS_LI_ICREATE,       "XFS_LI_ICREATE" }, \
+       { XFS_LI_RUI,           "XFS_LI_RUI" }, \
+       { XFS_LI_RUD,           "XFS_LI_RUD" }, \
+       { XFS_LI_CUI,           "XFS_LI_CUI" }, \
+       { XFS_LI_CUD,           "XFS_LI_CUD" }, \
+       { XFS_LI_BUI,           "XFS_LI_BUI" }, \
+       { XFS_LI_BUD,           "XFS_LI_BUD" }
 
 /*
  * Inode Log Item Format definitions.
@@ -290,6 +313,7 @@ typedef struct xfs_inode_log_format_64 {
        __int32_t               ilf_boffset;    /* off of inode in buffer */
 } xfs_inode_log_format_64_t;
 
+
 /*
  * Flags for xfs_trans_log_inode flags field.
  */
@@ -360,15 +384,15 @@ typedef struct xfs_ictimestamp {
 } xfs_ictimestamp_t;
 
 /*
- * NOTE:  This structure must be kept identical to struct xfs_dinode
- *       except for the endianness annotations.
+ * Define the format of the inode core that is logged. This structure must be
+ * kept identical to struct xfs_dinode except for the endianness annotations.
  */
-typedef struct xfs_icdinode {
+struct xfs_log_dinode {
        __uint16_t      di_magic;       /* inode magic # = XFS_DINODE_MAGIC */
        __uint16_t      di_mode;        /* mode and type of file */
        __int8_t        di_version;     /* inode version */
        __int8_t        di_format;      /* format of di_c data */
-       __uint16_t      di_onlink;      /* old number of links to file */
+       __uint8_t       di_pad3[2];     /* unused in v2/3 inodes */
        __uint32_t      di_uid;         /* owner's user id */
        __uint32_t      di_gid;         /* owner's group id */
        __uint32_t      di_nlink;       /* number of links to file */
@@ -407,13 +431,13 @@ typedef struct xfs_icdinode {
        uuid_t          di_uuid;        /* UUID of the filesystem */
 
        /* structure must be padded to 64 bit alignment */
-} xfs_icdinode_t;
+};
 
-static inline uint xfs_icdinode_size(int version)
+static inline uint xfs_log_dinode_size(int version)
 {
        if (version == 3)
-               return sizeof(struct xfs_icdinode);
-       return offsetof(struct xfs_icdinode, di_next_unlinked);
+               return sizeof(struct xfs_log_dinode);
+       return offsetof(struct xfs_log_dinode, di_next_unlinked);
 }
 
 /*
@@ -456,8 +480,8 @@ static inline uint xfs_icdinode_size(int version)
 typedef struct xfs_buf_log_format {
        unsigned short  blf_type;       /* buf log item type indicator */
        unsigned short  blf_size;       /* size of this item */
-       ushort          blf_flags;      /* misc state */
-       ushort          blf_len;        /* number of blocks in this buf */
+       unsigned short  blf_flags;      /* misc state */
+       unsigned short  blf_len;        /* number of blocks in this buf */
        __int64_t       blf_blkno;      /* starting blkno of this buf */
        unsigned int    blf_map_size;   /* used size of data bitmap in words */
        unsigned int    blf_data_map[XFS_BLF_DATAMAP_SIZE]; /* dirty bitmap */
@@ -495,6 +519,8 @@ enum xfs_blft {
        XFS_BLFT_ATTR_LEAF_BUF,
        XFS_BLFT_ATTR_RMT_BUF,
        XFS_BLFT_SB_BUF,
+       XFS_BLFT_RTBITMAP_BUF,
+       XFS_BLFT_RTSUMMARY_BUF,
        XFS_BLFT_MAX_BUF = (1 << XFS_BLFT_BITS),
 };
 
@@ -595,6 +621,163 @@ typedef struct xfs_efd_log_format_64 {
        xfs_extent_64_t         efd_extents[1]; /* array of extents freed */
 } xfs_efd_log_format_64_t;
 
+/*
+ * RUI/RUD (reverse mapping) log format definitions
+ */
+struct xfs_map_extent {
+       __uint64_t              me_owner;
+       __uint64_t              me_startblock;
+       __uint64_t              me_startoff;
+       __uint32_t              me_len;
+       __uint32_t              me_flags;
+};
+
+/* rmap me_flags: upper bits are flags, lower byte is type code */
+#define XFS_RMAP_EXTENT_MAP            1
+#define XFS_RMAP_EXTENT_UNMAP          3
+#define XFS_RMAP_EXTENT_CONVERT                5
+#define XFS_RMAP_EXTENT_ALLOC          7
+#define XFS_RMAP_EXTENT_FREE           8
+#define XFS_RMAP_EXTENT_TYPE_MASK      0xFF
+
+#define XFS_RMAP_EXTENT_ATTR_FORK      (1U << 31)
+#define XFS_RMAP_EXTENT_BMBT_BLOCK     (1U << 30)
+#define XFS_RMAP_EXTENT_UNWRITTEN      (1U << 29)
+
+#define XFS_RMAP_EXTENT_FLAGS          (XFS_RMAP_EXTENT_TYPE_MASK | \
+                                        XFS_RMAP_EXTENT_ATTR_FORK | \
+                                        XFS_RMAP_EXTENT_BMBT_BLOCK | \
+                                        XFS_RMAP_EXTENT_UNWRITTEN)
+
+/*
+ * This is the structure used to lay out an rui log item in the
+ * log.  The rui_extents field is a variable size array whose
+ * size is given by rui_nextents.
+ */
+struct xfs_rui_log_format {
+       __uint16_t              rui_type;       /* rui log item type */
+       __uint16_t              rui_size;       /* size of this item */
+       __uint32_t              rui_nextents;   /* # extents to free */
+       __uint64_t              rui_id;         /* rui identifier */
+       struct xfs_map_extent   rui_extents[];  /* array of extents to rmap */
+};
+
+static inline size_t
+xfs_rui_log_format_sizeof(
+       unsigned int            nr)
+{
+       return sizeof(struct xfs_rui_log_format) +
+                       nr * sizeof(struct xfs_map_extent);
+}
+
+/*
+ * This is the structure used to lay out an rud log item in the
+ * log.  The rud_extents array is a variable size array whose
+ * size is given by rud_nextents;
+ */
+struct xfs_rud_log_format {
+       __uint16_t              rud_type;       /* rud log item type */
+       __uint16_t              rud_size;       /* size of this item */
+       __uint32_t              __pad;
+       __uint64_t              rud_rui_id;     /* id of corresponding rui */
+};
+
+/*
+ * CUI/CUD (refcount update) log format definitions
+ */
+struct xfs_phys_extent {
+       __uint64_t              pe_startblock;
+       __uint32_t              pe_len;
+       __uint32_t              pe_flags;
+};
+
+/* refcount pe_flags: upper bits are flags, lower byte is type code */
+/* Type codes are taken directly from enum xfs_refcount_intent_type. */
+#define XFS_REFCOUNT_EXTENT_TYPE_MASK  0xFF
+
+#define XFS_REFCOUNT_EXTENT_FLAGS      (XFS_REFCOUNT_EXTENT_TYPE_MASK)
+
+/*
+ * This is the structure used to lay out a cui log item in the
+ * log.  The cui_extents field is a variable size array whose
+ * size is given by cui_nextents.
+ */
+struct xfs_cui_log_format {
+       __uint16_t              cui_type;       /* cui log item type */
+       __uint16_t              cui_size;       /* size of this item */
+       __uint32_t              cui_nextents;   /* # extents to free */
+       __uint64_t              cui_id;         /* cui identifier */
+       struct xfs_phys_extent  cui_extents[];  /* array of extents */
+};
+
+static inline size_t
+xfs_cui_log_format_sizeof(
+       unsigned int            nr)
+{
+       return sizeof(struct xfs_cui_log_format) +
+                       nr * sizeof(struct xfs_phys_extent);
+}
+
+/*
+ * This is the structure used to lay out a cud log item in the
+ * log.  The cud_extents array is a variable size array whose
+ * size is given by cud_nextents;
+ */
+struct xfs_cud_log_format {
+       __uint16_t              cud_type;       /* cud log item type */
+       __uint16_t              cud_size;       /* size of this item */
+       __uint32_t              __pad;
+       __uint64_t              cud_cui_id;     /* id of corresponding cui */
+};
+
+/*
+ * BUI/BUD (inode block mapping) log format definitions
+ */
+
+/* bmbt me_flags: upper bits are flags, lower byte is type code */
+/* Type codes are taken directly from enum xfs_bmap_intent_type. */
+#define XFS_BMAP_EXTENT_TYPE_MASK      0xFF
+
+#define XFS_BMAP_EXTENT_ATTR_FORK      (1U << 31)
+#define XFS_BMAP_EXTENT_UNWRITTEN      (1U << 30)
+
+#define XFS_BMAP_EXTENT_FLAGS          (XFS_BMAP_EXTENT_TYPE_MASK | \
+                                        XFS_BMAP_EXTENT_ATTR_FORK | \
+                                        XFS_BMAP_EXTENT_UNWRITTEN)
+
+/*
+ * This is the structure used to lay out an bui log item in the
+ * log.  The bui_extents field is a variable size array whose
+ * size is given by bui_nextents.
+ */
+struct xfs_bui_log_format {
+       __uint16_t              bui_type;       /* bui log item type */
+       __uint16_t              bui_size;       /* size of this item */
+       __uint32_t              bui_nextents;   /* # extents to free */
+       __uint64_t              bui_id;         /* bui identifier */
+       struct xfs_map_extent   bui_extents[];  /* array of extents to bmap */
+};
+
+static inline size_t
+xfs_bui_log_format_sizeof(
+       unsigned int            nr)
+{
+       return sizeof(struct xfs_bui_log_format) +
+                       nr * sizeof(struct xfs_map_extent);
+}
+
+/*
+ * This is the structure used to lay out an bud log item in the
+ * log.  The bud_extents array is a variable size array whose
+ * size is given by bud_nextents;
+ */
+struct xfs_bud_log_format {
+       __uint16_t              bud_type;       /* bud log item type */
+       __uint16_t              bud_size;       /* size of this item */
+       __uint32_t              __pad;
+       __uint64_t              bud_bui_id;     /* id of corresponding bui */
+};
+
 /*
  * Dquot Log format definitions.
  *