]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_io: don't count fsmaps before querying fsmaps
authorDarrick J. Wong <djwong@kernel.org>
Wed, 28 Jul 2021 23:01:23 +0000 (19:01 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 28 Jul 2021 23:01:23 +0000 (19:01 -0400)
commit5c0da2c0f8fc4683c3f31d8c1587803bc5ab9138
tree66f476361c39310af2d450d6f4bd1334e8c75f97
parente264ca71e218fd17ce384bd21d81d1dd10172d39
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>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
io/fsmap.c