]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: factor out a xfs_bmap_is_real_extent helper
authorChristoph Hellwig <hch@lst.de>
Thu, 11 May 2017 19:01:03 +0000 (14:01 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 11 May 2017 19:01:03 +0000 (14:01 -0500)
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>
libxfs/xfs_bmap.h

index cdef87db5262bdc2f43b17f5a1e76fb45a107233..a6e612cabe15892ad8555ce6e9c89b7a2ae82204 100644 (file)
@@ -171,6 +171,18 @@ static inline int xfs_bmapi_whichfork(int bmapi_flags)
        { BMAP_COWFORK,         "COW" }
 
 
+/*
+ * 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,