GIT: unionfs2-2.6.27.y: cleanup: rewrite new_dentry_private data more simply

Erez Zadok ezk at fsl.cs.sunysb.edu
Thu Aug 12 23:16:36 EDT 2010


commit 92ebc0f2ab1816e93576647f1725b1197d94300d
Author: Erez_Zadok <ezk at cs.sunysb.edu>
Date:   Sun Jun 3 02:27:37 2007 -0400

    cleanup: rewrite new_dentry_private data more simply
    
    Also remove unnecessary variables and statements.
    
    Signed-off-by: Erez Zadok <ezk at cs.sunysb.edu>

diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index b38086b..98a05a8 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -483,23 +483,18 @@ 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;
-
-		mutex_init(&info->lock);
-		unionfs_lock_dentry(dentry);
-		unlock_on_err = 1;
+	BUG_ON(info);
 
-		info->lower_paths = NULL;
-	}
+	dentry->d_fsdata = kmem_cache_alloc(unionfs_dentry_cachep,
+					    GFP_ATOMIC);
+	info = UNIONFS_D(dentry);
+	if (!info)
+	  goto out;
 
-	mutex_lock(&info->lock);
+	mutex_init(&info->lock);
+	info->lower_paths = NULL;
+	unionfs_lock_dentry(dentry);
 
 	info->bstart = info->bend = info->bopaque = -1;
 	info->bcount = sbmax(dentry->d_sb);
@@ -518,10 +513,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;


More information about the unionfs-cvs mailing list