]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: introduce a file mapping exchange log intent item
authorDarrick J. Wong <djwong@kernel.org>
Mon, 29 Jul 2024 23:22:35 +0000 (16:22 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:00:59 +0000 (17:00 -0700)
Source kernel commit: 6c08f434bd33f88cf169e9e43c7a5e42fb3f2118

Introduce a new intent log item to handle exchanging mappings between
the forks of two files.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_log_format.h

index 16872972e1e97dcd2b8c5a8974a1ed9c64175bde..09024431cae9aac341073b7b9890609103a66cf2 100644 (file)
@@ -117,8 +117,9 @@ struct xfs_unmount_log_format {
 #define XLOG_REG_TYPE_ATTRD_FORMAT     28
 #define XLOG_REG_TYPE_ATTR_NAME        29
 #define XLOG_REG_TYPE_ATTR_VALUE       30
-#define XLOG_REG_TYPE_MAX              30
-
+#define XLOG_REG_TYPE_XMI_FORMAT       31
+#define XLOG_REG_TYPE_XMD_FORMAT       32
+#define XLOG_REG_TYPE_MAX              32
 
 /*
  * Flags to log operation header
@@ -243,6 +244,8 @@ typedef struct xfs_trans_header {
 #define        XFS_LI_BUD              0x1245
 #define        XFS_LI_ATTRI            0x1246  /* attr set/remove intent*/
 #define        XFS_LI_ATTRD            0x1247  /* attr set/remove done */
+#define        XFS_LI_XMI              0x1248  /* mapping exchange intent */
+#define        XFS_LI_XMD              0x1249  /* mapping exchange done */
 
 #define XFS_LI_TYPE_DESC \
        { XFS_LI_EFI,           "XFS_LI_EFI" }, \
@@ -260,7 +263,9 @@ typedef struct xfs_trans_header {
        { XFS_LI_BUI,           "XFS_LI_BUI" }, \
        { XFS_LI_BUD,           "XFS_LI_BUD" }, \
        { XFS_LI_ATTRI,         "XFS_LI_ATTRI" }, \
-       { XFS_LI_ATTRD,         "XFS_LI_ATTRD" }
+       { XFS_LI_ATTRD,         "XFS_LI_ATTRD" }, \
+       { XFS_LI_XMI,           "XFS_LI_XMI" }, \
+       { XFS_LI_XMD,           "XFS_LI_XMD" }
 
 /*
  * Inode Log Item Format definitions.
@@ -878,6 +883,37 @@ struct xfs_bud_log_format {
        uint64_t                bud_bui_id;     /* id of corresponding bui */
 };
 
+/*
+ * XMI/XMD (file mapping exchange) log format definitions
+ */
+
+/* This is the structure used to lay out an mapping exchange log item. */
+struct xfs_xmi_log_format {
+       uint16_t                xmi_type;       /* xmi log item type */
+       uint16_t                xmi_size;       /* size of this item */
+       uint32_t                __pad;          /* must be zero */
+       uint64_t                xmi_id;         /* xmi identifier */
+
+       uint64_t                xmi_inode1;     /* inumber of first file */
+       uint64_t                xmi_inode2;     /* inumber of second file */
+       uint64_t                xmi_startoff1;  /* block offset into file1 */
+       uint64_t                xmi_startoff2;  /* block offset into file2 */
+       uint64_t                xmi_blockcount; /* number of blocks */
+       uint64_t                xmi_flags;      /* XFS_EXCHMAPS_* */
+       uint64_t                xmi_isize1;     /* intended file1 size */
+       uint64_t                xmi_isize2;     /* intended file2 size */
+};
+
+#define XFS_EXCHMAPS_LOGGED_FLAGS              (0)
+
+/* This is the structure used to lay out an mapping exchange done log item. */
+struct xfs_xmd_log_format {
+       uint16_t                xmd_type;       /* xmd log item type */
+       uint16_t                xmd_size;       /* size of this item */
+       uint32_t                __pad;
+       uint64_t                xmd_xmi_id;     /* id of corresponding xmi */
+};
+
 /*
  * Dquot Log format definitions.
  *