diff options
-rw-r--r-- | fs/ufs/inode.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 285eacd02d60..9e409c12afdf 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -1075,7 +1075,7 @@ static void ufs_trunc_branch(struct inode *inode, unsigned *offsets, int depth2, | |||
1075 | struct ufs_inode_info *ufsi = UFS_I(inode); | 1075 | struct ufs_inode_info *ufsi = UFS_I(inode); |
1076 | struct ufs_buffer_head *ubh; | 1076 | struct ufs_buffer_head *ubh; |
1077 | u64 tmp; | 1077 | u64 tmp; |
1078 | bool free_it = !offsets || !depth2; | 1078 | bool free_it = !offsets; |
1079 | unsigned from = offsets ? *offsets++ : 0; | 1079 | unsigned from = offsets ? *offsets++ : 0; |
1080 | unsigned i; | 1080 | unsigned i; |
1081 | 1081 | ||
@@ -1091,9 +1091,11 @@ static void ufs_trunc_branch(struct inode *inode, unsigned *offsets, int depth2, | |||
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | if (--depth) { | 1093 | if (--depth) { |
1094 | if (!--depth2) | ||
1095 | offsets = NULL; | ||
1094 | for (i = from ; i < uspi->s_apb ; i++, offsets = NULL) { | 1096 | for (i = from ; i < uspi->s_apb ; i++, offsets = NULL) { |
1095 | void *ind = ubh_get_data_ptr(uspi, ubh, i); | 1097 | void *ind = ubh_get_data_ptr(uspi, ubh, i); |
1096 | ufs_trunc_branch(inode, offsets, depth2 - 1, depth, ind); | 1098 | ufs_trunc_branch(inode, offsets, depth2, depth, ind); |
1097 | ubh_mark_buffer_dirty(ubh); | 1099 | ubh_mark_buffer_dirty(ubh); |
1098 | } | 1100 | } |
1099 | } else { | 1101 | } else { |
@@ -1237,7 +1239,8 @@ static void __ufs_truncate_blocks(struct inode *inode) | |||
1237 | ufs_trunc_direct(inode); | 1239 | ufs_trunc_direct(inode); |
1238 | offsets[0] = UFS_IND_BLOCK; | 1240 | offsets[0] = UFS_IND_BLOCK; |
1239 | } else { | 1241 | } else { |
1240 | ufs_trunc_branch(inode, offsets + 1, depth2, depth - 1, | 1242 | if (depth2) |
1243 | ufs_trunc_branch(inode, offsets + 1, depth2, depth - 1, | ||
1241 | ufs_get_direct_data_ptr(uspi, ufsi, offsets[0]++)); | 1244 | ufs_get_direct_data_ptr(uspi, ufsi, offsets[0]++)); |
1242 | } | 1245 | } |
1243 | for (i = offsets[0]; i <= UFS_TIND_BLOCK; i++) { | 1246 | for (i = offsets[0]; i <= UFS_TIND_BLOCK; i++) { |