head	1.1;
access;
symbols
	LKML-branch:1.1.0.2;
locks; strict;
comment	@# @;


1.1
date	2006.10.18.21.42.19;	author jsipek;	state dead;
branches
	1.1.2.1;
next	;

1.1.2.1
date	2006.10.18.21.42.19;	author jsipek;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	2006.11.07.06.13.33;	author jsipek;	state Exp;
branches;
next	1.1.2.3;

1.1.2.3
date	2006.11.28.08.30.13;	author jsipek;	state dead;
branches;
next	;


desc
@@


1.1
log
@file struct_path-unionfs was initially added on branch LKML-branch.
@
text
@@


1.1.2.1
log
@Use struct path instead of dentry-vfsmount pair
@
text
@a0 315
diff -r 816c840e4a39 fs/unionfs/dentry.c
--- a/fs/unionfs/dentry.c	Wed Oct 18 17:19:27 2006 -0400
+++ b/fs/unionfs/dentry.c	Wed Oct 18 17:25:38 2006 -0400
@@@@ -223,10 +223,8 @@@@ void unionfs_d_release(struct dentry *de
 		set_dtohm_index(dentry, bindex, NULL);
 	}
 	/* free private data (unionfs_dentry_info) here */
-	kfree(dtohd_ptr(dentry));
-	kfree(dtohm_ptr(dentry));
-	dtohd_ptr(dentry) = NULL;
-	dtohm_ptr(dentry) = NULL;
+	kfree(dtohp_ptr(dentry));
+	dtohp_ptr(dentry) = NULL;
 
 out_free:
 	/* No need to unlock it, because it is disappeared. */
diff -r 816c840e4a39 fs/unionfs/fanout.h
--- a/fs/unionfs/fanout.h	Wed Oct 18 17:19:27 2006 -0400
+++ b/fs/unionfs/fanout.h	Wed Oct 18 17:24:42 2006 -0400
@@@@ -148,41 +148,39 @@@@ static inline void set_dtohd_index(struc
 static inline void set_dtohd_index(struct dentry *dent, int index,
 				   struct dentry *val)
 {
-	dtopd(dent)->udi_dentry[index] = val;
+	dtopd(dent)->udi_path[index].dentry = val;
 }
 
 static inline struct dentry *dtohd_index(const struct dentry *dent, int index)
 {
-	return dtopd(dent)->udi_dentry[index];
+	return dtopd(dent)->udi_path[index].dentry;
 }
 
 static inline struct dentry *dtohd(const struct dentry *dent)
 {
-	return dtopd(dent)->udi_dentry[dbstart(dent)];
+	return dtohd_index(dent, dbstart(dent));
 }
 
 static inline void set_dtohm_index(struct dentry *dent, int index,
 				   struct vfsmount *mnt)
 {
-	dtopd(dent)->udi_mnt[index] = mnt;
+	dtopd(dent)->udi_path[index].mnt = mnt;
 }
 
 static inline struct vfsmount *dtohm_index(const struct dentry *dent, int index)
 {
-	return dtopd(dent)->udi_mnt[index];
+	return dtopd(dent)->udi_path[index].mnt;
 }
 
 static inline struct vfsmount *dtohm(const struct dentry *dent)
 {
-	return dtopd(dent)->udi_mnt[dbstart(dent)];
+	return dtohm_index(dent,dbstart(dent));
 }
 
 #define set_dtohd_index_nocheck(dent, index, val) set_dtohd_index(dent, index, val)
 #define dtohd_index_nocheck(dent, index) dtohd_index(dent, index)
 
-#define dtohd_ptr(dent) (dtopd(dent)->udi_dentry)
-
-#define dtohm_ptr(dent) (dtopd(dent)->udi_mnt)
+#define dtohp_ptr(dent) (dtopd(dent)->udi_path)
 
 /* Macros for locking a dentry. */
 #define lock_dentry(d) down(&dtopd(d)->udi_sem)
diff -r 816c840e4a39 fs/unionfs/lookup.c
--- a/fs/unionfs/lookup.c	Wed Oct 18 17:19:27 2006 -0400
+++ b/fs/unionfs/lookup.c	Wed Oct 18 17:38:32 2006 -0400
@@@@ -306,10 +306,8 @@@@ out_free:
 			mntput(dtohm_index(dentry, bindex));
 		}
 	}
-	kfree(dtohd_ptr(dentry));
-	kfree(dtohm_ptr(dentry));
-	dtohd_ptr(dentry) = NULL;
-	dtohm_ptr(dentry) = NULL;
+	kfree(dtohp_ptr(dentry));
+	dtohp_ptr(dentry) = NULL;
 	set_dbstart(dentry, -1);
 	set_dbend(dentry, -1);
 
@@@@ -434,9 +432,9 @@@@ int new_dentry_private_data(struct dentr
 			goto out;
 		init_MUTEX_LOCKED(&dtopd_nocheck(dentry)->udi_sem);
 
-		dtohd_ptr(dentry) = NULL;
+		dtohp_ptr(dentry) = NULL;
 	} else
-		oldsize = sizeof(struct dentry *) * dtopd(dentry)->udi_bcount;
+		oldsize = sizeof(struct path) * dtopd(dentry)->udi_bcount;
 
 	dtopd(dentry)->udi_bstart = -1;
 	dtopd(dentry)->udi_bend = -1;
@@@@ -444,7 +442,7 @@@@ int new_dentry_private_data(struct dentr
 	dtopd(dentry)->udi_bcount = sbmax(dentry->d_sb);
 	atomic_set(&dtopd(dentry)->udi_generation,
 		   atomic_read(&stopd(dentry->d_sb)->usi_generation));
-	newsize = sizeof(void *) * sbmax(dentry->d_sb);
+	newsize = sizeof(struct path) * sbmax(dentry->d_sb);
 
 	/* Don't reallocate when we already have enough space. */
 	/* It would be ideal if we could actually use the slab macros to
@@@@ -454,29 +452,24 @@@@ int new_dentry_private_data(struct dentr
 		int minsize = malloc_sizes[0].cs_size;
 
 		if (!newsize || ((oldsize < newsize) && (newsize > minsize))) {
-			kfree(dtohd_ptr(dentry));
-			kfree(dtohm_ptr(dentry));
-			dtohd_ptr(dentry) = NULL;
-			dtohm_ptr(dentry) = NULL;
-		}
-	}
-
-	if (!dtohd_ptr(dentry) && newsize) {
-		dtohd_ptr(dentry) = kmalloc(newsize, GFP_ATOMIC);
-		dtohm_ptr(dentry) = kmalloc(newsize, GFP_ATOMIC);
-		if (!dtohd_ptr(dentry) || !dtohm_ptr(dentry))
+			kfree(dtohp_ptr(dentry));
+			dtohp_ptr(dentry) = NULL;
+		}
+	}
+
+	if (!dtohp_ptr(dentry) && newsize) {
+		dtohp_ptr(dentry) = kmalloc(newsize, GFP_ATOMIC);
+		if (!dtohp_ptr(dentry))
 			goto out_free;
 	}
 
-	memset(dtohd_ptr(dentry), 0, (oldsize > newsize ? oldsize : newsize));
-	memset(dtohm_ptr(dentry), 0, (oldsize > newsize ? oldsize : newsize));
+	memset(dtohp_ptr(dentry), 0, (oldsize > newsize ? oldsize : newsize));
 
 	spin_unlock(&dentry->d_lock);
 	return 0;
 
 out_free:
-	kfree(dtohd_ptr(dentry));
-	kfree(dtohm_ptr(dentry));
+	kfree(dtohp_ptr(dentry));
 
 out:
 	free_dentry_private_data(dtopd(dentry));
diff -r 816c840e4a39 fs/unionfs/main.c
--- a/fs/unionfs/main.c	Wed Oct 18 17:19:27 2006 -0400
+++ b/fs/unionfs/main.c	Wed Oct 18 17:39:16 2006 -0400
@@@@ -263,16 +263,9 @@@@ static int parse_dirs_option(struct supe
 		goto out;
 	}
 
-	hidden_root_info->udi_dentry = kcalloc(branches,
-			sizeof(struct dentry *), GFP_KERNEL);
-	if (!hidden_root_info->udi_dentry) {
-		err = -ENOMEM;
-		goto out;
-	}
-
-	hidden_root_info->udi_mnt = kcalloc(branches,
-			sizeof(struct vfsmount *), GFP_KERNEL);
-	if (!hidden_root_info->udi_mnt) {
+	hidden_root_info->udi_path = kcalloc(branches,
+			sizeof(struct path), GFP_KERNEL);
+	if (!hidden_root_info->udi_path) {
 		err = -ENOMEM;
 		goto out;
 	}
@@@@ -308,8 +301,8 @@@@ static int parse_dirs_option(struct supe
 			goto out;
 		}
 
-		hidden_root_info->udi_dentry[bindex] = nd.dentry;
-		hidden_root_info->udi_mnt[bindex] = nd.mnt;
+		hidden_root_info->udi_path[bindex].dentry = nd.dentry;
+		hidden_root_info->udi_path[bindex].mnt = nd.mnt;
 
 		set_branchperms(sb, bindex, perms);
 		set_branch_count(sb, bindex, 0);
@@@@ -331,8 +324,8 @@@@ static int parse_dirs_option(struct supe
 	/* ensure that no overlaps exist in the branches */
 	for (i = 0; i < branches; i++) {
 		for (j = i + 1; j < branches; j++) {
-			dent1 = hidden_root_info->udi_dentry[i];
-			dent2 = hidden_root_info->udi_dentry[j];
+			dent1 = hidden_root_info->udi_path[i].dentry;
+			dent2 = hidden_root_info->udi_path[j].dentry;
 
 			if (is_branch_overlap(dent1, dent2)) {
 				printk(KERN_WARNING "unionfs: branches %d and %d overlap\n", i, j);
@@@@ -345,20 +338,18 @@@@ out:
 out:
 	if (err) {
 		for (i = 0; i < branches; i++)
-			if (hidden_root_info->udi_dentry[i]) {
-				dput(hidden_root_info->udi_dentry[i]);
-				mntput(hidden_root_info->udi_mnt[i]);
+			if (hidden_root_info->udi_path[i].dentry) {
+				dput(hidden_root_info->udi_path[i].dentry);
+				mntput(hidden_root_info->udi_path[i].mnt);
 			}
 
-		kfree(hidden_root_info->udi_dentry);
-		kfree(hidden_root_info->udi_mnt);
+		kfree(hidden_root_info->udi_path);
 		kfree(stopd(sb)->usi_data);
 
 		/* MUST clear the pointers to prevent potential double free if
 		 * the caller dies later on
 		 */
-		hidden_root_info->udi_dentry = NULL;
-		hidden_root_info->udi_mnt = NULL;
+		hidden_root_info->udi_path = NULL;
 		stopd(sb)->usi_data = NULL;
 	}
 	return err;
@@@@ -447,15 +438,15 @@@@ static struct unionfs_dentry_info *union
 	goto out;
 
 out_error:
-	if (hidden_root_info && hidden_root_info->udi_dentry) {
+	if (hidden_root_info && hidden_root_info->udi_path) {
 		for (bindex = hidden_root_info->udi_bstart;
 		     bindex >= 0 && bindex <= hidden_root_info->udi_bend;
 		     bindex++) {
 			struct dentry *d;
 			struct vfsmount *m;
 
-			d = hidden_root_info->udi_dentry[bindex];
-			m = hidden_root_info->udi_mnt[bindex];
+			d = hidden_root_info->udi_path[bindex].dentry;
+			m = hidden_root_info->udi_path[bindex].mnt;
 
 			dput(d);
 
@@@@ -464,7 +455,7 @@@@ out_error:
 		}
 	}
 
-	kfree(hidden_root_info->udi_dentry);
+	kfree(hidden_root_info->udi_path);
 	kfree(hidden_root_info);
 
 	kfree(stopd(sb)->usi_data);
@@@@ -541,7 +532,7 @@@@ static int unionfs_read_super(struct sup
 	for (bindex = bstart; bindex <= bend; bindex++) {
 		struct dentry *d;
 
-		d = hidden_root_info->udi_dentry[bindex];
+		d = hidden_root_info->udi_path[bindex].dentry;
 
 		set_stohs_index(sb, bindex, d->d_sb);
 	}
@@@@ -572,8 +563,8 @@@@ static int unionfs_read_super(struct sup
 		struct dentry *d;
 		struct vfsmount *m;
 
-		d = hidden_root_info->udi_dentry[bindex];
-		m = hidden_root_info->udi_mnt[bindex];
+		d = hidden_root_info->udi_path[bindex].dentry;
+		m = hidden_root_info->udi_path[bindex].mnt;
 
 		set_dtohd_index(sb->s_root, bindex, d);
 		set_dtohm_index(sb->s_root, bindex, m);
@@@@ -592,7 +583,7 @@@@ static int unionfs_read_super(struct sup
 
 out_freedpd:
 	if (dtopd(sb->s_root)) {
-		kfree(dtohd_ptr(sb->s_root));
+		kfree(dtohp_ptr(sb->s_root));
 		free_dentry_private_data(dtopd(sb->s_root));
 	}
 	dput(sb->s_root);
@@@@ -604,8 +595,8 @@@@ out_dput:
 			struct dentry *d;
 			struct vfsmount *m;
 
-			d = hidden_root_info->udi_dentry[bindex];
-			m = hidden_root_info->udi_mnt[bindex];
+			d = hidden_root_info->udi_path[bindex].dentry;
+			m = hidden_root_info->udi_path[bindex].mnt;
 
 			if (d)
 				dput(d);
@@@@ -613,7 +604,7 @@@@ out_dput:
 			if (m)
 				mntput(m);
 		}
-		kfree(hidden_root_info->udi_dentry);
+		kfree(hidden_root_info->udi_path);
 		kfree(hidden_root_info);
 		hidden_root_info = NULL;
 	}
@@@@ -625,7 +616,7 @@@@ out_free:
 
 out:
 	if (hidden_root_info && !IS_ERR(hidden_root_info)) {
-		kfree(hidden_root_info->udi_dentry);
+		kfree(hidden_root_info->udi_path);
 		kfree(hidden_root_info);
 	}
 	return err;
diff -r 816c840e4a39 fs/unionfs/union.h
--- a/fs/unionfs/union.h	Wed Oct 18 17:19:27 2006 -0400
+++ b/fs/unionfs/union.h	Wed Oct 18 17:22:20 2006 -0400
@@@@ -117,8 +117,7 @@@@ struct unionfs_dentry_info {
 	int udi_bopaque;
 	int udi_bcount;
 	atomic_t udi_generation;
-	struct dentry **udi_dentry;
-	struct vfsmount **udi_mnt;
+	struct path *udi_path;
 };
 
 /* These are the pointers to our various objects. */
@


1.1.2.2
log
@Git generates slightly different diffs - same information, just little
different
@
text
@d1 3
a3 4
diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c
index 9b5abc3..a1d2e07 100644
--- a/fs/unionfs/dentry.c
+++ b/fs/unionfs/dentry.c
d17 4
a20 5
diff --git a/fs/unionfs/fanout.h b/fs/unionfs/fanout.h
index 2478675..0b4cad3 100644
--- a/fs/unionfs/fanout.h
+++ b/fs/unionfs/fanout.h
@@@@ -148,41 +148,39 @@@@ #define set_dbopaque(dent, val) do { dto
d69 3
a71 4
diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index 288f42a..51579e3 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
d114 3
a116 5
+			kfree(dtohp_ptr(dentry));
+			dtohp_ptr(dentry) = NULL;
 		}
 	}
 
d121 5
d146 3
a148 4
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index e6b2867..ac72202 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
d191 1
a191 1
@@@@ -345,20 +338,18 @@@@ static int parse_dirs_option(struct supe
d303 3
a305 4
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 1da8af6..9a216b0 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@


1.1.2.3
log
@Collapsed: struct_path-unionfs unionfs-fix-comments unionfs-kill-wrappers
@
text
@@


