cleanup: rewrite new_dentry_private data more simply
authorErez_Zadok <ezk@cs.sunysb.edu>
Sun, 10 Jun 2007 21:45:53 +0000 (17:45 -0400)
committerRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Thu, 1 May 2008 23:02:52 +0000 (19:02 -0400)
Also remove unnecessary variables and statements.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Conflicts:

fs/unionfs/lookup.c

fs/unionfs/lookup.c

index 886f050237c311e9cb27eba0e6fdfed4f05e7e49..43bf5104b86871ab30edd11258a404fbfc684ff7 100644 (file)
@@ -428,24 +428,20 @@ int new_dentry_private_data(struct dentry *dentry)
        int size;
        struct unionfs_dentry_info *info = UNIONFS_D(dentry);
        void *p;
-       int unlock_on_err = 0;
 
-       if (!info) {
-               dentry->d_fsdata = kmem_cache_alloc(unionfs_dentry_cachep,
-                                                   GFP_ATOMIC);
-               info = UNIONFS_D(dentry);
-               if (!info)
-                       goto out;
+       BUG_ON(info);
 
-               mutex_init(&info->lock);
-               unionfs_lock_dentry(dentry);
-               unlock_on_err = 1;
+       dentry->d_fsdata = kmem_cache_alloc(unionfs_dentry_cachep,
+                                           GFP_ATOMIC);
+       info = UNIONFS_D(dentry);
+       if (!info)
+               goto out;
 
-               info->lower_paths = NULL;
-       }
+       mutex_init(&info->lock);
+       info->lower_paths = NULL;
+       unionfs_lock_dentry(dentry);
 
-       info->bstart = -1;
-       info->bend = -1;
+       info->bstart = info->bend = -1;
        info->bcount = sbmax(dentry->d_sb);
        info->odf.dentry = NULL;
        atomic_set(&info->generation,
@@ -463,10 +459,7 @@ int new_dentry_private_data(struct dentry *dentry)
        return 0;
 
 out_free:
-       kfree(info->lower_paths);
-       if (unlock_on_err)
-               unionfs_unlock_dentry(dentry);
-
+       unionfs_unlock_dentry(dentry);
 out:
        free_dentry_private_data(info);
        dentry->d_fsdata = NULL;