xfs: fix logdev fsmap query result filtering
authorDarrick J. Wong <djwong@kernel.org>
Fri, 30 Jun 2023 00:39:45 +0000 (17:39 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Sun, 2 Jul 2023 16:26:19 +0000 (09:26 -0700)
commita949a1c2a198e048630a8b0741a99b85a5d88136
tree335dd8a637658f801d48a7078a13431b078f9a1c
parentf045dd00328d78f25d64913285f4547f772d13e2
xfs: fix logdev fsmap query result filtering

The external log device fsmap backend doesn't have an rmapbt to query,
so it's wasteful to spend time initializing the rmap_irec objects.
Worse yet, the log could (someday) be longer than 2^32 fsblocks, so
using the rmap irec structure will result in integer overflows.

Fix this mess by computing the start address that we want from keys[0]
directly, and use the daddr-based record filtering algorithm that we
also use for rtbitmap queries.

Fixes: e89c041338ed ("xfs: implement the GETFSMAP ioctl")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/xfs_fsmap.c