From: Chandan Babu R Date: Mon, 5 Apr 2021 21:58:16 +0000 (-0400) Subject: xfs: Check for extent overflow when moving extent from cow to data fork X-Git-Tag: v5.12.0-rc0~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=594b2f2868de67f450407f21300461b0eca3d515;p=thirdparty%2Fxfsprogs-dev.git xfs: Check for extent overflow when moving extent from cow to data fork Source kernel commit: 5f1d5bbfb2e674052a9fe542f53678978af20770 Moving an extent to data fork can cause a sub-interval of an existing extent to be unmapped. This will increase extent count by 1. Mapping in the new extent can increase the extent count by 1 again i.e. | Old extent | New extent | Old extent | Hence number of extents increases by 2. Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Allison Henderson Signed-off-by: Chandan Babu R Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_inode_fork.h b/libxfs/xfs_inode_fork.h index 917e289ad..c8f279edc 100644 --- a/libxfs/xfs_inode_fork.h +++ b/libxfs/xfs_inode_fork.h @@ -79,6 +79,15 @@ struct xfs_ifork { #define XFS_IEXT_WRITE_UNWRITTEN_CNT (2) +/* + * Moving an extent to data fork can cause a sub-interval of an existing extent + * to be unmapped. This will increase extent count by 1. Mapping in the new + * extent can increase the extent count by 1 again i.e. + * | Old extent | New extent | Old extent | + * Hence number of extents increases by 2. + */ +#define XFS_IEXT_REFLINK_END_COW_CNT (2) + /* * Fork handling. */