aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-05-11 14:01:03 -0500
committerEric Sandeen <sandeen@redhat.com>2017-05-11 14:01:03 -0500
commitcd83dc79b719bcb4309c7645744a217b73adad32 (patch)
tree19d41e41e481db151c47e87a8d85032b43f68d5d
parente116c5c4511bbc2d98579817232258d57a1f1777 (diff)
downloadxfsprogs-dev-cd83dc79b719bcb4309c7645744a217b73adad32.tar.gz
xfs: factor out a xfs_bmap_is_real_extent helper
Source kernel commit: 9c4f29d39168bb9363189f0d54ee1202372e7d9b This checks for all the non-normal extent types, including handling both encodings of delayed allocations. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r--libxfs/xfs_bmap.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/libxfs/xfs_bmap.h b/libxfs/xfs_bmap.h
index cdef87db52..a6e612cabe 100644
--- a/libxfs/xfs_bmap.h
+++ b/libxfs/xfs_bmap.h
@@ -172,6 +172,18 @@ static inline int xfs_bmapi_whichfork(int bmapi_flags)
/*
+ * Return true if the extent is a real, allocated extent, or false if it is a
+ * delayed allocation, and unwritten extent or a hole.
+ */
+static inline bool xfs_bmap_is_real_extent(struct xfs_bmbt_irec *irec)
+{
+ return irec->br_state != XFS_EXT_UNWRITTEN &&
+ irec->br_startblock != HOLESTARTBLOCK &&
+ irec->br_startblock != DELAYSTARTBLOCK &&
+ !isnullstartblock(irec->br_startblock);
+}
+
+/*
* This macro is used to determine how many extents will be shifted
* in one write transaction. We could require two splits,
* an extent move on the first and an extent merge on the second,