]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: Check for extent overflow when writing to unwritten extent
authorChandan Babu R <chandanrlinux@gmail.com>
Mon, 5 Apr 2021 21:58:16 +0000 (17:58 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Mon, 5 Apr 2021 21:58:16 +0000 (17:58 -0400)
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 <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_inode_fork.h

index 8d89838e23f800a90c6df435eed82e947e48da20..917e289ad9623c5b5256663980f3c85adaef24eb 100644 (file)
@@ -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.
  */