diff options
author | Eric Sandeen <sandeen@redhat.com> | 2017-04-19 18:19:32 -0400 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2017-04-25 12:40:41 -0400 |
commit | 4f1adf3373f072246c14119b2aa6dfb4d6510a43 (patch) | |
tree | ae53e31c5ed76baec7985095716131b45b1a722a | |
parent | 90115407c5847828d82af9bc139f690600a36219 (diff) |
xfs: more do_div cleanups
On some architectures do_div does the pointer compare
trick to make sure that we've sent it an unsigned 64-bit
number. (Why unsigned? I don't know.)
Fix up the few places that squawk about this; in
xfs_bmap_wants_extents() we just used a bare int64_t so change
that to unsigned.
In xfs_adjust_extent_unmap_boundaries() all we wanted was the
mod, and we have an xfs-specific function to handle that w/o
side effects, which includes proper casting for do_div.
In xfs_daddr_to_ag[b]no, we were using the wrong type anyway;
XFS_BB_TO_FSBT returns a block in the filesystem, so use
xfs_rfsblock_t not xfs_daddr_t, and gain the unsignedness
from that type as a bonus.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap_util.c | 5 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.h | 4 |
3 files changed, 4 insertions, 7 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 7f42f6067eb5..0fdff08145c1 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c | |||
@@ -4887,7 +4887,7 @@ xfs_bmap_del_extent_delay( | |||
4887 | ASSERT(got_endoff >= del_endoff); | 4887 | ASSERT(got_endoff >= del_endoff); |
4888 | 4888 | ||
4889 | if (isrt) { | 4889 | if (isrt) { |
4890 | int64_t rtexts = XFS_FSB_TO_B(mp, del->br_blockcount); | 4890 | uint64_t rtexts = XFS_FSB_TO_B(mp, del->br_blockcount); |
4891 | 4891 | ||
4892 | do_div(rtexts, mp->m_sb.sb_rextsize); | 4892 | do_div(rtexts, mp->m_sb.sb_rextsize); |
4893 | xfs_mod_frextents(mp, rtexts); | 4893 | xfs_mod_frextents(mp, rtexts); |
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index de94798f1c1b..7ac80a1facf2 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c | |||
@@ -1206,11 +1206,8 @@ xfs_adjust_extent_unmap_boundaries( | |||
1206 | return error; | 1206 | return error; |
1207 | 1207 | ||
1208 | if (nimap && imap.br_startblock != HOLESTARTBLOCK) { | 1208 | if (nimap && imap.br_startblock != HOLESTARTBLOCK) { |
1209 | xfs_daddr_t block; | ||
1210 | |||
1211 | ASSERT(imap.br_startblock != DELAYSTARTBLOCK); | 1209 | ASSERT(imap.br_startblock != DELAYSTARTBLOCK); |
1212 | block = imap.br_startblock; | 1210 | mod = do_mod(imap.br_startblock, mp->m_sb.sb_rextsize); |
1213 | mod = do_div(block, mp->m_sb.sb_rextsize); | ||
1214 | if (mod) | 1211 | if (mod) |
1215 | *startoffset_fsb += mp->m_sb.sb_rextsize - mod; | 1212 | *startoffset_fsb += mp->m_sb.sb_rextsize - mod; |
1216 | } | 1213 | } |
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index 22b2185e93a0..9fa312a41c93 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h | |||
@@ -313,7 +313,7 @@ void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname, | |||
313 | static inline xfs_agnumber_t | 313 | static inline xfs_agnumber_t |
314 | xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d) | 314 | xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d) |
315 | { | 315 | { |
316 | xfs_daddr_t ld = XFS_BB_TO_FSBT(mp, d); | 316 | xfs_rfsblock_t ld = XFS_BB_TO_FSBT(mp, d); |
317 | do_div(ld, mp->m_sb.sb_agblocks); | 317 | do_div(ld, mp->m_sb.sb_agblocks); |
318 | return (xfs_agnumber_t) ld; | 318 | return (xfs_agnumber_t) ld; |
319 | } | 319 | } |
@@ -321,7 +321,7 @@ xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d) | |||
321 | static inline xfs_agblock_t | 321 | static inline xfs_agblock_t |
322 | xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d) | 322 | xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d) |
323 | { | 323 | { |
324 | xfs_daddr_t ld = XFS_BB_TO_FSBT(mp, d); | 324 | xfs_rfsblock_t ld = XFS_BB_TO_FSBT(mp, d); |
325 | return (xfs_agblock_t) do_div(ld, mp->m_sb.sb_agblocks); | 325 | return (xfs_agblock_t) do_div(ld, mp->m_sb.sb_agblocks); |
326 | } | 326 | } |
327 | 327 | ||