udf: simplify __udf_read_inode
authormarcin.slusarz@gmail.com <marcin.slusarz@gmail.com>
Wed, 30 Jan 2008 21:03:58 +0000 (22:03 +0100)
committerJan Kara <jack@suse.cz>
Thu, 17 Apr 2008 12:22:28 +0000 (14:22 +0200)
- 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>
fs/udf/inode.c

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