diff options
author | marcin.slusarz@gmail.com <marcin.slusarz@gmail.com> | 2008-01-30 16:03:58 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2008-04-17 08:22:28 -0400 |
commit | 1ab9278570077101d1e367399686be62b22c4019 (patch) | |
tree | 3f7f705199e3ab469a366333d6c48e8cde49e36d | |
parent | c2104fda5e6a6981e385b2d11c5c591ab06d82a2 (diff) |
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>
-rw-r--r-- | fs/udf/inode.c | 52 |
1 files changed, 23 insertions, 29 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 91d1f1d3d7a5..ddd7780d1ab1 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -1101,42 +1101,36 @@ static void __udf_read_inode(struct inode *inode) | |||
1101 | fe = (struct fileEntry *)bh->b_data; | 1101 | fe = (struct fileEntry *)bh->b_data; |
1102 | 1102 | ||
1103 | if (fe->icbTag.strategyType == cpu_to_le16(4096)) { | 1103 | if (fe->icbTag.strategyType == cpu_to_le16(4096)) { |
1104 | struct buffer_head *ibh = NULL, *nbh = NULL; | 1104 | struct buffer_head *ibh; |
1105 | struct indirectEntry *ie; | ||
1106 | 1105 | ||
1107 | ibh = udf_read_ptagged(inode->i_sb, iinfo->i_location, 1, | 1106 | ibh = udf_read_ptagged(inode->i_sb, iinfo->i_location, 1, |
1108 | &ident); | 1107 | &ident); |
1109 | if (ident == TAG_IDENT_IE) { | 1108 | if (ident == TAG_IDENT_IE && ibh) { |
1110 | if (ibh) { | 1109 | struct buffer_head *nbh = NULL; |
1111 | kernel_lb_addr loc; | 1110 | kernel_lb_addr loc; |
1112 | ie = (struct indirectEntry *)ibh->b_data; | 1111 | struct indirectEntry *ie; |
1113 | 1112 | ||
1114 | loc = lelb_to_cpu(ie->indirectICB.extLocation); | 1113 | ie = (struct indirectEntry *)ibh->b_data; |
1115 | 1114 | loc = lelb_to_cpu(ie->indirectICB.extLocation); | |
1116 | if (ie->indirectICB.extLength && | 1115 | |
1117 | (nbh = udf_read_ptagged(inode->i_sb, loc, 0, | 1116 | if (ie->indirectICB.extLength && |
1118 | &ident))) { | 1117 | (nbh = udf_read_ptagged(inode->i_sb, loc, 0, |
1119 | if (ident == TAG_IDENT_FE || | 1118 | &ident))) { |
1120 | ident == TAG_IDENT_EFE) { | 1119 | if (ident == TAG_IDENT_FE || |
1121 | memcpy(&iinfo->i_location, | 1120 | ident == TAG_IDENT_EFE) { |
1122 | &loc, | 1121 | memcpy(&iinfo->i_location, |
1123 | sizeof(kernel_lb_addr)); | 1122 | &loc, |
1124 | brelse(bh); | 1123 | sizeof(kernel_lb_addr)); |
1125 | brelse(ibh); | 1124 | brelse(bh); |
1126 | brelse(nbh); | ||
1127 | __udf_read_inode(inode); | ||
1128 | return; | ||
1129 | } else { | ||
1130 | brelse(nbh); | ||
1131 | brelse(ibh); | ||
1132 | } | ||
1133 | } else { | ||
1134 | brelse(ibh); | 1125 | brelse(ibh); |
1126 | brelse(nbh); | ||
1127 | __udf_read_inode(inode); | ||
1128 | return; | ||
1135 | } | 1129 | } |
1130 | brelse(nbh); | ||
1136 | } | 1131 | } |
1137 | } else { | ||
1138 | brelse(ibh); | ||
1139 | } | 1132 | } |
1133 | brelse(ibh); | ||
1140 | } else if (fe->icbTag.strategyType != cpu_to_le16(4)) { | 1134 | } else if (fe->icbTag.strategyType != cpu_to_le16(4)) { |
1141 | printk(KERN_ERR "udf: unsupported strategy type: %d\n", | 1135 | printk(KERN_ERR "udf: unsupported strategy type: %d\n", |
1142 | le16_to_cpu(fe->icbTag.strategyType)); | 1136 | le16_to_cpu(fe->icbTag.strategyType)); |