File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5276,7 +5276,6 @@ __xfs_bunmapi(
52765276 int tmp_logflags ; /* partial logging flags */
52775277 int wasdel ; /* was a delayed alloc extent */
52785278 int whichfork ; /* data or attribute fork */
5279- xfs_fsblock_t sum ;
52805279 xfs_filblks_t len = * rlen ; /* length to unmap in file */
52815280 xfs_fileoff_t end ;
52825281 struct xfs_iext_cursor icur ;
@@ -5371,8 +5370,8 @@ __xfs_bunmapi(
53715370 if (!isrt )
53725371 goto delete ;
53735372
5374- sum = del . br_startblock + del . br_blockcount ;
5375- div_u64_rem ( sum , mp -> m_sb . sb_rextsize , & mod );
5373+ mod = xfs_rtb_to_rtxoff ( mp ,
5374+ del . br_startblock + del . br_blockcount );
53765375 if (mod ) {
53775376 /*
53785377 * Realtime extent not lined up at the end.
@@ -5419,7 +5418,8 @@ __xfs_bunmapi(
54195418 goto error0 ;
54205419 goto nodelete ;
54215420 }
5422- div_u64_rem (del .br_startblock , mp -> m_sb .sb_rextsize , & mod );
5421+
5422+ mod = xfs_rtb_to_rtxoff (mp , del .br_startblock );
54235423 if (mod ) {
54245424 xfs_extlen_t off = mp -> m_sb .sb_rextsize - mod ;
54255425
Original file line number Diff line number Diff line change @@ -1024,13 +1024,13 @@ xfs_rtfree_blocks(
10241024
10251025 ASSERT (rtlen <= XFS_MAX_BMBT_EXTLEN );
10261026
1027- len = div_u64_rem ( rtlen , mp -> m_sb . sb_rextsize , & mod );
1027+ len = xfs_rtb_to_rtxrem ( mp , rtlen , & mod );
10281028 if (mod ) {
10291029 ASSERT (mod == 0 );
10301030 return - EIO ;
10311031 }
10321032
1033- start = div_u64_rem ( rtbno , mp -> m_sb . sb_rextsize , & mod );
1033+ start = xfs_rtb_to_rtxrem ( mp , rtbno , & mod );
10341034 if (mod ) {
10351035 ASSERT (mod == 0 );
10361036 return - EIO ;
Original file line number Diff line number Diff line change @@ -39,6 +39,37 @@ xfs_extlen_to_rtxlen(
3939 return len / mp -> m_sb .sb_rextsize ;
4040}
4141
42+ /* Convert an rt block number into an rt extent number. */
43+ static inline xfs_rtxnum_t
44+ xfs_rtb_to_rtx (
45+ struct xfs_mount * mp ,
46+ xfs_rtblock_t rtbno )
47+ {
48+ return div_u64 (rtbno , mp -> m_sb .sb_rextsize );
49+ }
50+
51+ /* Return the offset of an rt block number within an rt extent. */
52+ static inline xfs_extlen_t
53+ xfs_rtb_to_rtxoff (
54+ struct xfs_mount * mp ,
55+ xfs_rtblock_t rtbno )
56+ {
57+ return do_div (rtbno , mp -> m_sb .sb_rextsize );
58+ }
59+
60+ /*
61+ * Crack an rt block number into an rt extent number and an offset within that
62+ * rt extent. Returns the rt extent number directly and the offset in @off.
63+ */
64+ static inline xfs_rtxnum_t
65+ xfs_rtb_to_rtxrem (
66+ struct xfs_mount * mp ,
67+ xfs_rtblock_t rtbno ,
68+ xfs_extlen_t * off )
69+ {
70+ return div_u64_rem (rtbno , mp -> m_sb .sb_rextsize , off );
71+ }
72+
4273/*
4374 * Functions for walking free space rtextents in the realtime bitmap.
4475 */
You can’t perform that action at this time.
0 commit comments