xfs: refactor the directory data block bestfree checks
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 6 Nov 2017 19:37:46 +0000 (11:37 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 9 Nov 2017 17:10:45 +0000 (09:10 -0800)
commit35ce85233412354d6737b8407738174eb251fd32
tree80a0903afd25b95c5196a5bfc4006af3c43da158
parent181fdfe662716450ce64be4134157d7152e6402e
xfs: refactor the directory data block bestfree checks

In a directory data block, the zeroth bestfree item must point to the
longest free space.  Therefore, when we check the bestfree block's
records against the data blocks, we only need to compare with bf[0] and
don't need the loop.

The weird loop was most probably the result of an earlier refactoring
gone bad.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/scrub/dir.c