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>
This commit is contained in:
parent
c8ed837d37
commit
9de90b76eb
|
@ -223,34 +223,29 @@ 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 if (!epos.bh) {
|
||||||
|
iinfo->i_lenAlloc = lenalloc;
|
||||||
|
mark_inode_dirty(inode);
|
||||||
} else {
|
} else {
|
||||||
if (!epos.bh) {
|
struct allocExtDesc *aed =
|
||||||
iinfo->i_lenAlloc =
|
(struct allocExtDesc *)
|
||||||
lenalloc;
|
(epos.bh->b_data);
|
||||||
mark_inode_dirty(inode);
|
int len = sizeof(struct allocExtDesc);
|
||||||
} else {
|
|
||||||
struct allocExtDesc *aed =
|
|
||||||
(struct allocExtDesc *)
|
|
||||||
(epos.bh->b_data);
|
|
||||||
int len =
|
|
||||||
sizeof(struct allocExtDesc);
|
|
||||||
|
|
||||||
aed->lengthAllocDescs =
|
aed->lengthAllocDescs =
|
||||||
cpu_to_le32(lenalloc);
|
cpu_to_le32(lenalloc);
|
||||||
if (!UDF_QUERY_FLAG(sb,
|
if (!UDF_QUERY_FLAG(sb,
|
||||||
UDF_FLAG_STRICT) ||
|
UDF_FLAG_STRICT) ||
|
||||||
sbi->s_udfrev >= 0x0201)
|
sbi->s_udfrev >= 0x0201)
|
||||||
len += lenalloc;
|
len += lenalloc;
|
||||||
|
|
||||||
udf_update_tag(epos.bh->b_data,
|
udf_update_tag(epos.bh->b_data,
|
||||||
len);
|
len);
|
||||||
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);
|
||||||
|
@ -271,28 +266,25 @@ 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 if (!epos.bh) {
|
||||||
|
iinfo->i_lenAlloc = lenalloc;
|
||||||
|
mark_inode_dirty(inode);
|
||||||
} else {
|
} else {
|
||||||
if (!epos.bh) {
|
struct allocExtDesc *aed =
|
||||||
iinfo->i_lenAlloc = lenalloc;
|
(struct allocExtDesc *)(epos.bh->b_data);
|
||||||
mark_inode_dirty(inode);
|
aed->lengthAllocDescs = cpu_to_le32(lenalloc);
|
||||||
} else {
|
if (!UDF_QUERY_FLAG(sb, UDF_FLAG_STRICT) ||
|
||||||
struct allocExtDesc *aed =
|
sbi->s_udfrev >= 0x0201)
|
||||||
(struct allocExtDesc *)(epos.bh->b_data);
|
udf_update_tag(epos.bh->b_data,
|
||||||
aed->lengthAllocDescs = cpu_to_le32(lenalloc);
|
lenalloc +
|
||||||
if (!UDF_QUERY_FLAG(sb, UDF_FLAG_STRICT) ||
|
sizeof(struct allocExtDesc));
|
||||||
sbi->s_udfrev >= 0x0201)
|
else
|
||||||
udf_update_tag(epos.bh->b_data,
|
udf_update_tag(epos.bh->b_data,
|
||||||
lenalloc +
|
sizeof(struct allocExtDesc));
|
||||||
sizeof(struct allocExtDesc));
|
mark_buffer_dirty_inode(epos.bh, inode);
|
||||||
else
|
|
||||||
udf_update_tag(epos.bh->b_data,
|
|
||||||
sizeof(struct allocExtDesc));
|
|
||||||
mark_buffer_dirty_inode(epos.bh, inode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (inode->i_size) {
|
} else if (inode->i_size) {
|
||||||
if (byte_offset) {
|
if (byte_offset) {
|
||||||
|
|
Reference in New Issue