]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: speed up write operations by using non-overlapped lookups when possible
authorDarrick J. Wong <djwong@kernel.org>
Wed, 22 Jun 2022 19:28:52 +0000 (14:28 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 22 Jun 2022 19:28:52 +0000 (14:28 -0500)
commit927984968f158e2657d8470c7b8d074595c55f6e
tree4ead24907294b450c9783e128cd06fb8f12b3643
parent8b03b413e033c64adc7fba81a877a0d9500c5891
xfs: speed up write operations by using non-overlapped lookups when possible

Source kernel commit: 1edf8056131aca6fe7f98873da8297e6fa279d8c

Reverse mapping on a reflink-capable filesystem has some pretty high
overhead when performing file operations.  This is because the rmap
records for logically and physically adjacent extents might not be
adjacent in the rmap index due to data block sharing.  As a result, we
use expensive overlapped-interval btree search, which walks every record
that overlaps with the supplied key in the hopes of finding the record.

However, profiling data shows that when the index contains a record that
is an exact match for a query key, the non-overlapped btree search
function can find the record much faster than the overlapped version.
Try the non-overlapped lookup first when we're trying to find the left
neighbor rmap record for a given file mapping, which makes unwritten
extent conversion and remap operations run faster if data block sharing
is minimal in this part of the filesystem.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_rmap.c
libxfs/xfs_rmap.h