|
@@ -2923,7 +2923,7 @@ xfs_bmap_extsize_align(
|
|
* perform this alignment, or if a truncate shot us in the
|
|
* perform this alignment, or if a truncate shot us in the
|
|
* foot.
|
|
* foot.
|
|
*/
|
|
*/
|
|
- temp = do_mod(orig_off, extsz);
|
|
|
|
|
|
+ div_u64_rem(orig_off, extsz, &temp);
|
|
if (temp) {
|
|
if (temp) {
|
|
align_alen += temp;
|
|
align_alen += temp;
|
|
align_off -= temp;
|
|
align_off -= temp;
|
|
@@ -3497,15 +3497,17 @@ xfs_bmap_btalloc(
|
|
/* apply extent size hints if obtained earlier */
|
|
/* apply extent size hints if obtained earlier */
|
|
if (align) {
|
|
if (align) {
|
|
args.prod = align;
|
|
args.prod = align;
|
|
- if ((args.mod = (xfs_extlen_t)do_mod(ap->offset, args.prod)))
|
|
|
|
- args.mod = (xfs_extlen_t)(args.prod - args.mod);
|
|
|
|
|
|
+ div_u64_rem(ap->offset, args.prod, &args.mod);
|
|
|
|
+ if (args.mod)
|
|
|
|
+ args.mod = args.prod - args.mod;
|
|
} else if (mp->m_sb.sb_blocksize >= PAGE_SIZE) {
|
|
} else if (mp->m_sb.sb_blocksize >= PAGE_SIZE) {
|
|
args.prod = 1;
|
|
args.prod = 1;
|
|
args.mod = 0;
|
|
args.mod = 0;
|
|
} else {
|
|
} else {
|
|
args.prod = PAGE_SIZE >> mp->m_sb.sb_blocklog;
|
|
args.prod = PAGE_SIZE >> mp->m_sb.sb_blocklog;
|
|
- if ((args.mod = (xfs_extlen_t)(do_mod(ap->offset, args.prod))))
|
|
|
|
- args.mod = (xfs_extlen_t)(args.prod - args.mod);
|
|
|
|
|
|
+ div_u64_rem(ap->offset, args.prod, &args.mod);
|
|
|
|
+ if (args.mod)
|
|
|
|
+ args.mod = args.prod - args.mod;
|
|
}
|
|
}
|
|
/*
|
|
/*
|
|
* If we are not low on available data blocks, and the
|
|
* If we are not low on available data blocks, and the
|
|
@@ -4953,13 +4955,15 @@ xfs_bmap_del_extent_real(
|
|
if (whichfork == XFS_DATA_FORK && XFS_IS_REALTIME_INODE(ip)) {
|
|
if (whichfork == XFS_DATA_FORK && XFS_IS_REALTIME_INODE(ip)) {
|
|
xfs_fsblock_t bno;
|
|
xfs_fsblock_t bno;
|
|
xfs_filblks_t len;
|
|
xfs_filblks_t len;
|
|
|
|
+ xfs_extlen_t mod;
|
|
|
|
+
|
|
|
|
+ bno = div_u64_rem(del->br_startblock, mp->m_sb.sb_rextsize,
|
|
|
|
+ &mod);
|
|
|
|
+ ASSERT(mod == 0);
|
|
|
|
+ len = div_u64_rem(del->br_blockcount, mp->m_sb.sb_rextsize,
|
|
|
|
+ &mod);
|
|
|
|
+ ASSERT(mod == 0);
|
|
|
|
|
|
- ASSERT(do_mod(del->br_blockcount, mp->m_sb.sb_rextsize) == 0);
|
|
|
|
- ASSERT(do_mod(del->br_startblock, mp->m_sb.sb_rextsize) == 0);
|
|
|
|
- bno = del->br_startblock;
|
|
|
|
- len = del->br_blockcount;
|
|
|
|
- do_div(bno, mp->m_sb.sb_rextsize);
|
|
|
|
- do_div(len, mp->m_sb.sb_rextsize);
|
|
|
|
error = xfs_rtfree_extent(tp, bno, (xfs_extlen_t)len);
|
|
error = xfs_rtfree_extent(tp, bno, (xfs_extlen_t)len);
|
|
if (error)
|
|
if (error)
|
|
goto done;
|
|
goto done;
|
|
@@ -5296,9 +5300,12 @@ __xfs_bunmapi(
|
|
del.br_blockcount = max_len;
|
|
del.br_blockcount = max_len;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (!isrt)
|
|
|
|
+ goto delete;
|
|
|
|
+
|
|
sum = del.br_startblock + del.br_blockcount;
|
|
sum = del.br_startblock + del.br_blockcount;
|
|
- if (isrt &&
|
|
|
|
- (mod = do_mod(sum, mp->m_sb.sb_rextsize))) {
|
|
|
|
|
|
+ div_u64_rem(sum, mp->m_sb.sb_rextsize, &mod);
|
|
|
|
+ if (mod) {
|
|
/*
|
|
/*
|
|
* Realtime extent not lined up at the end.
|
|
* Realtime extent not lined up at the end.
|
|
* The extent could have been split into written
|
|
* The extent could have been split into written
|
|
@@ -5345,7 +5352,8 @@ __xfs_bunmapi(
|
|
goto error0;
|
|
goto error0;
|
|
goto nodelete;
|
|
goto nodelete;
|
|
}
|
|
}
|
|
- if (isrt && (mod = do_mod(del.br_startblock, mp->m_sb.sb_rextsize))) {
|
|
|
|
|
|
+ div_u64_rem(del.br_startblock, mp->m_sb.sb_rextsize, &mod);
|
|
|
|
+ if (mod) {
|
|
/*
|
|
/*
|
|
* Realtime extent is lined up at the end but not
|
|
* Realtime extent is lined up at the end but not
|
|
* at the front. We'll get rid of full extents if
|
|
* at the front. We'll get rid of full extents if
|
|
@@ -5414,6 +5422,7 @@ __xfs_bunmapi(
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+delete:
|
|
if (wasdel) {
|
|
if (wasdel) {
|
|
error = xfs_bmap_del_extent_delay(ip, whichfork, &icur,
|
|
error = xfs_bmap_del_extent_delay(ip, whichfork, &icur,
|
|
&got, &del);
|
|
&got, &del);
|