|
@@ -1042,44 +1042,6 @@ out_trans_cancel:
|
|
|
goto out_unlock;
|
|
|
}
|
|
|
|
|
|
-static int
|
|
|
-xfs_adjust_extent_unmap_boundaries(
|
|
|
- struct xfs_inode *ip,
|
|
|
- xfs_fileoff_t *startoffset_fsb,
|
|
|
- xfs_fileoff_t *endoffset_fsb)
|
|
|
-{
|
|
|
- struct xfs_mount *mp = ip->i_mount;
|
|
|
- struct xfs_bmbt_irec imap;
|
|
|
- int nimap, error;
|
|
|
- xfs_extlen_t mod = 0;
|
|
|
-
|
|
|
- nimap = 1;
|
|
|
- error = xfs_bmapi_read(ip, *startoffset_fsb, 1, &imap, &nimap, 0);
|
|
|
- if (error)
|
|
|
- return error;
|
|
|
-
|
|
|
- if (nimap && imap.br_startblock != HOLESTARTBLOCK) {
|
|
|
- ASSERT(imap.br_startblock != DELAYSTARTBLOCK);
|
|
|
- div_u64_rem(imap.br_startblock, mp->m_sb.sb_rextsize, &mod);
|
|
|
- if (mod)
|
|
|
- *startoffset_fsb += mp->m_sb.sb_rextsize - mod;
|
|
|
- }
|
|
|
-
|
|
|
- nimap = 1;
|
|
|
- error = xfs_bmapi_read(ip, *endoffset_fsb - 1, 1, &imap, &nimap, 0);
|
|
|
- if (error)
|
|
|
- return error;
|
|
|
-
|
|
|
- if (nimap && imap.br_startblock != HOLESTARTBLOCK) {
|
|
|
- ASSERT(imap.br_startblock != DELAYSTARTBLOCK);
|
|
|
- mod++;
|
|
|
- if (mod && mod != mp->m_sb.sb_rextsize)
|
|
|
- *endoffset_fsb -= mod;
|
|
|
- }
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
static int
|
|
|
xfs_flush_unmap_range(
|
|
|
struct xfs_inode *ip,
|
|
@@ -1133,19 +1095,8 @@ xfs_free_file_space(
|
|
|
endoffset_fsb = XFS_B_TO_FSBT(mp, offset + len);
|
|
|
|
|
|
/*
|
|
|
- * Need to zero the stuff we're not freeing, on disk. If it's a RT file
|
|
|
- * and we can't use unwritten extents then we actually need to ensure
|
|
|
- * to zero the whole extent, otherwise we just need to take of block
|
|
|
- * boundaries, and xfs_bunmapi will handle the rest.
|
|
|
+ * Need to zero the stuff we're not freeing, on disk.
|
|
|
*/
|
|
|
- if (XFS_IS_REALTIME_INODE(ip) &&
|
|
|
- !xfs_sb_version_hasextflgbit(&mp->m_sb)) {
|
|
|
- error = xfs_adjust_extent_unmap_boundaries(ip, &startoffset_fsb,
|
|
|
- &endoffset_fsb);
|
|
|
- if (error)
|
|
|
- return error;
|
|
|
- }
|
|
|
-
|
|
|
if (endoffset_fsb > startoffset_fsb) {
|
|
|
while (!done) {
|
|
|
error = xfs_unmap_extent(ip, startoffset_fsb,
|