Commit 9de90b76 authored by marcin.slusarz@gmail.com's avatar marcin.slusarz@gmail.com Committed by Jan Kara

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: default avatarMarcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent c8ed837d
...@@ -223,21 +223,17 @@ void udf_truncate_extents(struct inode *inode) ...@@ -223,21 +223,17 @@ void udf_truncate_extents(struct inode *inode)
if (indirect_ext_len) { if (indirect_ext_len) {
/* We managed to free all extents in the /* We managed to free all extents in the
* indirect extent - free it too */ * indirect extent - free it too */
if (!epos.bh) BUG_ON(!epos.bh);
BUG();
udf_free_blocks(sb, inode, epos.block, udf_free_blocks(sb, inode, epos.block,
0, indirect_ext_len); 0, indirect_ext_len);
} else { } else if (!epos.bh) {
if (!epos.bh) { iinfo->i_lenAlloc = lenalloc;
iinfo->i_lenAlloc =
lenalloc;
mark_inode_dirty(inode); mark_inode_dirty(inode);
} else { } else {
struct allocExtDesc *aed = struct allocExtDesc *aed =
(struct allocExtDesc *) (struct allocExtDesc *)
(epos.bh->b_data); (epos.bh->b_data);
int len = int len = sizeof(struct allocExtDesc);
sizeof(struct allocExtDesc);
aed->lengthAllocDescs = aed->lengthAllocDescs =
cpu_to_le32(lenalloc); cpu_to_le32(lenalloc);
...@@ -251,7 +247,6 @@ void udf_truncate_extents(struct inode *inode) ...@@ -251,7 +247,6 @@ void udf_truncate_extents(struct inode *inode)
mark_buffer_dirty_inode( mark_buffer_dirty_inode(
epos.bh, inode); epos.bh, inode);
} }
}
brelse(epos.bh); brelse(epos.bh);
epos.offset = sizeof(struct allocExtDesc); epos.offset = sizeof(struct allocExtDesc);
epos.block = eloc; epos.block = eloc;
...@@ -271,12 +266,10 @@ void udf_truncate_extents(struct inode *inode) ...@@ -271,12 +266,10 @@ void udf_truncate_extents(struct inode *inode)
} }
if (indirect_ext_len) { if (indirect_ext_len) {
if (!epos.bh) BUG_ON(!epos.bh);
BUG();
udf_free_blocks(sb, inode, epos.block, 0, udf_free_blocks(sb, inode, epos.block, 0,
indirect_ext_len); indirect_ext_len);
} else { } else if (!epos.bh) {
if (!epos.bh) {
iinfo->i_lenAlloc = lenalloc; iinfo->i_lenAlloc = lenalloc;
mark_inode_dirty(inode); mark_inode_dirty(inode);
} else { } else {
...@@ -293,7 +286,6 @@ void udf_truncate_extents(struct inode *inode) ...@@ -293,7 +286,6 @@ void udf_truncate_extents(struct inode *inode)
sizeof(struct allocExtDesc)); sizeof(struct allocExtDesc));
mark_buffer_dirty_inode(epos.bh, inode); mark_buffer_dirty_inode(epos.bh, inode);
} }
}
} else if (inode->i_size) { } else if (inode->i_size) {
if (byte_offset) { if (byte_offset) {
kernel_long_ad extent; kernel_long_ad extent;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment