aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/truncate.c
diff options
context:
space:
mode:
authormarcin.slusarz@gmail.com <marcin.slusarz@gmail.com>2008-01-30 16:03:55 -0500
committerJan Kara <jack@suse.cz>2008-04-17 08:22:28 -0400
commit9de90b76eb96e7cdeac8b8dbe7d3db948b070f4d (patch)
treeea118b0f7a6c6f9104574011fb4f57fce8a8068a /fs/udf/truncate.c
parentc8ed837d371c24b678182a30e9f0b1f61dee212c (diff)
udf: simple cleanup of truncate.c
- remove one indentation level by little code reorganization - convert "if (smth) BUG();" to "BUG_ON(smth);" Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/truncate.c')
-rw-r--r--fs/udf/truncate.c76
1 files changed, 34 insertions, 42 deletions
diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c
index 6111d97902d7..cde328f16775 100644
--- a/fs/udf/truncate.c
+++ b/fs/udf/truncate.c
@@ -223,34 +223,29 @@ void udf_truncate_extents(struct inode *inode)
223 if (indirect_ext_len) { 223 if (indirect_ext_len) {
224 /* We managed to free all extents in the 224 /* We managed to free all extents in the
225 * indirect extent - free it too */ 225 * indirect extent - free it too */
226 if (!epos.bh) 226 BUG_ON(!epos.bh);
227 BUG();
228 udf_free_blocks(sb, inode, epos.block, 227 udf_free_blocks(sb, inode, epos.block,
229 0, indirect_ext_len); 228 0, indirect_ext_len);
229 } else if (!epos.bh) {
230 iinfo->i_lenAlloc = lenalloc;
231 mark_inode_dirty(inode);
230 } else { 232 } else {
231 if (!epos.bh) { 233 struct allocExtDesc *aed =
232 iinfo->i_lenAlloc = 234 (struct allocExtDesc *)
233 lenalloc; 235 (epos.bh->b_data);
234 mark_inode_dirty(inode); 236 int len = sizeof(struct allocExtDesc);
235 } else {
236 struct allocExtDesc *aed =
237 (struct allocExtDesc *)
238 (epos.bh->b_data);
239 int len =
240 sizeof(struct allocExtDesc);
241 237
242 aed->lengthAllocDescs = 238 aed->lengthAllocDescs =
243 cpu_to_le32(lenalloc); 239 cpu_to_le32(lenalloc);
244 if (!UDF_QUERY_FLAG(sb, 240 if (!UDF_QUERY_FLAG(sb,
245 UDF_FLAG_STRICT) || 241 UDF_FLAG_STRICT) ||
246 sbi->s_udfrev >= 0x0201) 242 sbi->s_udfrev >= 0x0201)
247 len += lenalloc; 243 len += lenalloc;
248 244
249 udf_update_tag(epos.bh->b_data, 245 udf_update_tag(epos.bh->b_data,
250 len); 246 len);
251 mark_buffer_dirty_inode( 247 mark_buffer_dirty_inode(
252 epos.bh, inode); 248 epos.bh, inode);
253 }
254 } 249 }
255 brelse(epos.bh); 250 brelse(epos.bh);
256 epos.offset = sizeof(struct allocExtDesc); 251 epos.offset = sizeof(struct allocExtDesc);
@@ -271,28 +266,25 @@ void udf_truncate_extents(struct inode *inode)
271 } 266 }
272 267
273 if (indirect_ext_len) { 268 if (indirect_ext_len) {
274 if (!epos.bh) 269 BUG_ON(!epos.bh);
275 BUG();
276 udf_free_blocks(sb, inode, epos.block, 0, 270 udf_free_blocks(sb, inode, epos.block, 0,
277 indirect_ext_len); 271 indirect_ext_len);
272 } else if (!epos.bh) {
273 iinfo->i_lenAlloc = lenalloc;
274 mark_inode_dirty(inode);
278 } else { 275 } else {
279 if (!epos.bh) { 276 struct allocExtDesc *aed =
280 iinfo->i_lenAlloc = lenalloc; 277 (struct allocExtDesc *)(epos.bh->b_data);
281 mark_inode_dirty(inode); 278 aed->lengthAllocDescs = cpu_to_le32(lenalloc);
282 } else { 279 if (!UDF_QUERY_FLAG(sb, UDF_FLAG_STRICT) ||
283 struct allocExtDesc *aed = 280 sbi->s_udfrev >= 0x0201)
284 (struct allocExtDesc *)(epos.bh->b_data); 281 udf_update_tag(epos.bh->b_data,
285 aed->lengthAllocDescs = cpu_to_le32(lenalloc); 282 lenalloc +
286 if (!UDF_QUERY_FLAG(sb, UDF_FLAG_STRICT) || 283 sizeof(struct allocExtDesc));
287 sbi->s_udfrev >= 0x0201) 284 else
288 udf_update_tag(epos.bh->b_data, 285 udf_update_tag(epos.bh->b_data,
289 lenalloc + 286 sizeof(struct allocExtDesc));
290 sizeof(struct allocExtDesc)); 287 mark_buffer_dirty_inode(epos.bh, inode);
291 else
292 udf_update_tag(epos.bh->b_data,
293 sizeof(struct allocExtDesc));
294 mark_buffer_dirty_inode(epos.bh, inode);
295 }
296 } 288 }
297 } else if (inode->i_size) { 289 } else if (inode->i_size) {
298 if (byte_offset) { 290 if (byte_offset) {