OSDN Git Service

xfs: refactor and reuse best extent scanning logic
authorBrian Foster <bfoster@redhat.com>
Mon, 14 Oct 2019 00:10:34 +0000 (17:10 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 21 Oct 2019 16:04:58 +0000 (09:04 -0700)
commit78d7aabdeea38368dc5e0aff2d3d1c353a7ab344
tree6bcfb1000a5dcfa27478a18de329e12c55d320eb
parent4a65b7c2c72c3940a4472c49743fdb65a03a9935
xfs: refactor and reuse best extent scanning logic

The bnobt "find best" helper implements a simple btree walker
function. This general pattern, or a subset thereof, is reused in
various parts of a near mode allocation operation. For example, the
bnobt left/right scans are each iterative btree walks along with the
cntbt lastblock scan.

Rework this function into a generic btree walker, add a couple
parameters to control termination behavior from various contexts and
reuse it where applicable.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/libxfs/xfs_alloc.c