]> www.infradead.org Git - users/hch/xfsprogs.git/commit
xfs: simplify validation of the unwritten extent bit
authorChristoph Hellwig <hch@lst.de>
Thu, 11 May 2017 19:01:09 +0000 (14:01 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 11 May 2017 19:01:09 +0000 (14:01 -0500)
commit1f2a4478f062e2186fbd907d3ba7d20ca6625dc4
treefd31a1b881103f8ea05bc9d1027a31c86a767b42
parentc6e1bd2ab181ca3f43322008d5988c21f07a2e9c
xfs: simplify validation of the unwritten extent bit

Source kernel commit: 0c1d9e4a61590c2a4d657d1deddd1674f1565097

XFS only supports the unwritten extent bit in the data fork, and only if
the file system has a version 5 superblock or the unwritten extent
feature bit.

We currently have two routines that validate the invariant:
xfs_check_nostate_extents which return -EFSCORRUPTED when it's not met,
and xfs_validate_extent that triggers and assert in debug build.

Both of them iterate over all extents of an inode fork when called,
which isn't very efficient.

This patch instead adds a new helper that verifies the invariant one
extent at a time, and calls it from the places where we iterate over
all extents to converted them from or two the in-memory format.  The
callers then return -EFSCORRUPTED when reading invalid extents from
disk, or trigger an assert when writing them to disk.

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.c
libxfs/xfs_bmap.h
libxfs/xfs_bmap_btree.c
libxfs/xfs_bmap_btree.h
libxfs/xfs_format.h
libxfs/xfs_inode_fork.c