Skip to content

Commit d6d5c90

Browse files
Christoph HellwigDarrick J. Wong
authored andcommitted
xfs: cleanup xfs_getfsmap_rtdev_rtbitmap
Use mp->m_sb.sb_rblocks to calculate the end instead of sb_rextents that needs a conversion, use consistent names to xfs_rtblock_t types, and only calculated them by the time they are needed. Remove the pointless "high" local variable that only has a single user. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 9154b50 commit d6d5c90

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

fs/xfs/xfs_fsmap.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -754,40 +754,39 @@ xfs_getfsmap_rtdev_rtbitmap(
754754

755755
struct xfs_rtalloc_rec ahigh = { 0 };
756756
struct xfs_mount *mp = tp->t_mountp;
757-
xfs_rtblock_t start_rtb;
758-
xfs_rtblock_t end_rtb;
759-
xfs_rtxnum_t high;
757+
xfs_rtblock_t start_rtbno, end_rtbno;
760758
uint64_t eofs;
761759
int error;
762760

763-
eofs = XFS_FSB_TO_BB(mp, xfs_rtx_to_rtb(mp, mp->m_sb.sb_rextents));
761+
eofs = XFS_FSB_TO_BB(mp, mp->m_sb.sb_rblocks);
764762
if (keys[0].fmr_physical >= eofs)
765763
return 0;
766-
start_rtb = XFS_BB_TO_FSBT(mp,
767-
keys[0].fmr_physical + keys[0].fmr_length);
768-
end_rtb = XFS_BB_TO_FSB(mp, min(eofs - 1, keys[1].fmr_physical));
769764

770765
info->missing_owner = XFS_FMR_OWN_UNKNOWN;
771766

772767
/* Adjust the low key if we are continuing from where we left off. */
768+
start_rtbno = xfs_daddr_to_rtb(mp,
769+
keys[0].fmr_physical + keys[0].fmr_length);
773770
if (keys[0].fmr_length > 0) {
774-
info->low_daddr = xfs_rtb_to_daddr(mp, start_rtb);
771+
info->low_daddr = xfs_rtb_to_daddr(mp, start_rtbno);
775772
if (info->low_daddr >= eofs)
776773
return 0;
777774
}
778775

779-
trace_xfs_fsmap_low_linear_key(mp, info->dev, start_rtb);
780-
trace_xfs_fsmap_high_linear_key(mp, info->dev, end_rtb);
776+
end_rtbno = xfs_daddr_to_rtb(mp, min(eofs - 1, keys[1].fmr_physical));
777+
778+
trace_xfs_fsmap_low_linear_key(mp, info->dev, start_rtbno);
779+
trace_xfs_fsmap_high_linear_key(mp, info->dev, end_rtbno);
781780

782781
xfs_rtbitmap_lock_shared(mp, XFS_RBMLOCK_BITMAP);
783782

784783
/*
785784
* Set up query parameters to return free rtextents covering the range
786785
* we want.
787786
*/
788-
high = xfs_rtb_to_rtxup(mp, end_rtb);
789-
error = xfs_rtalloc_query_range(mp, tp, xfs_rtb_to_rtx(mp, start_rtb),
790-
high, xfs_getfsmap_rtdev_rtbitmap_helper, info);
787+
error = xfs_rtalloc_query_range(mp, tp, xfs_rtb_to_rtx(mp, start_rtbno),
788+
xfs_rtb_to_rtxup(mp, end_rtbno),
789+
xfs_getfsmap_rtdev_rtbitmap_helper, info);
791790
if (error)
792791
goto err;
793792

0 commit comments

Comments
 (0)