From: Chandan Babu R Date: Mon, 5 Apr 2021 21:58:16 +0000 (-0400) Subject: xfs: Check for extent overflow when writing to unwritten extent X-Git-Tag: v5.12.0-rc0~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b4024c158d4c5bf8efc1cac965783fd8444b032e;p=thirdparty%2Fxfsprogs-dev.git xfs: Check for extent overflow when writing to unwritten extent Source kernel commit: c442f3086d5a108b7ff086c8ade1923a8f389db5 A write to a sub-interval of an existing unwritten extent causes the original extent to be split into 3 extents i.e. | Unwritten | Real | Unwritten | Hence extent count can increase 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 8d89838e2..917e289ad 100644 --- a/libxfs/xfs_inode_fork.h +++ b/libxfs/xfs_inode_fork.h @@ -70,6 +70,15 @@ struct xfs_ifork { #define XFS_IEXT_ATTR_MANIP_CNT(rmt_blks) \ (XFS_DA_NODE_MAXDEPTH + max(1, rmt_blks)) +/* + * A write to a sub-interval of an existing unwritten extent causes the original + * extent to be split into 3 extents + * i.e. | Unwritten | Real | Unwritten | + * Hence extent count can increase by 2. + */ +#define XFS_IEXT_WRITE_UNWRITTEN_CNT (2) + + /* * Fork handling. */