summaryrefslogtreecommitdiffstats
path: root/fs/ufs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-06-18 14:28:54 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-07-06 17:39:36 -0400
commit7a4fdda72451f094374324a552be9fc7de8f3e8d (patch)
treedae8357c77edd8b00f754c6be98b4bd4f276e262 /fs/ufs
parent7bad5939fcd04bb83122bdb90981ec5ae2f90e0d (diff)
downloadlinux-stable-7a4fdda72451f094374324a552be9fc7de8f3e8d.tar.gz
linux-stable-7a4fdda72451f094374324a552be9fc7de8f3e8d.tar.bz2
linux-stable-7a4fdda72451f094374324a552be9fc7de8f3e8d.zip
__ufs_truncate(); find cutoff distances into branches by offsets[] array
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ufs')
-rw-r--r--fs/ufs/inode.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index b4d6398a2d54..c2544d62adf2 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -1324,12 +1324,16 @@ static void __ufs_truncate_blocks(struct inode *inode)
ufs_trunc_tindirect(inode, 0);
break;
case 3:
- ufs_trunc_dindirect(inode, DIRECT_BLOCK - UFS_IND_BLOCK - uspi->s_apb,
+ ufs_trunc_dindirect(inode,
+ (offsets[1] << uspi->s_apbshift) + offsets[2],
ufs_get_direct_data_ptr(uspi, ufsi, UFS_DIND_BLOCK));
ufs_trunc_tindirect(inode, 0);
break;
case 4:
- ufs_trunc_tindirect(inode, DIRECT_BLOCK - UFS_NDADDR - uspi->s_apb - uspi->s_2apb);
+ ufs_trunc_tindirect(inode,
+ (offsets[1] << uspi->s_2apbshift) +
+ (offsets[2] << uspi->s_apbshift) +
+ offsets[3]);
}
ufsi->i_lastfrag = DIRECT_FRAGMENT;
mutex_unlock(&ufsi->truncate_mutex);