udf: simplify __udf_read_inode

- move all brelse(ibh) after main if, because it's called
  on every path except one where ibh is null
- move variables to the most inner blocks

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
marcin.slusarz@gmail.com 2008-01-30 22:03:58 +01:00 committed by Jan Kara
parent c2104fda5e
commit 1ab9278570

View file

@ -1101,42 +1101,36 @@ static void __udf_read_inode(struct inode *inode)
fe = (struct fileEntry *)bh->b_data; fe = (struct fileEntry *)bh->b_data;
if (fe->icbTag.strategyType == cpu_to_le16(4096)) { if (fe->icbTag.strategyType == cpu_to_le16(4096)) {
struct buffer_head *ibh = NULL, *nbh = NULL; struct buffer_head *ibh;
struct indirectEntry *ie;
ibh = udf_read_ptagged(inode->i_sb, iinfo->i_location, 1, ibh = udf_read_ptagged(inode->i_sb, iinfo->i_location, 1,
&ident); &ident);
if (ident == TAG_IDENT_IE) { if (ident == TAG_IDENT_IE && ibh) {
if (ibh) { struct buffer_head *nbh = NULL;
kernel_lb_addr loc; kernel_lb_addr loc;
ie = (struct indirectEntry *)ibh->b_data; struct indirectEntry *ie;
loc = lelb_to_cpu(ie->indirectICB.extLocation); ie = (struct indirectEntry *)ibh->b_data;
loc = lelb_to_cpu(ie->indirectICB.extLocation);
if (ie->indirectICB.extLength && if (ie->indirectICB.extLength &&
(nbh = udf_read_ptagged(inode->i_sb, loc, 0, (nbh = udf_read_ptagged(inode->i_sb, loc, 0,
&ident))) { &ident))) {
if (ident == TAG_IDENT_FE || if (ident == TAG_IDENT_FE ||
ident == TAG_IDENT_EFE) { ident == TAG_IDENT_EFE) {
memcpy(&iinfo->i_location, memcpy(&iinfo->i_location,
&loc, &loc,
sizeof(kernel_lb_addr)); sizeof(kernel_lb_addr));
brelse(bh); brelse(bh);
brelse(ibh);
brelse(nbh);
__udf_read_inode(inode);
return;
} else {
brelse(nbh);
brelse(ibh);
}
} else {
brelse(ibh); brelse(ibh);
brelse(nbh);
__udf_read_inode(inode);
return;
} }
brelse(nbh);
} }
} else {
brelse(ibh);
} }
brelse(ibh);
} else if (fe->icbTag.strategyType != cpu_to_le16(4)) { } else if (fe->icbTag.strategyType != cpu_to_le16(4)) {
printk(KERN_ERR "udf: unsupported strategy type: %d\n", printk(KERN_ERR "udf: unsupported strategy type: %d\n",
le16_to_cpu(fe->icbTag.strategyType)); le16_to_cpu(fe->icbTag.strategyType));