]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_io: don't count fsmaps before querying fsmaps
authorDarrick J. Wong <djwong@kernel.org>
Fri, 11 Jun 2021 18:19:53 +0000 (11:19 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 28 Jul 2021 21:12:09 +0000 (14:12 -0700)
commit1dba0ffec21e2c8ba16a52fe0d69dabb4d164089
tree9db19a32b309dbf618cd7d3846296fce0b5a2044
parentfeebd734134ef18357b0281fb6e7c0a516fe13bc
xfs_io: don't count fsmaps before querying fsmaps

There's a bunch of code in fsmap.c that tries to count the GETFSMAP
records so that it can size the fsmap array appropriately for the
GETFSMAP call.  It's pointless to iterate the entire result set /twice/
(unlike the bmap command where the extent count is actually stored in
the fs metadata), so get rid of the duplicate walk.

In other words: Iterate over the records using the default chunk size
instead of doing one call to find the size and doing a giant allocation
and GETFSMAP call.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
io/fsmap.c