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


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

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

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

1.1.2.3
date	2006.12.01.09.34.51;	author jsipek;	state Exp;
branches;
next	1.1.2.4;

1.1.2.4
date	2006.12.01.23.36.14;	author jsipek;	state Exp;
branches;
next	1.1.2.5;

1.1.2.5
date	2006.12.02.00.38.46;	author jsipek;	state Exp;
branches;
next	1.1.2.6;

1.1.2.6
date	2006.12.02.02.20.25;	author jsipek;	state Exp;
branches;
next	1.1.2.7;

1.1.2.7
date	2006.12.02.03.34.12;	author jsipek;	state Exp;
branches;
next	1.1.2.8;

1.1.2.8
date	2006.12.02.07.59.24;	author jsipek;	state Exp;
branches;
next	1.1.2.9;

1.1.2.9
date	2006.12.03.08.17.26;	author jsipek;	state Exp;
branches;
next	1.1.2.10;

1.1.2.10
date	2006.12.03.08.39.28;	author jsipek;	state Exp;
branches;
next	1.1.2.11;

1.1.2.11
date	2006.12.03.21.49.41;	author jsipek;	state dead;
branches;
next	;


desc
@@


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


1.1.2.1
log
@Macro removal patch
@
text
@a0 962
diff -r 3ab2c76610b7 fs/unionfs/branchman.c
--- a/fs/unionfs/branchman.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/branchman.c	Fri Dec 01 00:42:23 2006 -0500
@@@@ -27,10 +27,10 @@@@ int unionfs_ioctl_incgen(struct file *fi
 
 	unionfs_write_lock(sb);
 
-	gen = atomic_inc_return(&stopd(sb)->usi_generation);
+	gen = atomic_inc_return(&UNIONFS_SB(sb)->usi_generation);
 
-	atomic_set(&dtopd(sb->s_root)->udi_generation, gen);
-	atomic_set(&itopd(sb->s_root->d_inode)->uii_generation, gen);
+	atomic_set(&UNIONFS_D(sb->s_root)->udi_generation, gen);
+	atomic_set(&UNIONFS_I(sb->s_root->d_inode)->uii_generation, gen);
 
 	unionfs_write_unlock(sb);
 
diff -r 3ab2c76610b7 fs/unionfs/commonfops.c
--- a/fs/unionfs/commonfops.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/commonfops.c	Fri Dec 01 01:14:48 2006 -0500
@@@@ -148,8 +148,8 @@@@ static int open_highest_file(struct file
 				break;
 
 		}
-		atomic_set(&ftopd(file)->ufi_generation,
-			atomic_read(&itopd(dentry->d_inode)->uii_generation));
+		atomic_set(&UNIONFS_F(file)->ufi_generation,
+			atomic_read(&UNIONFS_I(dentry->d_inode)->uii_generation));
 		goto out;
 	}
 
@@@@ -226,9 +226,9 @@@@ int unionfs_file_revalidate(struct file 
 		goto out;
 	}
 
-	sbgen = atomic_read(&stopd(sb)->usi_generation);
-	dgen = atomic_read(&dtopd(dentry)->udi_generation);
-	fgen = atomic_read(&ftopd(file)->ufi_generation);
+	sbgen = atomic_read(&UNIONFS_SB(sb)->usi_generation);
+	dgen = atomic_read(&UNIONFS_D(dentry)->udi_generation);
+	fgen = atomic_read(&UNIONFS_F(file)->ufi_generation);
 
 	BUG_ON(sbgen > dgen);
 
@@@@ -263,8 +263,8 @@@@ int unionfs_file_revalidate(struct file 
 			if (err)
 				goto out;
 		}
-		atomic_set(&ftopd(file)->ufi_generation,
-			   atomic_read(&itopd(dentry->d_inode)->
+		atomic_set(&UNIONFS_F(file)->ufi_generation,
+			   atomic_read(&UNIONFS_I(dentry->d_inode)->
 				       uii_generation));
 	}
 
@@@@ -376,15 +376,15 @@@@ int unionfs_open(struct inode *inode, st
 	int bindex = 0, bstart = 0, bend = 0;
 	int size;
 
-	ftopd_lhs(file) = kzalloc(sizeof(struct unionfs_file_info), GFP_KERNEL);
-	if (!ftopd(file)) {
+	file->private_data = kzalloc(sizeof(struct unionfs_file_info), GFP_KERNEL);
+	if (!UNIONFS_F(file)) {
 		err = -ENOMEM;
 		goto out;
 	}
 	fbstart(file) = -1;
 	fbend(file) = -1;
-	atomic_set(&ftopd(file)->ufi_generation,
-		   atomic_read(&itopd(inode)->uii_generation));
+	atomic_set(&UNIONFS_F(file)->ufi_generation,
+		   atomic_read(&UNIONFS_I(inode)->uii_generation));
 
 	size = sizeof(struct file *) * sbmax(inode->i_sb);
 	ftohf_ptr(file) = kzalloc(size, GFP_KERNEL);
@@@@ -401,7 +401,7 @@@@ int unionfs_open(struct inode *inode, st
 	bend = fbend(file) = dbend(dentry);
 
 	/* increment, so that we can flush appropriately */
-	atomic_inc(&itopd(dentry->d_inode)->uii_totalopens);
+	atomic_inc(&UNIONFS_I(dentry->d_inode)->uii_totalopens);
 
 	/* open all directories and make the unionfs file struct point to these hidden file structs */
 	if (S_ISDIR(inode->i_mode))
@@@@ -428,7 +428,7 @@@@ out:
 out:
 	if (err) {
 		kfree(ftohf_ptr(file));
-		kfree(ftopd(file));
+		kfree(UNIONFS_F(file));
 	}
 
 	return err;
@@@@ -441,7 +441,7 @@@@ int unionfs_file_release(struct inode *i
 	int fgen;
 
 	/* fput all the hidden files */
-	fgen = atomic_read(&ftopd(file)->ufi_generation);
+	fgen = atomic_read(&UNIONFS_F(file)->ufi_generation);
 	bstart = fbstart(file);
 	bend = fbend(file);
 
@@@@ -457,21 +457,21 @@@@ int unionfs_file_release(struct inode *i
 	}
 	kfree(ftohf_ptr(file));
 
-	if (ftopd(file)->rdstate) {
-		ftopd(file)->rdstate->uds_access = jiffies;
+	if (UNIONFS_F(file)->rdstate) {
+		UNIONFS_F(file)->rdstate->uds_access = jiffies;
 		printk(KERN_DEBUG "Saving rdstate with cookie %u [%d.%lld]\n",
-		       ftopd(file)->rdstate->uds_cookie,
-		       ftopd(file)->rdstate->uds_bindex,
-		       (long long)ftopd(file)->rdstate->uds_dirpos);
-		spin_lock(&itopd(inode)->uii_rdlock);
-		itopd(inode)->uii_rdcount++;
-		list_add_tail(&ftopd(file)->rdstate->uds_cache,
-			      &itopd(inode)->uii_readdircache);
+		       UNIONFS_F(file)->rdstate->uds_cookie,
+		       UNIONFS_F(file)->rdstate->uds_bindex,
+		       (long long)UNIONFS_F(file)->rdstate->uds_dirpos);
+		spin_lock(&UNIONFS_I(inode)->uii_rdlock);
+		UNIONFS_I(inode)->uii_rdcount++;
+		list_add_tail(&UNIONFS_F(file)->rdstate->uds_cache,
+			      &UNIONFS_I(inode)->uii_readdircache);
 		mark_inode_dirty(inode);
-		spin_unlock(&itopd(inode)->uii_rdlock);
-		ftopd(file)->rdstate = NULL;
-	}
-	kfree(ftopd(file));
+		spin_unlock(&UNIONFS_I(inode)->uii_rdlock);
+		UNIONFS_F(file)->rdstate = NULL;
+	}
+	kfree(UNIONFS_F(file));
 	return 0;
 }
 
@@@@ -540,7 +540,7 @@@@ int unionfs_flush(struct file *file, fl_
 	if ((err = unionfs_file_revalidate(file, 1)))
 		goto out;
 	if (!atomic_dec_and_test
-	    (&itopd(file->f_dentry->d_inode)->uii_totalopens))
+	    (&UNIONFS_I(file->f_dentry->d_inode)->uii_totalopens))
 		goto out;
 
 	lock_dentry(file->f_dentry);
diff -r 3ab2c76610b7 fs/unionfs/dentry.c
--- a/fs/unionfs/dentry.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/dentry.c	Fri Dec 01 00:50:18 2006 -0500
@@@@ -58,8 +58,8 @@@@ restart:
 	BUG_ON(dbstart(dentry) == -1);
 	if (dentry->d_inode)
 		positive = 1;
-	dgen = atomic_read(&dtopd(dentry)->udi_generation);
-	sbgen = atomic_read(&stopd(dentry->d_sb)->usi_generation);
+	dgen = atomic_read(&UNIONFS_D(dentry)->udi_generation);
+	sbgen = atomic_read(&UNIONFS_SB(dentry->d_sb)->usi_generation);
 	/* If we are working on an unconnected dentry, then there is no
 	 * revalidation to be done, because this file does not exist within the
 	 * namespace, and Unionfs operates on the namespace, not data.
@@@@ -75,7 +75,7 @@@@ restart:
 		BUG_ON(IS_ROOT(dentry));
 
 		/* We can't work correctly if our parent isn't valid. */
-		pdgen = atomic_read(&dtopd(dentry->d_parent)->udi_generation);
+		pdgen = atomic_read(&UNIONFS_D(dentry->d_parent)->udi_generation);
 		if (!restart && (pdgen != sbgen)) {
 			unionfs_read_unlock(dentry->d_sb);
 			locked = 0;
@@@@ -98,7 +98,7 @@@@ restart:
 			struct dentry *hidden_dentry;
 			for (bindex = bstart; bindex <= bend; bindex++) {
 				hidden_dentry =
-				    dtohd_index_nocheck(dentry, bindex);
+				    dtohd_index(dentry, bindex);
 				if (!hidden_dentry)
 					continue;
 				dput(hidden_dentry);
@@@@ -124,8 +124,8 @@@@ restart:
 					iput(hidden_inode);
 				}
 			}
-			kfree(itohi_ptr(dentry->d_inode));
-			itohi_ptr(dentry->d_inode) = NULL;
+			kfree(UNIONFS_I(dentry->d_inode)->lower_inodes);
+			UNIONFS_I(dentry->d_inode)->lower_inodes = NULL;
 			ibstart(dentry->d_inode) = -1;
 			ibend(dentry->d_inode) = -1;
 			mutex_unlock(&dentry->d_inode->i_mutex);
@@@@ -143,7 +143,7 @@@@ restart:
 			dentry = result;
 		}
 
-		if (positive && itopd(dentry->d_inode)->uii_stale) {
+		if (positive && UNIONFS_I(dentry->d_inode)->uii_stale) {
 			make_stale_inode(dentry->d_inode);
 			d_drop(dentry);
 			valid = 0;
@@@@ -200,7 +200,7 @@@@ void unionfs_d_release(struct dentry *de
 	lock_dentry(dentry);
 
 	/* this could be a negative dentry, so check first */
-	if (!dtopd(dentry)) {
+	if (!UNIONFS_D(dentry)) {
 		printk(KERN_DEBUG "dentry without private data: %.*s",
 		       dentry->d_name.len, dentry->d_name.name);
 		goto out;
@@@@ -229,7 +229,7 @@@@ void unionfs_d_release(struct dentry *de
 
 out_free:
 	/* No need to unlock it, because it is disappeared. */
-	free_dentry_private_data(dtopd(dentry));
+	free_dentry_private_data(UNIONFS_D(dentry));
 	dtopd_lhs(dentry) = NULL;	/* just to be safe */
 
 out:
diff -r 3ab2c76610b7 fs/unionfs/dirfops.c
--- a/fs/unionfs/dirfops.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/dirfops.c	Fri Dec 01 00:42:23 2006 -0500
@@@@ -98,7 +98,7 @@@@ static int unionfs_readdir(struct file *
 
 	inode = file->f_dentry->d_inode;
 
-	uds = ftopd(file)->rdstate;
+	uds = UNIONFS_F(file)->rdstate;
 	if (!uds) {
 		if (file->f_pos == DIREOF) {
 			goto out;
@@@@ -108,10 +108,10 @@@@ static int unionfs_readdir(struct file *
 				err = -ESTALE;
 				goto out;
 			}
-			ftopd(file)->rdstate = uds;
+			UNIONFS_F(file)->rdstate = uds;
 		} else {
 			init_rdstate(file);
-			uds = ftopd(file)->rdstate;
+			uds = UNIONFS_F(file)->rdstate;
 		}
 	}
 	bend = fbend(file);
@@@@ -166,9 +166,9 @@@@ static int unionfs_readdir(struct file *
 
 	if (!buf.filldir_error && uds->uds_bindex >= bend) {
 		/* Save the number of hash entries for next time. */
-		itopd(inode)->uii_hashsize = uds->uds_hashentries;
+		UNIONFS_I(inode)->uii_hashsize = uds->uds_hashentries;
 		free_rdstate(uds);
-		ftopd(file)->rdstate = NULL;
+		UNIONFS_F(file)->rdstate = NULL;
 		file->f_pos = DIREOF;
 	} else
 		file->f_pos = rdstate2offset(uds);
@@@@ -196,7 +196,7 @@@@ static loff_t unionfs_dir_llseek(struct 
 	if ((err = unionfs_file_revalidate(file, 0)))
 		goto out;
 
-	rdstate = ftopd(file)->rdstate;
+	rdstate = UNIONFS_F(file)->rdstate;
 
 	/* We let users seek to their current position, but not anywhere else. */
 	if (!offset) {
@@@@ -204,7 +204,7 @@@@ static loff_t unionfs_dir_llseek(struct 
 		case SEEK_SET:
 			if (rdstate) {
 				free_rdstate(rdstate);
-				ftopd(file)->rdstate = NULL;
+				UNIONFS_F(file)->rdstate = NULL;
 			}
 			init_rdstate(file);
 			err = 0;
@@@@ -230,7 +230,7 @@@@ static loff_t unionfs_dir_llseek(struct 
 			} else {
 				if ((rdstate = find_rdstate(file->f_dentry->d_inode,
 							offset))) {
-					ftopd(file)->rdstate = rdstate;
+					UNIONFS_F(file)->rdstate = rdstate;
 					err = rdstate->uds_offset;
 				} else
 					err = -EINVAL;
diff -r 3ab2c76610b7 fs/unionfs/fanout.h
--- a/fs/unionfs/fanout.h	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/fanout.h	Fri Dec 01 01:14:54 2006 -0500
@@@@ -19,141 +19,137 @@@@
 #define _FANOUT_H_
 
 /* Inode to private data */
-static inline struct unionfs_inode_info *itopd(const struct inode *inode)
+static inline struct unionfs_inode_info *UNIONFS_I(const struct inode *inode)
 {
 	return
 	    &(container_of(inode, struct unionfs_inode_container, vfs_inode)->
 	      info);
 }
 
-#define itohi_ptr(ino) (itopd(ino)->uii_inode)
-#define ibstart(ino) (itopd(ino)->b_start)
-#define ibend(ino) (itopd(ino)->b_end)
+#define ibstart(ino) (UNIONFS_I(ino)->b_start)
+#define ibend(ino) (UNIONFS_I(ino)->b_end)
 
 /* Superblock to private data */
-#define stopd(super) ((struct unionfs_sb_info *)(super)->s_fs_info)
-#define stopd_lhs(super) ((super)->s_fs_info)
+#define UNIONFS_SB(super) ((struct unionfs_sb_info *)(super)->s_fs_info)
 #define sbstart(sb) 0
-#define sbend(sb) stopd(sb)->b_end
-#define sbmax(sb) (stopd(sb)->b_end + 1)
+#define sbend(sb) UNIONFS_SB(sb)->b_end
+#define sbmax(sb) (UNIONFS_SB(sb)->b_end + 1)
 
 /* File to private Data */
-#define ftopd(file) ((struct unionfs_file_info *)((file)->private_data))
-#define ftopd_lhs(file) ((file)->private_data)
-#define ftohf_ptr(file)  (ftopd(file)->ufi_file)
-#define fbstart(file) (ftopd(file)->b_start)
-#define fbend(file) (ftopd(file)->b_end)
+#define UNIONFS_F(file) ((struct unionfs_file_info *)((file)->private_data))
+#define ftohf_ptr(file)  (UNIONFS_F(file)->ufi_file)
+#define fbstart(file) (UNIONFS_F(file)->b_start)
+#define fbend(file) (UNIONFS_F(file)->b_end)
 
 /* File to hidden file. */
 static inline struct file *ftohf(struct file *f)
 {
-	return ftopd(f)->ufi_file[fbstart(f)];
+	return UNIONFS_F(f)->ufi_file[fbstart(f)];
 }
 
 static inline struct file *ftohf_index(const struct file *f, int index)
 {
-	return ftopd(f)->ufi_file[index];
+	return UNIONFS_F(f)->ufi_file[index];
 }
 
 static inline void set_ftohf_index(struct file *f, int index, struct file *val)
 {
-	ftopd(f)->ufi_file[index] = val;
+	UNIONFS_F(f)->ufi_file[index] = val;
 }
 
 static inline void set_ftohf(struct file *f, struct file *val)
 {
-	ftopd(f)->ufi_file[fbstart(f)] = val;
+	UNIONFS_F(f)->ufi_file[fbstart(f)] = val;
 }
 
 /* Inode to hidden inode. */
 static inline struct inode *itohi(const struct inode *i)
 {
-	return itopd(i)->uii_inode[ibstart(i)];
+	return UNIONFS_I(i)->lower_inodes[ibstart(i)];
 }
 
 static inline struct inode *itohi_index(const struct inode *i, int index)
 {
-	return itopd(i)->uii_inode[index];
+	return UNIONFS_I(i)->lower_inodes[index];
 }
 
 static inline void set_itohi_index(struct inode *i, int index,
 				   struct inode *val)
 {
-	itopd(i)->uii_inode[index] = val;
+	UNIONFS_I(i)->lower_inodes[index] = val;
 }
 
 static inline void set_itohi(struct inode *i, struct inode *val)
 {
-	itopd(i)->uii_inode[ibstart(i)] = val;
+	UNIONFS_I(i)->lower_inodes[ibstart(i)] = val;
 }
 
 /* Superblock to hidden superblock. */
 static inline struct super_block *stohs(const struct super_block *o)
 {
-	return stopd(o)->usi_data[sbstart(o)].sb;
+	return UNIONFS_SB(o)->usi_data[sbstart(o)].sb;
 }
 
 static inline struct super_block *stohs_index(const struct super_block *o, int index)
 {
-	return stopd(o)->usi_data[index].sb;
+	return UNIONFS_SB(o)->usi_data[index].sb;
 }
 
 static inline void set_stohs_index(struct super_block *o, int index,
 				   struct super_block *val)
 {
-	stopd(o)->usi_data[index].sb = val;
+	UNIONFS_SB(o)->usi_data[index].sb = val;
 }
 
 static inline void set_stohs(struct super_block *o, struct super_block *val)
 {
-	stopd(o)->usi_data[sbstart(o)].sb = val;
+	UNIONFS_SB(o)->usi_data[sbstart(o)].sb = val;
 }
 
 /* Branch count macros. */
 static inline int branch_count(struct super_block *o, int index)
 {
-	return atomic_read(&stopd(o)->usi_data[index].sbcount);
+	return atomic_read(&UNIONFS_SB(o)->usi_data[index].sbcount);
 }
 
 static inline void set_branch_count(struct super_block *o, int index, int val)
 {
-	atomic_set(&stopd(o)->usi_data[index].sbcount, val);
+	atomic_set(&UNIONFS_SB(o)->usi_data[index].sbcount, val);
 }
 
 static inline void branchget(struct super_block *o, int index)
 {
-	atomic_inc(&stopd(o)->usi_data[index].sbcount);
+	atomic_inc(&UNIONFS_SB(o)->usi_data[index].sbcount);
 }
 
 static inline void branchput(struct super_block *o, int index)
 {
-	atomic_dec(&stopd(o)->usi_data[index].sbcount);
+	atomic_dec(&UNIONFS_SB(o)->usi_data[index].sbcount);
 }
 
 /* Dentry macros */
-static inline struct unionfs_dentry_info *dtopd(const struct dentry *dent)
+static inline struct unionfs_dentry_info *UNIONFS_D(const struct dentry *dent)
 {
 	return dent->d_fsdata;
 }
 
 #define dtopd_lhs(dent) ((dent)->d_fsdata)
-#define dtopd_nocheck(dent) dtopd(dent)
-#define dbstart(dent) (dtopd(dent)->udi_bstart)
-#define set_dbstart(dent, val) do { dtopd(dent)->udi_bstart = val; } while(0)
-#define dbend(dent) (dtopd(dent)->udi_bend)
-#define set_dbend(dent, val) do { dtopd(dent)->udi_bend = val; } while(0)
-#define dbopaque(dent) (dtopd(dent)->udi_bopaque)
-#define set_dbopaque(dent, val) do { dtopd(dent)->udi_bopaque = val; } while (0)
+#define dbstart(dent) (UNIONFS_D(dent)->udi_bstart)
+#define set_dbstart(dent, val) do { UNIONFS_D(dent)->udi_bstart = val; } while(0)
+#define dbend(dent) (UNIONFS_D(dent)->udi_bend)
+#define set_dbend(dent, val) do { UNIONFS_D(dent)->udi_bend = val; } while(0)
+#define dbopaque(dent) (UNIONFS_D(dent)->udi_bopaque)
+#define set_dbopaque(dent, val) do { UNIONFS_D(dent)->udi_bopaque = val; } while (0)
 
 static inline void set_dtohd_index(struct dentry *dent, int index,
 				   struct dentry *val)
 {
-	dtopd(dent)->udi_path[index].dentry = val;
+	UNIONFS_D(dent)->udi_path[index].dentry = val;
 }
 
 static inline struct dentry *dtohd_index(const struct dentry *dent, int index)
 {
-	return dtopd(dent)->udi_path[index].dentry;
+	return UNIONFS_D(dent)->udi_path[index].dentry;
 }
 
 static inline struct dentry *dtohd(const struct dentry *dent)
@@@@ -164,12 +160,12 @@@@ static inline void set_dtohm_index(struc
 static inline void set_dtohm_index(struct dentry *dent, int index,
 				   struct vfsmount *mnt)
 {
-	dtopd(dent)->udi_path[index].mnt = mnt;
+	UNIONFS_D(dent)->udi_path[index].mnt = mnt;
 }
 
 static inline struct vfsmount *dtohm_index(const struct dentry *dent, int index)
 {
-	return dtopd(dent)->udi_path[index].mnt;
+	return UNIONFS_D(dent)->udi_path[index].mnt;
 }
 
 static inline struct vfsmount *dtohm(const struct dentry *dent)
@@@@ -177,14 +173,14 @@@@ static inline struct vfsmount *dtohm(con
 	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 set_dtohd_index(dent, index, val) set_dtohd_index(dent, index, val)
+#define dtohd_index(dent, index) dtohd_index(dent, index)
 
-#define dtohp_ptr(dent) (dtopd(dent)->udi_path)
+#define dtohp_ptr(dent) (UNIONFS_D(dent)->udi_path)
 
 /* Macros for locking a dentry. */
-#define lock_dentry(d) down(&dtopd(d)->udi_sem)
-#define unlock_dentry(d) up(&dtopd(d)->udi_sem)
+#define lock_dentry(d) down(&UNIONFS_D(d)->udi_sem)
+#define unlock_dentry(d) up(&UNIONFS_D(d)->udi_sem)
 #define verify_locked(d)
 
 #endif	/* _FANOUT_H */
diff -r 3ab2c76610b7 fs/unionfs/lookup.c
--- a/fs/unionfs/lookup.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/lookup.c	Fri Dec 01 00:42:23 2006 -0500
@@@@ -48,7 +48,7 @@@@ struct dentry *unionfs_lookup_backend(st
 	    || lookupmode == INTERPOSE_REVAL_NEG)
 		verify_locked(dentry);
 	else {
-		BUG_ON(dtopd_nocheck(dentry) != NULL);
+		BUG_ON(UNIONFS_D(dentry) != NULL);
 		locked_child = 1;
 	}
 	if (lookupmode != INTERPOSE_PARTIAL)
@@@@ -229,7 +229,7 @@@@ out_negative:
 	/* If we've only got negative dentries, then use the leftmost one. */
 	if (lookupmode == INTERPOSE_REVAL) {
 		if (dentry->d_inode)
-			itopd(dentry->d_inode)->uii_stale = 1;
+			UNIONFS_I(dentry->d_inode)->uii_stale = 1;
 
 		goto out;
 	}
@@@@ -312,8 +312,8 @@@@ out_free:
 	set_dbend(dentry, -1);
 
 out:
-	if (!err && dtopd(dentry)) {
-		BUG_ON(dbend(dentry) > dtopd(dentry)->udi_bcount);
+	if (!err && UNIONFS_D(dentry)) {
+		BUG_ON(dbend(dentry) > UNIONFS_D(dentry)->udi_bcount);
 		BUG_ON(dbend(dentry) > sbmax(dentry->d_sb));
 		BUG_ON(dbstart(dentry) < 0);
 	}
@@@@ -425,23 +425,23 @@@@ int new_dentry_private_data(struct dentr
 	int oldsize = 0;
 
 	spin_lock(&dentry->d_lock);
-	if (!dtopd(dentry)) {
+	if (!UNIONFS_D(dentry)) {
 		dtopd_lhs(dentry) = (struct unionfs_dentry_info *)
 		    kmem_cache_alloc(unionfs_dentry_cachep, SLAB_ATOMIC);
-		if (!dtopd(dentry))
+		if (!UNIONFS_D(dentry))
 			goto out;
-		init_MUTEX_LOCKED(&dtopd_nocheck(dentry)->udi_sem);
+		init_MUTEX_LOCKED(&UNIONFS_D(dentry)->udi_sem);
 
 		dtohp_ptr(dentry) = NULL;
 	} else
-		oldsize = sizeof(struct path) * dtopd(dentry)->udi_bcount;
-
-	dtopd(dentry)->udi_bstart = -1;
-	dtopd(dentry)->udi_bend = -1;
-	dtopd(dentry)->udi_bopaque = -1;
-	dtopd(dentry)->udi_bcount = sbmax(dentry->d_sb);
-	atomic_set(&dtopd(dentry)->udi_generation,
-		   atomic_read(&stopd(dentry->d_sb)->usi_generation));
+		oldsize = sizeof(struct path) * UNIONFS_D(dentry)->udi_bcount;
+
+	UNIONFS_D(dentry)->udi_bstart = -1;
+	UNIONFS_D(dentry)->udi_bend = -1;
+	UNIONFS_D(dentry)->udi_bopaque = -1;
+	UNIONFS_D(dentry)->udi_bcount = sbmax(dentry->d_sb);
+	atomic_set(&UNIONFS_D(dentry)->udi_generation,
+		   atomic_read(&UNIONFS_SB(dentry->d_sb)->usi_generation));
 	newsize = sizeof(struct path) * sbmax(dentry->d_sb);
 
 	/* Don't reallocate when we already have enough space. */
@@@@ -472,7 +472,7 @@@@ out_free:
 	kfree(dtohp_ptr(dentry));
 
 out:
-	free_dentry_private_data(dtopd(dentry));
+	free_dentry_private_data(UNIONFS_D(dentry));
 	dtopd_lhs(dentry) = NULL;
 	spin_unlock(&dentry->d_lock);
 	return -ENOMEM;
diff -r 3ab2c76610b7 fs/unionfs/main.c
--- a/fs/unionfs/main.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/main.c	Fri Dec 01 01:06:56 2006 -0500
@@@@ -54,14 +54,14 @@@@ int unionfs_interpose(struct dentry *den
 	 * to fix it up. */
 	if (flag == INTERPOSE_REVAL) {
 		inode = dentry->d_inode;
-		itopd(inode)->b_start = -1;
-		itopd(inode)->b_end = -1;
-		atomic_set(&itopd(inode)->uii_generation,
-			   atomic_read(&stopd(sb)->usi_generation));
-
-		itohi_ptr(inode) =
+		UNIONFS_I(inode)->b_start = -1;
+		UNIONFS_I(inode)->b_end = -1;
+		atomic_set(&UNIONFS_I(inode)->uii_generation,
+			   atomic_read(&UNIONFS_SB(sb)->usi_generation));
+
+		UNIONFS_I(inode)->lower_inodes =
 		    kcalloc(sbmax(sb), sizeof(struct inode *), GFP_KERNEL);
-		if (!itohi_ptr(inode)) {
+		if (!UNIONFS_I(inode)->lower_inodes) {
 			err = -ENOMEM;
 			goto out;
 		}
@@@@ -251,9 +251,9 @@@@ static int parse_dirs_option(struct supe
 			branches++;
 
 	/* allocate space for underlying pointers to hidden dentry */
-	stopd(sb)->usi_data = kcalloc(branches,
+	UNIONFS_SB(sb)->usi_data = kcalloc(branches,
 			sizeof(struct unionfs_usi_data), GFP_KERNEL);
-	if (!stopd(sb)->usi_data) {
+	if (!UNIONFS_SB(sb)->usi_data) {
 		err = -ENOMEM;
 		goto out;
 	}
@@@@ -339,13 +339,13 @@@@ out:
 			}
 
 		kfree(hidden_root_info->udi_path);
-		kfree(stopd(sb)->usi_data);
+		kfree(UNIONFS_SB(sb)->usi_data);
 
 		/* MUST clear the pointers to prevent potential double free if
 		 * the caller dies later on
 		 */
 		hidden_root_info->udi_path = NULL;
-		stopd(sb)->usi_data = NULL;
+		UNIONFS_SB(sb)->usi_data = NULL;
 	}
 	return err;
 }
@@@@ -453,8 +453,8 @@@@ out_error:
 	kfree(hidden_root_info->udi_path);
 	kfree(hidden_root_info);
 
-	kfree(stopd(sb)->usi_data);
-	stopd(sb)->usi_data = NULL;
+	kfree(UNIONFS_SB(sb)->usi_data);
+	UNIONFS_SB(sb)->usi_data = NULL;
 
 	hidden_root_info = ERR_PTR(err);
 out:
@@@@ -496,15 +496,16 @@@@ static int unionfs_read_super(struct sup
 	/*
 	 * Allocate superblock private data
 	 */
-	stopd_lhs(sb) = kzalloc(sizeof(struct unionfs_sb_info), GFP_KERNEL);
-	if (!stopd(sb)) {
+	sb->s_fs_info = kzalloc(sizeof(struct unionfs_sb_info), GFP_KERNEL);
+	if (!UNIONFS_SB(sb)) {
 		printk(KERN_WARNING "%s: out of memory\n", __FUNCTION__);
 		err = -ENOMEM;
 		goto out;
 	}
-	stopd(sb)->b_end = -1;
-	atomic_set(&stopd(sb)->usi_generation, 1);
-	init_rwsem(&stopd(sb)->usi_rwsem);
+
+	UNIONFS_SB(sb)->b_end = -1;
+	atomic_set(&UNIONFS_SB(sb)->usi_generation, 1);
+	init_rwsem(&UNIONFS_SB(sb)->usi_rwsem);
 
 	hidden_root_info = unionfs_parse_options(sb, raw_data);
 	if (IS_ERR(hidden_root_info)) {
@@@@ -568,7 +569,7 @@@@ static int unionfs_read_super(struct sup
 	set_dbend(sb->s_root, bend);
 
 	/* Set the generation number to one, since this is for the mount. */
-	atomic_set(&dtopd(sb->s_root)->udi_generation, 1);
+	atomic_set(&UNIONFS_D(sb->s_root)->udi_generation, 1);
 
 	/* call interpose to create the upper level inode */
 	if ((err = unionfs_interpose(sb->s_root, sb, 0)))
@@@@ -577,9 +578,9 @@@@ static int unionfs_read_super(struct sup
 	goto out;
 
 out_freedpd:
-	if (dtopd(sb->s_root)) {
+	if (UNIONFS_D(sb->s_root)) {
 		kfree(dtohp_ptr(sb->s_root));
-		free_dentry_private_data(dtopd(sb->s_root));
+		free_dentry_private_data(UNIONFS_D(sb->s_root));
 	}
 	dput(sb->s_root);
 
@@@@ -605,9 +606,9 @@@@ out_dput:
 	}
 
 out_free:
-	kfree(stopd(sb)->usi_data);
-	kfree(stopd(sb));
-	stopd_lhs(sb) = NULL;
+	kfree(UNIONFS_SB(sb)->usi_data);
+	kfree(UNIONFS_SB(sb));
+	sb->s_fs_info = NULL;
 
 out:
 	if (hidden_root_info && !IS_ERR(hidden_root_info)) {
diff -r 3ab2c76610b7 fs/unionfs/rdstate.c
--- a/fs/unionfs/rdstate.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/rdstate.c	Fri Dec 01 00:42:23 2006 -0500
@@@@ -63,8 +63,8 @@@@ static int guesstimate_hash_size(struct 
 	int bindex;
 	int hashsize = MINHASHSIZE;
 
-	if (itopd(inode)->uii_hashsize > 0)
-		return itopd(inode)->uii_hashsize;
+	if (UNIONFS_I(inode)->uii_hashsize > 0)
+		return UNIONFS_I(inode)->uii_hashsize;
 
 	for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {
 		if (!(hidden_inode = itohi_index(inode, bindex)))
@@@@ -84,11 +84,11 @@@@ int init_rdstate(struct file *file)
 int init_rdstate(struct file *file)
 {
 	BUG_ON(sizeof(loff_t) != (sizeof(unsigned int) + sizeof(unsigned int)));
-	BUG_ON(ftopd(file)->rdstate != NULL);
-
-	ftopd(file)->rdstate =
+	BUG_ON(UNIONFS_F(file)->rdstate != NULL);
+
+	UNIONFS_F(file)->rdstate =
 	    alloc_rdstate(file->f_dentry->d_inode, fbstart(file));
-	if (!ftopd(file)->rdstate)
+	if (!UNIONFS_F(file)->rdstate)
 		return -ENOMEM;
 	return 0;
 }
@@@@ -98,18 +98,18 @@@@ struct unionfs_dir_state *find_rdstate(s
 	struct unionfs_dir_state *rdstate = NULL;
 	struct list_head *pos;
 
-	spin_lock(&itopd(inode)->uii_rdlock);
-	list_for_each(pos, &itopd(inode)->uii_readdircache) {
+	spin_lock(&UNIONFS_I(inode)->uii_rdlock);
+	list_for_each(pos, &UNIONFS_I(inode)->uii_readdircache) {
 		struct unionfs_dir_state *r =
 		    list_entry(pos, struct unionfs_dir_state, uds_cache);
 		if (fpos == rdstate2offset(r)) {
-			itopd(inode)->uii_rdcount--;
+			UNIONFS_I(inode)->uii_rdcount--;
 			list_del(&r->uds_cache);
 			rdstate = r;
 			break;
 		}
 	}
-	spin_unlock(&itopd(inode)->uii_rdlock);
+	spin_unlock(&UNIONFS_I(inode)->uii_rdlock);
 	return rdstate;
 }
 
@@@@ -143,14 +143,14 @@@@ struct unionfs_dir_state *alloc_rdstate(
 	if (!rdstate)
 		return NULL;
 
-	spin_lock(&itopd(inode)->uii_rdlock);
-	if (itopd(inode)->uii_cookie >= (MAXRDCOOKIE - 1))
-		itopd(inode)->uii_cookie = 1;
+	spin_lock(&UNIONFS_I(inode)->uii_rdlock);
+	if (UNIONFS_I(inode)->uii_cookie >= (MAXRDCOOKIE - 1))
+		UNIONFS_I(inode)->uii_cookie = 1;
 	else
-		itopd(inode)->uii_cookie++;
-
-	rdstate->uds_cookie = itopd(inode)->uii_cookie;
-	spin_unlock(&itopd(inode)->uii_rdlock);
+		UNIONFS_I(inode)->uii_cookie++;
+
+	rdstate->uds_cookie = UNIONFS_I(inode)->uii_cookie;
+	spin_unlock(&UNIONFS_I(inode)->uii_rdlock);
 	rdstate->uds_offset = 1;
 	rdstate->uds_access = jiffies;
 	rdstate->uds_bindex = bindex;
diff -r 3ab2c76610b7 fs/unionfs/rename.c
--- a/fs/unionfs/rename.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/rename.c	Fri Dec 01 00:42:23 2006 -0500
@@@@ -469,7 +469,7 @@@@ out:
 		/* force re-lookup since the dir on ro branch is not renamed,
 		   and hidden dentries still indicate the un-renamed ones. */
 		if (S_ISDIR(old_dentry->d_inode->i_mode))
-			atomic_dec(&dtopd(old_dentry)->udi_generation);
+			atomic_dec(&UNIONFS_D(old_dentry)->udi_generation);
 	}
 
 	unlock_dentry(new_dentry);
diff -r 3ab2c76610b7 fs/unionfs/super.c
--- a/fs/unionfs/super.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/super.c	Fri Dec 01 01:07:17 2006 -0500
@@@@ -27,25 +27,25 @@@@ static void unionfs_read_inode(struct in
 	static struct address_space_operations unionfs_empty_aops;
 	int size;
 
-	if (!itopd(inode)) {
+	if (!UNIONFS_I(inode)) {
 		printk(KERN_ERR "No kernel memory when allocating inode "
 				"private data!\n");
 		BUG();
 	}
 
-	memset(itopd(inode), 0, sizeof(struct unionfs_inode_info));
-	itopd(inode)->b_start = -1;
-	itopd(inode)->b_end = -1;
-	atomic_set(&itopd(inode)->uii_generation,
-		   atomic_read(&stopd(inode->i_sb)->usi_generation));
-	spin_lock_init(&itopd(inode)->uii_rdlock);
-	itopd(inode)->uii_rdcount = 1;
-	itopd(inode)->uii_hashsize = -1;
-	INIT_LIST_HEAD(&itopd(inode)->uii_readdircache);
+	memset(UNIONFS_I(inode), 0, sizeof(struct unionfs_inode_info));
+	UNIONFS_I(inode)->b_start = -1;
+	UNIONFS_I(inode)->b_end = -1;
+	atomic_set(&UNIONFS_I(inode)->uii_generation,
+		   atomic_read(&UNIONFS_SB(inode->i_sb)->usi_generation));
+	spin_lock_init(&UNIONFS_I(inode)->uii_rdlock);
+	UNIONFS_I(inode)->uii_rdcount = 1;
+	UNIONFS_I(inode)->uii_hashsize = -1;
+	INIT_LIST_HEAD(&UNIONFS_I(inode)->uii_readdircache);
 
 	size = sbmax(inode->i_sb) * sizeof(struct inode *);
-	itohi_ptr(inode) = kzalloc(size, GFP_KERNEL);
-	if (!itohi_ptr(inode)) {
+	UNIONFS_I(inode)->lower_inodes = kzalloc(size, GFP_KERNEL);
+	if (!UNIONFS_I(inode)->lower_inodes) {
 		printk(KERN_ERR "No kernel memory when allocating lower-"
 				"pointer array!\n");
 		BUG();
@@@@ -96,7 +96,7 @@@@ static void unionfs_put_super(struct sup
 	int bindex, bstart, bend;
 	struct unionfs_sb_info *spd;
 
-	spd = stopd(sb);
+	spd = UNIONFS_SB(sb);
 	if (!spd)
 		return;
 		
@@@@ -114,7 +114,7 @@@@ static void unionfs_put_super(struct sup
 
 	kfree(spd->usi_data);
 	kfree(spd);
-	stopd_lhs(sb) = NULL;
+	sb->s_fs_info = NULL;
 }
 
 /* Since people use this to answer the "How big of a file can I write?"
@@@@ -161,7 +161,7 @@@@ static void unionfs_clear_inode(struct i
 	struct list_head *pos, *n;
 	struct unionfs_dir_state *rdstate;
 
-	list_for_each_safe(pos, n, &itopd(inode)->uii_readdircache) {
+	list_for_each_safe(pos, n, &UNIONFS_I(inode)->uii_readdircache) {
 		rdstate = list_entry(pos, struct unionfs_dir_state, uds_cache);
 		list_del(&rdstate->uds_cache);
 		free_rdstate(rdstate);
@@@@ -180,8 +180,8 @@@@ static void unionfs_clear_inode(struct i
 		}
 	}
 
-	kfree(itohi_ptr(inode));
-	itohi_ptr(inode) = NULL;
+	kfree(UNIONFS_I(inode)->lower_inodes);
+	UNIONFS_I(inode)->lower_inodes = NULL;
 }
 
 static struct inode *unionfs_alloc_inode(struct super_block *sb)
@@@@ -201,7 +201,7 @@@@ static struct inode *unionfs_alloc_inode
 
 static void unionfs_destroy_inode(struct inode *inode)
 {
-	kmem_cache_free(unionfs_inode_cachep, itopd(inode));
+	kmem_cache_free(unionfs_inode_cachep, UNIONFS_I(inode));
 }
 
 static void init_once(void *v, struct kmem_cache * cachep, unsigned long flags)
@@@@ -240,17 +240,17 @@@@ static int unionfs_write_inode(struct in
 	struct list_head *pos, *n;
 	struct unionfs_dir_state *rdstate;
 
-	spin_lock(&itopd(inode)->uii_rdlock);
-	list_for_each_safe(pos, n, &itopd(inode)->uii_readdircache) {
+	spin_lock(&UNIONFS_I(inode)->uii_rdlock);
+	list_for_each_safe(pos, n, &UNIONFS_I(inode)->uii_readdircache) {
 		rdstate = list_entry(pos, struct unionfs_dir_state, uds_cache);
 		/* We keep this list in LRU order. */
 		if ((rdstate->uds_access + RDCACHE_JIFFIES) > jiffies)
 			break;
-		itopd(inode)->uii_rdcount--;
+		UNIONFS_I(inode)->uii_rdcount--;
 		list_del(&rdstate->uds_cache);
 		free_rdstate(rdstate);
 	}
-	spin_unlock(&itopd(inode)->uii_rdlock);
+	spin_unlock(&UNIONFS_I(inode)->uii_rdlock);
 
 	return 0;
 }
diff -r 3ab2c76610b7 fs/unionfs/union.h
--- a/fs/unionfs/union.h	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/union.h	Fri Dec 01 00:50:01 2006 -0500
@@@@ -54,7 +54,7 @@@@
 #define UNIONFS_ROOT_INO     1
 
 /* Mount time flags */
-#define MOUNT_FLAG(sb)     (stopd(sb)->usi_mount_flag)
+#define MOUNT_FLAG(sb)     (UNIONFS_SB(sb)->usi_mount_flag)
 
 /* number of characters while generating unique temporary file names */
 #define	UNIONFS_TMPNAM_LEN	12
@@@@ -95,8 +95,10 @@@@ struct unionfs_inode_info {
 	struct list_head uii_readdircache;
 	int uii_rdcount;
 	int uii_hashsize;
-	int uii_cookie; /* The hidden inodes */
-	struct inode **uii_inode;
+	int uii_cookie;
+	
+	/* The hidden inodes */
+	struct inode **lower_inodes;
 	/* to keep track of reads/writes for unlinks before closes */
 	atomic_t uii_totalopens;
 };
@@@@ -205,10 +207,10 @@@@ static inline off_t rdstate2offset(struc
 	return tmp;
 }
 
-#define unionfs_read_lock(sb) down_read(&stopd(sb)->usi_rwsem)
-#define unionfs_read_unlock(sb) up_read(&stopd(sb)->usi_rwsem)
-#define unionfs_write_lock(sb) down_write(&stopd(sb)->usi_rwsem)
-#define unionfs_write_unlock(sb) up_write(&stopd(sb)->usi_rwsem)
+#define unionfs_read_lock(sb) down_read(&UNIONFS_SB(sb)->usi_rwsem)
+#define unionfs_read_unlock(sb) up_read(&UNIONFS_SB(sb)->usi_rwsem)
+#define unionfs_write_lock(sb) down_write(&UNIONFS_SB(sb)->usi_rwsem)
+#define unionfs_write_unlock(sb) up_write(&UNIONFS_SB(sb)->usi_rwsem)
 
 /* The double lock function needs to go after the debugmacros, so that
  * dtopd is defined.  */
@@@@ -392,13 +394,13 @@@@ static inline int branchperms(struct sup
 {
 	BUG_ON(index < 0);
 
-	return stopd(sb)->usi_data[index].branchperms;
+	return UNIONFS_SB(sb)->usi_data[index].branchperms;
 }
 static inline int set_branchperms(struct super_block *sb, int index, int perms)
 {
 	BUG_ON(index < 0);
 
-	stopd(sb)->usi_data[index].branchperms = perms;
+	UNIONFS_SB(sb)->usi_data[index].branchperms = perms;
 
 	return perms;
 }
@@@@ -426,7 +428,7 @@@@ static inline int __is_robranch_index(st
 
 	BUG_ON(index < 0);
 
-	perms = stopd(dentry->d_sb)->usi_data[index].branchperms;
+	perms = UNIONFS_SB(dentry->d_sb)->usi_data[index].branchperms;
 
 	if ((!(perms & MAY_WRITE))
 	    || (IS_RDONLY(dtohd_index(dentry, index)->d_inode)))
@@@@ -440,7 +442,7 @@@@ static inline int __is_robranch(struct d
 	int index;
 	int err;
 
-	index = dtopd(dentry)->udi_bstart;
+	index = UNIONFS_D(dentry)->udi_bstart;
 	BUG_ON(index < 0);
 
 	err = __is_robranch_index(dentry, index, file, function, line);
@


1.1.2.2
log
@More macro removal
@
text
@d20 2
a21 29
+++ b/fs/unionfs/commonfops.c	Fri Dec 01 02:06:51 2006 -0500
@@@@ -78,9 +78,12 @@@@ static void cleanup_file(struct file *fi
 static void cleanup_file(struct file *file, struct dentry *dentry)
 {
 	int bindex, bstart, bend;
-
+	struct file **lf;
+
+	lf = UNIONFS_F(file)->lower_files;
 	bstart = fbstart(file);
 	bend = fbend(file);
+
 	for (bindex = bstart; bindex <= bend; bindex++) {
 		if (ftohf_index(file, bindex)) {
 			branchput(dentry->d_sb, bindex);
@@@@ -88,9 +91,9 @@@@ static void cleanup_file(struct file *fi
 		}
 	}
 
-	if (ftohf_ptr(file)) {
-		kfree(ftohf_ptr(file));
-		ftohf_ptr(file) = NULL;
+	if (lf) {
+		kfree(lf);
+		UNIONFS_F(file)->lower_files = NULL;
 	}
 }
 
@@@@ -148,8 +151,8 @@@@ static int open_highest_file(struct file
d32 1
a32 1
@@@@ -226,9 +229,9 @@@@ int unionfs_file_revalidate(struct file 
d45 1
a45 12
@@@@ -246,8 +249,8 @@@@ int unionfs_file_revalidate(struct file 
 		bend = fbend(file) = dbend(dentry);
 
 		size = sizeof(struct file *) * sbmax(sb);
-		ftohf_ptr(file) = kzalloc(size, GFP_KERNEL);
-		if (!ftohf_ptr(file)) {
+		UNIONFS_F(file)->lower_files = kzalloc(size, GFP_KERNEL);
+		if (!UNIONFS_F(file)->lower_files) {
 			err = -ENOMEM;
 			goto out;
 		}
@@@@ -263,8 +266,8 @@@@ int unionfs_file_revalidate(struct file 
d56 1
a56 1
@@@@ -376,19 +379,19 @@@@ int unionfs_open(struct inode *inode, st
d75 2
a76 8
-	ftohf_ptr(file) = kzalloc(size, GFP_KERNEL);
-	if (!ftohf_ptr(file)) {
+	UNIONFS_F(file)->lower_files = kzalloc(size, GFP_KERNEL);
+	if (!UNIONFS_F(file)->lower_files) {
 		err = -ENOMEM;
 		goto out;
 	}
@@@@ -401,7 +404,7 @@@@ int unionfs_open(struct inode *inode, st
d85 1
a85 2
@@@@ -427,8 +430,8 @@@@ int unionfs_open(struct inode *inode, st
 
d88 1
a88 1
-		kfree(ftohf_ptr(file));
a89 1
+		kfree(UNIONFS_F(file)->lower_files);
d94 1
a94 1
@@@@ -441,7 +444,7 @@@@ int unionfs_file_release(struct inode *i
d103 1
a103 3
@@@@ -455,23 +458,23 @@@@ int unionfs_file_release(struct inode *i
 			unionfs_read_unlock(inode->i_sb);
 		}
d105 2
a106 2
-	kfree(ftohf_ptr(file));
-
a108 2
+	kfree(UNIONFS_F(file)->lower_files);
+
d138 1
a138 1
@@@@ -540,7 +543,7 @@@@ int unionfs_flush(struct file *file, fl_
d149 1
a149 1
+++ b/fs/unionfs/dentry.c	Fri Dec 01 02:26:33 2006 -0500
d208 1
a208 8
@@@@ -224,13 +224,13 @@@@ void unionfs_d_release(struct dentry *de
 		set_dtohm_index(dentry, bindex, NULL);
 	}
 	/* free private data (unionfs_dentry_info) here */
-	kfree(dtohp_ptr(dentry));
-	dtohp_ptr(dentry) = NULL;
+	kfree(UNIONFS_D(dentry)->lower_paths);
+	UNIONFS_D(dentry)->lower_paths = NULL;
a212 1
-	dtopd_lhs(dentry) = NULL;	/* just to be safe */
d214 1
a214 1
+	dentry->d_fsdata = NULL;	/* just to be safe */
a216 1
 	return;
d283 2
a284 2
+++ b/fs/unionfs/fanout.h	Fri Dec 01 02:30:23 2006 -0500
@@@@ -19,141 +19,135 @@@@
d319 1
d327 1
a327 1
+	return UNIONFS_F(f)->lower_files[fbstart(f)];
d333 1
a333 1
+	return UNIONFS_F(f)->lower_files[index];
d339 1
a339 1
+	UNIONFS_F(f)->lower_files[index] = val;
d345 1
a345 1
+	UNIONFS_F(f)->lower_files[fbstart(f)] = val;
d432 1
a432 1
-#define dtopd_lhs(dent) ((dent)->d_fsdata)
d451 1
a451 1
+	UNIONFS_D(dent)->lower_paths[index].dentry = val;
d457 1
a457 1
+	return UNIONFS_D(dent)->lower_paths[index].dentry;
d461 1
a461 1
@@@@ -164,12 +158,12 @@@@ static inline void set_dtohm_index(struc
d466 1
a466 1
+	UNIONFS_D(dent)->lower_paths[index].mnt = mnt;
d472 1
a472 1
+	return UNIONFS_D(dent)->lower_paths[index].mnt;
d476 1
a476 1
@@@@ -177,14 +171,9 @@@@ static inline struct vfsmount *dtohm(con
d482 3
a484 1
-
d486 2
a487 1
-
d498 1
a498 1
+++ b/fs/unionfs/lookup.c	Fri Dec 01 02:29:19 2006 -0500
d517 1
a517 9
@@@@ -306,14 +306,14 @@@@ out_free:
 			mntput(dtohm_index(dentry, bindex));
 		}
 	}
-	kfree(dtohp_ptr(dentry));
-	dtohp_ptr(dentry) = NULL;
+	kfree(UNIONFS_D(dentry)->lower_paths);
+	UNIONFS_D(dentry)->lower_paths = NULL;
 	set_dbstart(dentry, -1);
a532 1
-		dtopd_lhs(dentry) = (struct unionfs_dentry_info *)
d534 1
a534 1
+		dentry->d_fsdata = (struct unionfs_dentry_info *)
a539 2
-
-		dtohp_ptr(dentry) = NULL;
d541 2
a542 2
+
+		UNIONFS_D(dentry)->lower_paths = NULL;
d563 2
a564 32
@@@@ -452,28 +452,28 @@@@ int new_dentry_private_data(struct dentr
 		int minsize = malloc_sizes[0].cs_size;
 
 		if (!newsize || ((oldsize < newsize) && (newsize > minsize))) {
-			kfree(dtohp_ptr(dentry));
-			dtohp_ptr(dentry) = NULL;
-		}
-	}
-
-	if (!dtohp_ptr(dentry) && newsize) {
-		dtohp_ptr(dentry) = kmalloc(newsize, GFP_ATOMIC);
-		if (!dtohp_ptr(dentry))
+			kfree(UNIONFS_D(dentry)->lower_paths);
+			UNIONFS_D(dentry)->lower_paths = NULL;
+		}
+	}
+
+	if (!UNIONFS_D(dentry)->lower_paths && newsize) {
+		UNIONFS_D(dentry)->lower_paths = kmalloc(newsize, GFP_ATOMIC);
+		if (!UNIONFS_D(dentry)->lower_paths)
 			goto out_free;
 	}
 
-	memset(dtohp_ptr(dentry), 0, (oldsize > newsize ? oldsize : newsize));
+	memset(UNIONFS_D(dentry)->lower_paths, 0, (oldsize > newsize ? oldsize : newsize));
 
 	spin_unlock(&dentry->d_lock);
 	return 0;
 
 out_free:
-	kfree(dtohp_ptr(dentry));
+	kfree(UNIONFS_D(dentry)->lower_paths);
a567 1
-	dtopd_lhs(dentry) = NULL;
d569 1
a569 1
+	dentry->d_fsdata = NULL;
a571 1
 }
d574 1
a574 1
+++ b/fs/unionfs/main.c	Fri Dec 01 02:33:57 2006 -0500
d597 1
a597 1
@@@@ -251,16 +251,16 @@@@ static int parse_dirs_option(struct supe
d609 1
a609 41
 
-	hidden_root_info->udi_path = kcalloc(branches,
+	hidden_root_info->lower_paths = kcalloc(branches,
 			sizeof(struct path), GFP_KERNEL);
-	if (!hidden_root_info->udi_path) {
+	if (!hidden_root_info->lower_paths) {
 		err = -ENOMEM;
 		goto out;
 	}
@@@@ -296,8 +296,8 @@@@ static int parse_dirs_option(struct supe
 			goto out;
 		}
 
-		hidden_root_info->udi_path[bindex].dentry = nd.dentry;
-		hidden_root_info->udi_path[bindex].mnt = nd.mnt;
+		hidden_root_info->lower_paths[bindex].dentry = nd.dentry;
+		hidden_root_info->lower_paths[bindex].mnt = nd.mnt;
 
 		set_branchperms(sb, bindex, perms);
 		set_branch_count(sb, bindex, 0);
@@@@ -319,8 +319,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_path[i].dentry;
-			dent2 = hidden_root_info->udi_path[j].dentry;
+			dent1 = hidden_root_info->lower_paths[i].dentry;
+			dent2 = hidden_root_info->lower_paths[j].dentry;
 
 			if (is_branch_overlap(dent1, dent2)) {
 				printk(KERN_WARNING "unionfs: branches %d and %d overlap\n", i, j);
@@@@ -333,19 +333,19 @@@@ out:
 out:
 	if (err) {
 		for (i = 0; i < branches; 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);
+			if (hidden_root_info->lower_paths[i].dentry) {
+				dput(hidden_root_info->lower_paths[i].dentry);
+				mntput(hidden_root_info->lower_paths[i].mnt);
d612 1
a612 1
-		kfree(hidden_root_info->udi_path);
a613 1
+		kfree(hidden_root_info->lower_paths);
d619 1
a619 1
-		hidden_root_info->udi_path = NULL;
a620 1
+		hidden_root_info->lower_paths = NULL;
d625 2
a626 25
@@@@ -433,15 +433,15 @@@@ static struct unionfs_dentry_info *union
 	goto out;
 
 out_error:
-	if (hidden_root_info && hidden_root_info->udi_path) {
+	if (hidden_root_info && hidden_root_info->lower_paths) {
 		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_path[bindex].dentry;
-			m = hidden_root_info->udi_path[bindex].mnt;
+			d = hidden_root_info->lower_paths[bindex].dentry;
+			m = hidden_root_info->lower_paths[bindex].mnt;
 
 			dput(d);
 
@@@@ -450,11 +450,11 @@@@ out_error:
 		}
 	}
 
-	kfree(hidden_root_info->udi_path);
+	kfree(hidden_root_info->lower_paths);
a657 29
@@@@ -527,7 +528,7 @@@@ static int unionfs_read_super(struct sup
 	for (bindex = bstart; bindex <= bend; bindex++) {
 		struct dentry *d;
 
-		d = hidden_root_info->udi_path[bindex].dentry;
+		d = hidden_root_info->lower_paths[bindex].dentry;
 
 		set_stohs_index(sb, bindex, d->d_sb);
 	}
@@@@ -549,7 +550,7 @@@@ static int unionfs_read_super(struct sup
 	}
 
 	/* link the upper and lower dentries */
-	dtopd_lhs(sb->s_root) = NULL;
+	sb->s_root->d_fsdata = NULL;
 	if ((err = new_dentry_private_data(sb->s_root)))
 		goto out_freedpd;
 
@@@@ -558,8 +559,8 @@@@ static int unionfs_read_super(struct sup
 		struct dentry *d;
 		struct vfsmount *m;
 
-		d = hidden_root_info->udi_path[bindex].dentry;
-		m = hidden_root_info->udi_path[bindex].mnt;
+		d = hidden_root_info->lower_paths[bindex].dentry;
+		m = hidden_root_info->lower_paths[bindex].mnt;
 
 		set_dtohd_index(sb->s_root, bindex, d);
 		set_dtohm_index(sb->s_root, bindex, m);
d672 2
a673 1
-		kfree(dtohp_ptr(sb->s_root));
a674 2
+	if (UNIONFS_D(sb->s_root)) {
+		kfree(UNIONFS_D(sb->s_root)->lower_paths);
d679 1
a679 19
@@@@ -590,8 +591,8 @@@@ out_dput:
 			struct dentry *d;
 			struct vfsmount *m;
 
-			d = hidden_root_info->udi_path[bindex].dentry;
-			m = hidden_root_info->udi_path[bindex].mnt;
+			d = hidden_root_info->lower_paths[bindex].dentry;
+			m = hidden_root_info->lower_paths[bindex].mnt;
 
 			if (d)
 				dput(d);
@@@@ -599,19 +600,19 @@@@ out_dput:
 			if (m)
 				mntput(m);
 		}
-		kfree(hidden_root_info->udi_path);
+		kfree(hidden_root_info->lower_paths);
 		kfree(hidden_root_info);
 		hidden_root_info = NULL;
a691 5
-		kfree(hidden_root_info->udi_path);
+		kfree(hidden_root_info->lower_paths);
 		kfree(hidden_root_info);
 	}
 	return err;
d891 1
a891 1
+++ b/fs/unionfs/union.h	Fri Dec 01 02:29:47 2006 -0500
a900 9
@@@@ -81,7 +81,7 @@@@ struct unionfs_file_info {
 	atomic_t ufi_generation;
 
 	struct unionfs_dir_state *rdstate;
-	struct file **ufi_file;
+	struct file **lower_files;
 };
 
 /* unionfs inode data in memory */
a913 9
@@@@ -117,7 +119,7 @@@@ struct unionfs_dentry_info {
 	int udi_bopaque;
 	int udi_bcount;
 	atomic_t udi_generation;
-	struct path *udi_path;
+	struct path *lower_paths;
 };
 
 /* These are the pointers to our various objects. */
@


1.1.2.3
log
@Removed useless prefixes in unionfs object structs
@
text
@d3 1
a3 1
+++ b/fs/unionfs/branchman.c	Fri Dec 01 04:28:03 2006 -0500
d9 1
a9 1
+	gen = atomic_inc_return(&UNIONFS_SB(sb)->generation);
d13 2
a14 2
+	atomic_set(&UNIONFS_D(sb->s_root)->generation, gen);
+	atomic_set(&UNIONFS_I(sb->s_root->d_inode)->generation, gen);
d20 1
a20 1
+++ b/fs/unionfs/commonfops.c	Fri Dec 01 04:28:03 2006 -0500
d54 2
a55 2
+		atomic_set(&UNIONFS_F(file)->generation,
+			atomic_read(&UNIONFS_I(dentry->d_inode)->generation));
d66 3
a68 3
+	sbgen = atomic_read(&UNIONFS_SB(sb)->generation);
+	dgen = atomic_read(&UNIONFS_D(dentry)->generation);
+	fgen = atomic_read(&UNIONFS_F(file)->generation);
d83 1
a83 1
@@@@ -263,9 +266,9 @@@@ int unionfs_file_revalidate(struct file 
d89 1
a89 2
-				       uii_generation));
+		atomic_set(&UNIONFS_F(file)->generation,
d91 1
a91 1
+				       generation));
a93 1
 	/* Copyup on the first write to a file on a readonly branch. */
d109 2
a110 2
+	atomic_set(&UNIONFS_F(file)->generation,
+		   atomic_read(&UNIONFS_I(inode)->generation));
d125 1
a125 1
+	atomic_inc(&UNIONFS_I(dentry->d_inode)->totalopens);
d145 1
a145 1
+	fgen = atomic_read(&UNIONFS_F(file)->generation);
d160 1
a160 1
+		UNIONFS_F(file)->rdstate->access = jiffies;
d169 7
a175 7
+		       UNIONFS_F(file)->rdstate->cookie,
+		       UNIONFS_F(file)->rdstate->bindex,
+		       (long long)UNIONFS_F(file)->rdstate->dirpos);
+		spin_lock(&UNIONFS_I(inode)->rdlock);
+		UNIONFS_I(inode)->rdcount++;
+		list_add_tail(&UNIONFS_F(file)->rdstate->cache,
+			      &UNIONFS_I(inode)->readdircache);
d181 1
a181 1
+		spin_unlock(&UNIONFS_I(inode)->rdlock);
d193 1
a193 1
+	    (&UNIONFS_I(file->f_dentry->d_inode)->totalopens))
d199 1
a199 1
+++ b/fs/unionfs/dentry.c	Fri Dec 01 04:28:03 2006 -0500
d206 2
a207 2
+	dgen = atomic_read(&UNIONFS_D(dentry)->generation);
+	sbgen = atomic_read(&UNIONFS_SB(dentry->d_sb)->generation);
d216 1
a216 1
+		pdgen = atomic_read(&UNIONFS_D(dentry->d_parent)->generation);
d245 1
a245 1
+		if (positive && UNIONFS_I(dentry->d_inode)->stale) {
d278 1
a278 30
+++ b/fs/unionfs/dirfops.c	Fri Dec 01 04:28:03 2006 -0500
@@@@ -21,8 +21,8 @@@@
 /* Make sure our rdstate is playing by the rules. */
 static void verify_rdstate_offset(struct unionfs_dir_state *rdstate)
 {
-	BUG_ON(rdstate->uds_offset >= DIREOF);
-	BUG_ON(rdstate->uds_cookie >= MAXRDCOOKIE);
+	BUG_ON(rdstate->offset >= DIREOF);
+	BUG_ON(rdstate->cookie >= MAXRDCOOKIE);
 }
 
 struct unionfs_getdents_callback {
@@@@ -65,7 +65,7 @@@@ static int unionfs_filldir(void *dirent,
 		if (!err) {
 			err = buf->filldir(buf->dirent, name, namelen, pos,
 					   unionfs_ino, d_type);
-			buf->rdstate->uds_offset++;
+			buf->rdstate->offset++;
 			verify_rdstate_offset(buf->rdstate);
 		}
 	}
@@@@ -76,7 +76,7 @@@@ static int unionfs_filldir(void *dirent,
 	}
 	buf->entries_written++;
 	if ((err = add_filldir_node(buf->rdstate, name, namelen,
-				    buf->rdstate->uds_bindex, is_wh_entry)))
+				    buf->rdstate->bindex, is_wh_entry)))
 		buf->filldir_error = err;
 
 out:
d288 1
a288 1
@@@@ -108,19 +108,19 @@@@ static int unionfs_readdir(struct file *
d301 1
d303 1
a303 46
-	while (uds->uds_bindex <= bend) {
-		hidden_file = ftohf_index(file, uds->uds_bindex);
+	while (uds->bindex <= bend) {
+		hidden_file = ftohf_index(file, uds->bindex);
 		if (!hidden_file) {
-			uds->uds_bindex++;
-			uds->uds_dirpos = 0;
+			uds->bindex++;
+			uds->dirpos = 0;
 			continue;
 		}
 
@@@@ -134,7 +134,7 @@@@ static int unionfs_readdir(struct file *
 		buf.sb = inode->i_sb;
 
 		/* Read starting from where we last left off. */
-		offset = vfs_llseek(hidden_file, uds->uds_dirpos, 0);
+		offset = vfs_llseek(hidden_file, uds->dirpos, 0);
 		if (offset < 0) {
 			err = offset;
 			goto out;
@@@@ -147,7 +147,7 @@@@ static int unionfs_readdir(struct file *
 			err = offset;
 			goto out;
 		}
-		uds->uds_dirpos = offset;
+		uds->dirpos = offset;
 
 		/* Copy the atime. */
 		fsstack_copy_attr_atime(inode, hidden_file->f_dentry->d_inode);
@@@@ -159,16 +159,16 @@@@ static int unionfs_readdir(struct file *
 			break;
 
 		if (!buf.entries_written) {
-			uds->uds_bindex++;
-			uds->uds_dirpos = 0;
-		}
-	}
-
-	if (!buf.filldir_error && uds->uds_bindex >= bend) {
+			uds->bindex++;
+			uds->dirpos = 0;
+		}
+	}
+
+	if (!buf.filldir_error && uds->bindex >= bend) {
d306 1
a306 1
+		UNIONFS_I(inode)->hashsize = uds->hashentries;
d331 1
a331 1
@@@@ -230,8 +230,8 @@@@ static loff_t unionfs_dir_llseek(struct 
a335 1
-					err = rdstate->uds_offset;
d337 1
a337 1
+					err = rdstate->offset;
a339 1
 			}
d342 1
a342 1
+++ b/fs/unionfs/fanout.h	Fri Dec 01 04:28:03 2006 -0500
d358 2
a359 2
+#define ibstart(ino) (UNIONFS_I(ino)->bstart)
+#define ibend(ino) (UNIONFS_I(ino)->bend)
d368 2
a369 2
+#define sbend(sb) UNIONFS_SB(sb)->bend
+#define sbmax(sb) (UNIONFS_SB(sb)->bend + 1)
d378 2
a379 2
+#define fbstart(file) (UNIONFS_F(file)->bstart)
+#define fbend(file) (UNIONFS_F(file)->bend)
d436 1
a436 1
+	return UNIONFS_SB(o)->data[sbstart(o)].sb;
d442 1
a442 1
+	return UNIONFS_SB(o)->data[index].sb;
d449 1
a449 1
+	UNIONFS_SB(o)->data[index].sb = val;
d455 1
a455 1
+	UNIONFS_SB(o)->data[sbstart(o)].sb = val;
d462 1
a462 1
+	return atomic_read(&UNIONFS_SB(o)->data[index].sbcount);
d468 1
a468 1
+	atomic_set(&UNIONFS_SB(o)->data[index].sbcount, val);
d474 1
a474 1
+	atomic_inc(&UNIONFS_SB(o)->data[index].sbcount);
d480 1
a480 1
+	atomic_dec(&UNIONFS_SB(o)->data[index].sbcount);
d498 6
a503 6
+#define dbstart(dent) (UNIONFS_D(dent)->bstart)
+#define set_dbstart(dent, val) do { UNIONFS_D(dent)->bstart = val; } while(0)
+#define dbend(dent) (UNIONFS_D(dent)->bend)
+#define set_dbend(dent, val) do { UNIONFS_D(dent)->bend = val; } while(0)
+#define dbopaque(dent) (UNIONFS_D(dent)->bopaque)
+#define set_dbopaque(dent, val) do { UNIONFS_D(dent)->bopaque = val; } while (0)
d546 2
a547 2
+#define lock_dentry(d) down(&UNIONFS_D(d)->sem)
+#define unlock_dentry(d) up(&UNIONFS_D(d)->sem)
d553 1
a553 1
+++ b/fs/unionfs/lookup.c	Fri Dec 01 04:28:03 2006 -0500
d568 1
a568 1
+			UNIONFS_I(dentry->d_inode)->stale = 1;
d587 1
a587 1
+		BUG_ON(dbend(dentry) > UNIONFS_D(dentry)->bcount);
d606 1
a606 1
+		init_MUTEX_LOCKED(&UNIONFS_D(dentry)->sem);
d618 1
a618 1
+		oldsize = sizeof(struct path) * UNIONFS_D(dentry)->bcount;
d620 6
a625 6
+	UNIONFS_D(dentry)->bstart = -1;
+	UNIONFS_D(dentry)->bend = -1;
+	UNIONFS_D(dentry)->bopaque = -1;
+	UNIONFS_D(dentry)->bcount = sbmax(dentry->d_sb);
+	atomic_set(&UNIONFS_D(dentry)->generation,
+		   atomic_read(&UNIONFS_SB(dentry->d_sb)->generation));
d672 1
a672 1
+++ b/fs/unionfs/main.c	Fri Dec 01 04:28:03 2006 -0500
d683 4
a686 4
+		UNIONFS_I(inode)->bstart = -1;
+		UNIONFS_I(inode)->bend = -1;
+		atomic_set(&UNIONFS_I(inode)->generation,
+			   atomic_read(&UNIONFS_SB(sb)->generation));
d700 2
a701 1
-			sizeof(struct unionfs_usi_data), GFP_KERNEL);
d703 1
a703 3
+	UNIONFS_SB(sb)->data = kcalloc(branches,
+			sizeof(struct unionfs_data), GFP_KERNEL);
+	if (!UNIONFS_SB(sb)->data) {
d716 1
a716 1
@@@@ -296,15 +296,15 @@@@ static int parse_dirs_option(struct supe
d727 1
a727 17
 
-		if (hidden_root_info->udi_bstart < 0)
-			hidden_root_info->udi_bstart = bindex;
-		hidden_root_info->udi_bend = bindex;
+		if (hidden_root_info->bstart < 0)
+			hidden_root_info->bstart = bindex;
+		hidden_root_info->bend = bindex;
 		bindex++;
 	}
 
@@@@ -314,13 +314,13 @@@@ static int parse_dirs_option(struct supe
 		goto out;
 	}
 
-	BUG_ON(branches != (hidden_root_info->udi_bend + 1));
+	BUG_ON(branches != (hidden_root_info->bend + 1));
 
d753 1
a753 1
+		kfree(UNIONFS_SB(sb)->data);
d761 1
a761 1
+		UNIONFS_SB(sb)->data = NULL;
a764 13
@@@@ -373,9 +373,9 @@@@ static struct unionfs_dentry_info *union
 	    kzalloc(sizeof(struct unionfs_dentry_info), GFP_KERNEL);
 	if (!hidden_root_info)
 		goto out_error;
-	hidden_root_info->udi_bstart = -1;
-	hidden_root_info->udi_bend = -1;
-	hidden_root_info->udi_bopaque = -1;
+	hidden_root_info->bstart = -1;
+	hidden_root_info->bend = -1;
+	hidden_root_info->bopaque = -1;
 
 	while ((optname = strsep(&options, ",")) != NULL) {
 		char *optarg;
a769 2
-		for (bindex = hidden_root_info->udi_bstart;
-		     bindex >= 0 && bindex <= hidden_root_info->udi_bend;
d771 2
a772 2
+		for (bindex = hidden_root_info->bstart;
+		     bindex >= 0 && bindex <= hidden_root_info->bend;
d794 2
a795 2
+	kfree(UNIONFS_SB(sb)->data);
+	UNIONFS_SB(sb)->data = NULL;
d815 3
a817 3
+	UNIONFS_SB(sb)->bend = -1;
+	atomic_set(&UNIONFS_SB(sb)->generation, 1);
+	init_rwsem(&UNIONFS_SB(sb)->rwsem);
d821 1
a821 16
@@@@ -515,19 +516,19 @@@@ static int unionfs_read_super(struct sup
 		hidden_root_info = NULL;
 		goto out_free;
 	}
-	if (hidden_root_info->udi_bstart == -1) {
+	if (hidden_root_info->bstart == -1) {
 		err = -ENOENT;
 		goto out_free;
 	}
 
 	/* set the hidden superblock field of upper superblock */
-	bstart = hidden_root_info->udi_bstart;
+	bstart = hidden_root_info->bstart;
 	BUG_ON(bstart != 0);
-	sbend(sb) = bend = hidden_root_info->udi_bend;
+	sbend(sb) = bend = hidden_root_info->bend;
d855 1
a855 1
+	atomic_set(&UNIONFS_D(sb->s_root)->generation, 1);
d859 1
a859 1
@@@@ -577,21 +578,21 @@@@ static int unionfs_read_super(struct sup
d872 1
a872 6
 out_dput:
 	if (hidden_root_info && !IS_ERR(hidden_root_info)) {
-		for (bindex = hidden_root_info->udi_bstart;
-		     bindex <= hidden_root_info->udi_bend; bindex++) {
+		for (bindex = hidden_root_info->bstart;
+		     bindex <= hidden_root_info->bend; bindex++) {
d897 1
a897 1
+	kfree(UNIONFS_SB(sb)->data);
d910 1
a910 1
+++ b/fs/unionfs/rdstate.c	Fri Dec 01 04:28:03 2006 -0500
d917 2
a918 2
+	if (UNIONFS_I(inode)->hashsize > 0)
+		return UNIONFS_I(inode)->hashsize;
d944 2
a945 2
+	spin_lock(&UNIONFS_I(inode)->rdlock);
+	list_for_each(pos, &UNIONFS_I(inode)->readdircache) {
d947 1
a947 2
-		    list_entry(pos, struct unionfs_dir_state, uds_cache);
+		    list_entry(pos, struct unionfs_dir_state, cache);
d950 2
a951 3
-			list_del(&r->uds_cache);
+			UNIONFS_I(inode)->rdcount--;
+			list_del(&r->cache);
d957 1
a957 1
+	spin_unlock(&UNIONFS_I(inode)->rdlock);
d961 1
a961 1
@@@@ -143,22 +143,22 @@@@ struct unionfs_dir_state *alloc_rdstate(
d968 3
a970 3
+	spin_lock(&UNIONFS_I(inode)->rdlock);
+	if (UNIONFS_I(inode)->cookie >= (MAXRDCOOKIE - 1))
+		UNIONFS_I(inode)->cookie = 1;
d976 1
a976 42
-	rdstate->uds_offset = 1;
-	rdstate->uds_access = jiffies;
-	rdstate->uds_bindex = bindex;
-	rdstate->uds_dirpos = 0;
-	rdstate->uds_hashentries = 0;
-	rdstate->uds_size = hashsize;
-	for (i = 0; i < rdstate->uds_size; i++)
-		INIT_LIST_HEAD(&rdstate->uds_list[i]);
+		UNIONFS_I(inode)->cookie++;
+
+	rdstate->cookie = UNIONFS_I(inode)->cookie;
+	spin_unlock(&UNIONFS_I(inode)->rdlock);
+	rdstate->offset = 1;
+	rdstate->access = jiffies;
+	rdstate->bindex = bindex;
+	rdstate->dirpos = 0;
+	rdstate->hashentries = 0;
+	rdstate->size = hashsize;
+	for (i = 0; i < rdstate->size; i++)
+		INIT_LIST_HEAD(&rdstate->list[i]);
 
 	return rdstate;
 }
@@@@ -175,8 +175,8 @@@@ void free_rdstate(struct unionfs_dir_sta
 	struct filldir_node *tmp;
 	int i;
 
-	for (i = 0; i < state->uds_size; i++) {
-		struct list_head *head = &(state->uds_list[i]);
+	for (i = 0; i < state->size; i++) {
+		struct list_head *head = &(state->list[i]);
 		struct list_head *pos, *n;
 
 		/* traverse the list and deallocate space */
@@@@ -203,9 +203,9 @@@@ struct filldir_node *find_filldir_node(s
 	BUG_ON(namelen <= 0);
 
 	hash = full_name_hash(name, namelen);
-	index = hash % rdstate->uds_size;
-
-	head = &(rdstate->uds_list[index]);
+	index = hash % rdstate->size;
d978 5
a982 37
+	head = &(rdstate->list[index]);
 	list_for_each(pos, head) {
 		cursor = list_entry(pos, struct filldir_node, file_list);
 
@@@@ -214,10 +214,10 @@@@ struct filldir_node *find_filldir_node(s
 			/* a duplicate exists, and hence no need to create entry to the list */
 			found = 1;
 			/* if the duplicate is in this branch, then the file system is corrupted. */
-			if (cursor->bindex == rdstate->uds_bindex) {
+			if (cursor->bindex == rdstate->bindex) {
 				printk(KERN_DEBUG
 				       "Possible I/O error unionfs_filldir: a file is duplicated in the same branch %d: %s\n",
-				       rdstate->uds_bindex, cursor->name);
+				       rdstate->bindex, cursor->name);
 			}
 			break;
 		}
@@@@ -256,8 +256,8 @@@@ int add_filldir_node(struct unionfs_dir_
 	BUG_ON(namelen <= 0);
 
 	hash = full_name_hash(name, namelen);
-	index = hash % rdstate->uds_size;
-	head = &(rdstate->uds_list[index]);
+	index = hash % rdstate->size;
+	head = &(rdstate->list[index]);
 
 	new = alloc_filldir_node(name, namelen, hash, bindex);
 	if (!new) {
@@@@ -285,7 +285,7 @@@@ int add_filldir_node(struct unionfs_dir_
 	memcpy(new->name, name, namelen);
 	new->name[namelen] = '\0';
 
-	rdstate->uds_hashentries++;
+	rdstate->hashentries++;
 
 	list_add(&(new->file_list), head);
 out:
d985 1
a985 1
+++ b/fs/unionfs/rename.c	Fri Dec 01 04:28:03 2006 -0500
d991 1
a991 1
+			atomic_dec(&UNIONFS_D(old_dentry)->generation);
d997 1
a997 1
+++ b/fs/unionfs/super.c	Fri Dec 01 04:28:03 2006 -0500
d1019 8
a1026 8
+	UNIONFS_I(inode)->bstart = -1;
+	UNIONFS_I(inode)->bend = -1;
+	atomic_set(&UNIONFS_I(inode)->generation,
+		   atomic_read(&UNIONFS_SB(inode->i_sb)->generation));
+	spin_lock_init(&UNIONFS_I(inode)->rdlock);
+	UNIONFS_I(inode)->rdcount = 1;
+	UNIONFS_I(inode)->hashsize = -1;
+	INIT_LIST_HEAD(&UNIONFS_I(inode)->readdircache);
d1045 1
a1045 3
@@@@ -112,9 +112,9 @@@@ static void unionfs_put_super(struct sup
 	for (bindex = bstart; bindex <= bend; bindex++)
 		BUG_ON(branch_count(sb, bindex) != 0);
d1047 1
a1047 2
-	kfree(spd->usi_data);
+	kfree(spd->data);
d1054 1
a1054 1
@@@@ -161,9 +161,9 @@@@ static void unionfs_clear_inode(struct i
d1059 3
a1061 5
-		rdstate = list_entry(pos, struct unionfs_dir_state, uds_cache);
-		list_del(&rdstate->uds_cache);
+	list_for_each_safe(pos, n, &UNIONFS_I(inode)->readdircache) {
+		rdstate = list_entry(pos, struct unionfs_dir_state, cache);
+		list_del(&rdstate->cache);
a1062 2
 	}
 
d1089 3
a1091 4
-		rdstate = list_entry(pos, struct unionfs_dir_state, uds_cache);
+	spin_lock(&UNIONFS_I(inode)->rdlock);
+	list_for_each_safe(pos, n, &UNIONFS_I(inode)->readdircache) {
+		rdstate = list_entry(pos, struct unionfs_dir_state, cache);
d1093 1
a1093 2
-		if ((rdstate->uds_access + RDCACHE_JIFFIES) > jiffies)
+		if ((rdstate->access + RDCACHE_JIFFIES) > jiffies)
d1096 2
a1097 3
-		list_del(&rdstate->uds_cache);
+		UNIONFS_I(inode)->rdcount--;
+		list_del(&rdstate->cache);
d1101 1
a1101 1
+	spin_unlock(&UNIONFS_I(inode)->rdlock);
d1107 1
a1107 1
+++ b/fs/unionfs/union.h	Fri Dec 01 04:28:03 2006 -0500
d1113 1
a1113 1
+#define MOUNT_FLAG(sb)     (UNIONFS_SB(sb)->mount_flag)
d1117 2
a1118 10
@@@@ -76,29 +76,31 @@@@ extern struct dentry_operations unionfs_
 
 /* file private data. */
 struct unionfs_file_info {
-	int b_start;
-	int b_end;
-	atomic_t ufi_generation;
+	int bstart;
+	int bend;
+	atomic_t generation;
d1126 4
a1129 14
 struct unionfs_inode_info {
-	int b_start;
-	int b_end;
-	atomic_t uii_generation;
-	int uii_stale;
+	int bstart;
+	int bend;
+	atomic_t generation;
+	int stale;
 	/* Stuff for readdir over NFS. */
-	spinlock_t uii_rdlock;
-	struct list_head uii_readdircache;
-	int uii_rdcount;
-	int uii_hashsize;
d1132 1
a1132 5
+	spinlock_t rdlock;
+	struct list_head readdircache;
+	int rdcount;
+	int hashsize;
+	int cookie;
d1137 1
a1137 2
-	atomic_t uii_totalopens;
+	atomic_t totalopens;
d1139 4
a1142 12
 
 struct unionfs_inode_container {
@@@@ -111,17 +113,17 @@@@ struct unionfs_dentry_info {
 	/* The semaphore is used to lock the dentry as soon as we get into a
 	 * unionfs function from the VFS.  Our lock ordering is that children
 	 * go before their parents. */
-	struct semaphore udi_sem;
-	int udi_bstart;
-	int udi_bend;
-	int udi_bopaque;
-	int udi_bcount;
-	atomic_t udi_generation;
a1143 6
+	struct semaphore sem;
+	int bstart;
+	int bend;
+	int bopaque;
+	int bcount;
+	atomic_t generation;
d1148 1
a1148 69
-struct unionfs_usi_data {
+struct unionfs_data {
 	struct super_block *sb;
 	struct vfsmount *hidden_mnt;
 	atomic_t sbcount;
@@@@ -130,13 +132,13 @@@@ struct unionfs_usi_data {
 
 /* unionfs super-block data in memory */
 struct unionfs_sb_info {
-	int b_end;
-
-	atomic_t usi_generation;
-	unsigned long usi_mount_flag;
-	struct rw_semaphore usi_rwsem;
-
-	struct unionfs_usi_data *usi_data;
+	int bend;
+
+	atomic_t generation;
+	unsigned long mount_flag;
+	struct rw_semaphore rwsem;
+
+	struct unionfs_data *data;
 };
 
 /*
@@@@ -155,16 +157,16 @@@@ struct filldir_node {
 
 /* Directory hash table. */
 struct unionfs_dir_state {
-	unsigned int uds_cookie;	/* The cookie, which is based off of uii_rdversion */
-	unsigned int uds_offset;	/* The entry we have returned. */
-	int uds_bindex;
-	loff_t uds_dirpos;	/* The offset within the lower level directory. */
-	int uds_size;		/* How big is the hash table? */
-	int uds_hashentries;	/* How many entries have been inserted? */
-	unsigned long uds_access;
+	unsigned int cookie;	/* The cookie, which is based off of rdversion */
+	unsigned int offset;	/* The entry we have returned. */
+	int bindex;
+	loff_t dirpos;	/* The offset within the lower level directory. */
+	int size;		/* How big is the hash table? */
+	int hashentries;	/* How many entries have been inserted? */
+	unsigned long access;
 	/* This cache list is used when the inode keeps us around. */
-	struct list_head uds_cache;
-	struct list_head uds_list[0];
+	struct list_head cache;
+	struct list_head list[0];
 };
 
 /* include miscellaneous macros */
@@@@ -190,7 +192,7 @@@@ struct filldir_node *find_filldir_node(s
 				       const char *name, int namelen);
 
 struct dentry **alloc_new_dentries(int objs);
-struct unionfs_usi_data *alloc_new_data(int objs);
+struct unionfs_data *alloc_new_data(int objs);
 
 /* We can only use 32-bits of offset for rdstate --- blech! */
 #define DIREOF (0xfffff)
@@@@ -200,15 +202,15 @@@@ static inline off_t rdstate2offset(struc
 static inline off_t rdstate2offset(struct unionfs_dir_state *buf)
 {
 	off_t tmp;
-	tmp = ((buf->uds_cookie & MAXRDCOOKIE) << RDOFFBITS)
-		| (buf->uds_offset & DIREOF);
+	tmp = ((buf->cookie & MAXRDCOOKIE) << RDOFFBITS)
+		| (buf->offset & DIREOF);
d1156 4
a1159 4
+#define unionfs_read_lock(sb) down_read(&UNIONFS_SB(sb)->rwsem)
+#define unionfs_read_unlock(sb) up_read(&UNIONFS_SB(sb)->rwsem)
+#define unionfs_write_lock(sb) down_write(&UNIONFS_SB(sb)->rwsem)
+#define unionfs_write_unlock(sb) up_write(&UNIONFS_SB(sb)->rwsem)
d1168 1
a1168 1
+	return UNIONFS_SB(sb)->data[index].branchperms;
d1175 1
a1175 1
+	UNIONFS_SB(sb)->data[index].branchperms = perms;
d1184 1
a1184 1
+	perms = UNIONFS_SB(dentry->d_sb)->data[index].branchperms;
d1193 1
a1193 1
+	index = UNIONFS_D(dentry)->bstart;
a1196 32
diff -r 3ab2c76610b7 fs/unionfs/dirhelper.c
--- a/fs/unionfs/dirhelper.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/dirhelper.c	Fri Dec 01 04:28:03 2006 -0500
@@@@ -46,8 +46,8 @@@@ int do_delete_whiteouts(struct dentry *d
 	p = name + UNIONFS_WHLEN;
 
 	err = 0;
-	for (i = 0; !err && i < namelist->uds_size; i++) {
-		list_for_each(pos, &namelist->uds_list[i]) {
+	for (i = 0; !err && i < namelist->size; i++) {
+		list_for_each(pos, &namelist->list[i]) {
 			cursor =
 			    list_entry(pos, struct filldir_node, file_list);
 			/* Only operate on whiteouts in this branch. */
@@@@ -165,7 +165,7 @@@@ static int readdir_util_callback(void *d
 		goto out;
 
 	err = add_filldir_node(buf->rdstate, name, namelen,
-			       buf->rdstate->uds_bindex, whiteout);
+			       buf->rdstate->bindex, whiteout);
 
 out:
 	buf->err = err;
@@@@ -235,7 +235,7 @@@@ int check_empty(struct dentry *dentry, s
 
 		do {
 			buf->filldir_called = 0;
-			buf->rdstate->uds_bindex = bindex;
+			buf->rdstate->bindex = bindex;
 			err = vfs_readdir(hidden_file,
 					  readdir_util_callback, buf);
 			if (buf->err)
@


1.1.2.4
log
@More macro removal
@
text
@d3 1
a3 1
+++ b/fs/unionfs/branchman.c	Fri Dec 01 18:11:00 2006 -0500
a17 9
@@@@ -56,7 +56,7 @@@@ int unionfs_ioctl_queryfile(struct file 
 	FD_ZERO(&branchlist);
 
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 		if (!hidden_dentry)
 			continue;
 		if (hidden_dentry->d_inode)
d20 2
a21 20
+++ b/fs/unionfs/commonfops.c	Fri Dec 01 18:14:57 2006 -0500
@@@@ -36,7 +36,7 @@@@ static int copyup_deleted_file(struct fi
 	struct dentry *hidden_dentry = NULL;
 	struct dentry *hidden_dir_dentry = NULL;
 
-	hidden_dentry = dtohd_index(dentry, bstart);
+	hidden_dentry = unionfs_lower_dentry_index(dentry, bstart);
 
 	sprintf(name, ".unionfs%*.*lx",
 			i_inosize, i_inosize, hidden_dentry->d_inode->i_ino);
@@@@ -66,7 +66,7 @@@@ static int copyup_deleted_file(struct fi
 		goto out;
 
 	/* bring it to the same state as an unlinked file */
-	hidden_dentry = dtohd_index(dentry, dbstart(dentry));
+	hidden_dentry = unionfs_lower_dentry_index(dentry, dbstart(dentry));
 	hidden_dir_dentry = lock_parent(hidden_dentry);
 	err = vfs_unlink(hidden_dir_dentry->d_inode, hidden_dentry);
 	unlock_dir(hidden_dir_dentry);
@@@@ -78,19 +78,22 @@@@ static void cleanup_file(struct file *fi
d33 1
a33 2
-		if (ftohf_index(file, bindex)) {
+		if (unionfs_lower_file_index(file, bindex)) {
d35 4
a38 4
-			fput(ftohf_index(file, bindex));
-		}
-	}
-
a41 4
+			fput(unionfs_lower_file_index(file, bindex));
+		}
+	}
+
d48 1
a48 37
@@@@ -105,21 +108,22 @@@@ static int open_all_files(struct file *f
 	bend = dbend(dentry);
 
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 		if (!hidden_dentry)
 			continue;
 
 		dget(hidden_dentry);
-		mntget(dtohm_index(dentry, bindex));
+		mntget(unionfs_lower_mnt_index(dentry, bindex));
 		branchget(sb, bindex);
 
 		hidden_file = dentry_open(hidden_dentry,
-				dtohm_index(dentry, bindex), file->f_flags);
+				unionfs_lower_mnt_index(dentry, bindex),
+				file->f_flags);
 		if (IS_ERR(hidden_file)) {
 			err = PTR_ERR(hidden_file);
 			goto out;
 		} else
-			set_ftohf_index(file, bindex, hidden_file);
+			unionfs_set_lower_file_index(file, bindex, hidden_file);
 	}
 out:
 	return err;
@@@@ -138,7 +142,7 @@@@ static int open_highest_file(struct file
 	bstart = dbstart(dentry);
 	bend = dbend(dentry);
 
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
 	if (willwrite && IS_WRITE_FLAG(file->f_flags)
 	    && is_robranch(dentry)) {
 		for (bindex = bstart - 1; bindex >= 0; bindex--) {
@@@@ -148,21 +152,21 @@@@ static int open_highest_file(struct file
d59 1
a59 31
 	dget(hidden_dentry);
-	mntget(dtohm_index(dentry, bstart));
+	mntget(unionfs_lower_mnt_index(dentry, bstart));
 	branchget(sb, bstart);
 	hidden_file = dentry_open(hidden_dentry,
-			dtohm_index(dentry, bstart), file->f_flags);
+			unionfs_lower_mnt_index(dentry, bstart), file->f_flags);
 	if (IS_ERR(hidden_file)) {
 		err = PTR_ERR(hidden_file);
 		goto out;
 	}
-	set_ftohf(file, hidden_file);
+	unionfs_set_lower_file(file, hidden_file);
 	/* Fix up the position. */
 	hidden_file->f_pos = file->f_pos;
 
@@@@ -196,10 +200,10 @@@@ static int do_delayed_copyup(struct file
 	if (!err && (bstart > fbstart(file))) {
 		bend = fbend(file);
 		for (bindex = bstart; bindex <= bend; bindex++) {
-			if (ftohf_index(file, bindex)) {
+			if (unionfs_lower_file_index(file, bindex)) {
 				branchput(dentry->d_sb, bindex);
-				fput(ftohf_index(file, bindex));
-				set_ftohf_index(file, bindex, NULL);
+				fput(unionfs_lower_file_index(file, bindex));
+				unionfs_set_lower_file_index(file, bindex, NULL);
 			}
 		}
 		fbend(file) = bend;
@@@@ -226,9 +230,9 @@@@ int unionfs_file_revalidate(struct file 
d72 1
a72 1
@@@@ -246,8 +250,8 @@@@ int unionfs_file_revalidate(struct file 
d83 1
a83 1
@@@@ -263,16 +267,17 @@@@ int unionfs_file_revalidate(struct file 
d96 1
a96 64
-	if (willwrite && IS_WRITE_FLAG(file->f_flags)
-	    && !IS_WRITE_FLAG(ftohf(file)->f_flags) && is_robranch(dentry)) {
-		printk(KERN_DEBUG
-		       "Doing delayed copyup of a read-write file on a read-only branch.\n");
+	if (willwrite && IS_WRITE_FLAG(file->f_flags) &&
+	    !IS_WRITE_FLAG(unionfs_lower_file(file)->f_flags) &&
+	    is_robranch(dentry)) {
+		printk(KERN_DEBUG "Doing delayed copyup of a read-write "
+				  "file on a read-only branch.\n");
 		err = do_delayed_copyup(file, dentry);
 	}
 
@@@@ -293,19 +298,19 @@@@ static inline int __open_dir(struct inod
 	bend = fbend(file) = dbend(file->f_dentry);
 
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_dentry = dtohd_index(file->f_dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_index(file->f_dentry, bindex);
 		if (!hidden_dentry)
 			continue;
 
 		dget(hidden_dentry);
-		mntget(dtohm_index(file->f_dentry, bindex));
+		mntget(unionfs_lower_mnt_index(file->f_dentry, bindex));
 		hidden_file = dentry_open(hidden_dentry,
-					dtohm_index(file->f_dentry, bindex),
+					unionfs_lower_mnt_index(file->f_dentry, bindex),
 					file->f_flags);
 		if (IS_ERR(hidden_file))
 			return PTR_ERR(hidden_file);
 
-		set_ftohf_index(file, bindex, hidden_file);
+		unionfs_set_lower_file_index(file, bindex, hidden_file);
 
 		/* The branchget goes after the open, because otherwise
 		 * we would miss the reference on release. */
@@@@ -323,7 +328,7 @@@@ static inline int __open_file(struct ino
 	int hidden_flags;
 	int bindex, bstart, bend;
 
-	hidden_dentry = dtohd(file->f_dentry);
+	hidden_dentry = unionfs_lower_dentry(file->f_dentry);
 	hidden_flags = file->f_flags;
 
 	bstart = fbstart(file) = dbstart(file->f_dentry);
@@@@ -355,14 +360,14 @@@@ static inline int __open_file(struct ino
 	/* dentry_open will decrement mnt refcnt if err.
 	 * otherwise fput() will do an mntput() for us upon file close.
 	 */
-	mntget(dtohm_index(file->f_dentry, bstart));
+	mntget(unionfs_lower_mnt_index(file->f_dentry, bstart));
 	hidden_file = dentry_open(hidden_dentry,
-				  dtohm_index(file->f_dentry, bstart),
+				  unionfs_lower_mnt_index(file->f_dentry, bstart),
 				  hidden_flags);
 	if (IS_ERR(hidden_file))
 		return PTR_ERR(hidden_file);
 
-	set_ftohf(file, hidden_file);
+	unionfs_set_lower_file(file, hidden_file);
 	branchget(inode->i_sb, bstart);
 
 	return 0;
@@@@ -376,19 +381,19 @@@@ int unionfs_open(struct inode *inode, st
d122 1
a122 1
@@@@ -401,7 +406,7 @@@@ int unionfs_open(struct inode *inode, st
d131 1
a131 10
@@@@ -412,7 +417,7 @@@@ int unionfs_open(struct inode *inode, st
 	/* freeing the allocated resources, and fput the opened files */
 	if (err) {
 		for (bindex = bstart; bindex <= bend; bindex++) {
-			hidden_file = ftohf_index(file, bindex);
+			hidden_file = unionfs_lower_file_index(file, bindex);
 			if (!hidden_file)
 				continue;
 
@@@@ -427,8 +432,8 @@@@ int unionfs_open(struct inode *inode, st
d142 1
a142 1
@@@@ -441,12 +446,12 @@@@ int unionfs_file_release(struct inode *i
d151 1
a151 7
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_file = ftohf_index(file, bindex);
+		hidden_file = unionfs_lower_file_index(file, bindex);
 
 		if (hidden_file) {
 			fput(hidden_file);
@@@@ -455,23 +460,23 @@@@ int unionfs_file_release(struct inode *i
d190 1
a190 10
@@@@ -480,7 +485,7 @@@@ static inline long do_ioctl(struct file 
 	struct file *hidden_file;
 	int err;
 
-	hidden_file = ftohf(file);
+	hidden_file = unionfs_lower_file(file);
 
 	err = security_file_ioctl(hidden_file, cmd, arg);
 	if (err)
@@@@ -540,7 +545,7 @@@@ int unionfs_flush(struct file *file, fl_
a198 20
@@@@ -548,7 +553,7 @@@@ int unionfs_flush(struct file *file, fl_
 	bstart = fbstart(file);
 	bend = fbend(file);
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_file = ftohf_index(file, bindex);
+		hidden_file = unionfs_lower_file_index(file, bindex);
 
 		if (hidden_file && hidden_file->f_op
 		    && hidden_file->f_op->flush) {
@@@@ -558,8 +563,8 @@@@ int unionfs_flush(struct file *file, fl_
 
 			/* if there are no more references to the dentry, dput it */
 			if (d_deleted(file->f_dentry)) {
-				dput(dtohd_index(file->f_dentry, bindex));
-				set_dtohd_index(file->f_dentry, bindex, NULL);
+				dput(unionfs_lower_dentry_index(file->f_dentry, bindex));
+				unionfs_set_lower_dentry_index(file->f_dentry, bindex, NULL);
 			}
 		}
 
d201 1
a201 1
+++ b/fs/unionfs/dentry.c	Fri Dec 01 18:11:00 2006 -0500
d227 1
a227 1
+				    unionfs_lower_dentry_index(dentry, bindex);
d231 1
a231 9
@@@@ -117,15 +117,15 @@@@ restart:
 				struct inode *hidden_inode;
 				for (bindex = bstart; bindex <= bend; bindex++) {
 					hidden_inode =
-					    itohi_index(dentry->d_inode,
+					    unionfs_lower_inode_index(dentry->d_inode,
 							bindex);
 					if (!hidden_inode)
 						continue;
d251 1
a251 19
@@@@ -157,7 +157,7 @@@@ restart:
 	bend = dbend(dentry);
 	BUG_ON(bstart == -1);
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 		if (!hidden_dentry || !hidden_dentry->d_op
 		    || !hidden_dentry->d_op->d_revalidate)
 			continue;
@@@@ -169,7 +169,7 @@@@ restart:
 	if (!dentry->d_inode)
 		valid = 0;
 	if (valid)
-		fsstack_copy_attr_all(dentry->d_inode, itohi(dentry->d_inode),
+		fsstack_copy_attr_all(dentry->d_inode, unionfs_lower_inode(dentry->d_inode),
 				unionfs_get_nlinks);
 
 out:
@@@@ -200,13 +200,13 @@@@ void unionfs_d_release(struct dentry *de
d260 2
a261 21
 	} else if (dbstart(dentry) < 0) {
 		/* this is due to a failed lookup */
-		/* the failed lookup has a dtohd_ptr set to null,
+		/* the failed lookup has a unionfs_lower_dentry_ptr set to null,
 		   but this is a better check */
 		printk(KERN_DEBUG "dentry without hidden dentries : %.*s",
 		       dentry->d_name.len, dentry->d_name.name);
@@@@ -217,20 +217,20 @@@@ void unionfs_d_release(struct dentry *de
 	bstart = dbstart(dentry);
 	bend = dbend(dentry);
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		dput(dtohd_index(dentry, bindex));
-		mntput(dtohm_index(dentry, bindex));
-
-		set_dtohd_index(dentry, bindex, NULL);
-		set_dtohm_index(dentry, bindex, NULL);
+		dput(unionfs_lower_dentry_index(dentry, bindex));
+		mntput(unionfs_lower_mnt_index(dentry, bindex));
+
+		unionfs_set_lower_dentry_index(dentry, bindex, NULL);
+		unionfs_set_lower_mnt_index(dentry, bindex, NULL);
d280 1
a280 1
+++ b/fs/unionfs/dirfops.c	Fri Dec 01 18:11:00 2006 -0500
d336 1
a336 1
+		hidden_file = unionfs_lower_file_index(file, uds->bindex);
a416 72
diff -r 3ab2c76610b7 fs/unionfs/dirhelper.c
--- a/fs/unionfs/dirhelper.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/dirhelper.c	Fri Dec 01 18:11:00 2006 -0500
@@@@ -33,7 +33,7 @@@@ int do_delete_whiteouts(struct dentry *d
 	struct filldir_node *cursor;
 
 	/* Find out hidden parent dentry */
-	hidden_dir_dentry = dtohd_index(dentry, bindex);
+	hidden_dir_dentry = unionfs_lower_dentry_index(dentry, bindex);
 	BUG_ON(!S_ISDIR(hidden_dir_dentry->d_inode->i_mode));
 	hidden_dir = hidden_dir_dentry->d_inode;
 	BUG_ON(!S_ISDIR(hidden_dir->i_mode));
@@@@ -46,8 +46,8 @@@@ int do_delete_whiteouts(struct dentry *d
 	p = name + UNIONFS_WHLEN;
 
 	err = 0;
-	for (i = 0; !err && i < namelist->uds_size; i++) {
-		list_for_each(pos, &namelist->uds_list[i]) {
+	for (i = 0; !err && i < namelist->size; i++) {
+		list_for_each(pos, &namelist->list[i]) {
 			cursor =
 			    list_entry(pos, struct filldir_node, file_list);
 			/* Only operate on whiteouts in this branch. */
@@@@ -101,7 +101,7 @@@@ int delete_whiteouts(struct dentry *dent
 	if (err)
 		goto out;
 
-	hidden_dir_dentry = dtohd_index(dentry, bindex);
+	hidden_dir_dentry = unionfs_lower_dentry_index(dentry, bindex);
 	BUG_ON(!S_ISDIR(hidden_dir_dentry->d_inode->i_mode));
 	hidden_dir = hidden_dir_dentry->d_inode;
 	BUG_ON(!S_ISDIR(hidden_dir->i_mode));
@@@@ -165,7 +165,7 @@@@ static int readdir_util_callback(void *d
 		goto out;
 
 	err = add_filldir_node(buf->rdstate, name, namelen,
-			       buf->rdstate->uds_bindex, whiteout);
+			       buf->rdstate->bindex, whiteout);
 
 out:
 	buf->err = err;
@@@@ -212,7 +212,7 @@@@ int check_empty(struct dentry *dentry, s
 
 	/* Process the hidden directories with rdutil_callback as a filldir. */
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 		if (!hidden_dentry)
 			continue;
 		if (!hidden_dentry->d_inode)
@@@@ -221,10 +221,10 @@@@ int check_empty(struct dentry *dentry, s
 			continue;
 
 		dget(hidden_dentry);
-		mntget(dtohm_index(dentry, bindex));
+		mntget(unionfs_lower_mnt_index(dentry, bindex));
 		branchget(sb, bindex);
 		hidden_file =
-		    dentry_open(hidden_dentry, dtohm_index(dentry, bindex),
+		    dentry_open(hidden_dentry, unionfs_lower_mnt_index(dentry, bindex),
 				O_RDONLY);
 		if (IS_ERR(hidden_file)) {
 			err = PTR_ERR(hidden_file);
@@@@ -235,7 +235,7 @@@@ int check_empty(struct dentry *dentry, s
 
 		do {
 			buf->filldir_called = 0;
-			buf->rdstate->uds_bindex = bindex;
+			buf->rdstate->bindex = bindex;
 			err = vfs_readdir(hidden_file,
 					  readdir_util_callback, buf);
 			if (buf->err)
d419 2
a420 2
+++ b/fs/unionfs/fanout.h	Fri Dec 01 18:11:00 2006 -0500
@@@@ -19,172 +19,161 @@@@
d459 1
a459 2
-static inline struct file *ftohf(struct file *f)
+static inline struct file *unionfs_lower_file(struct file *f)
d465 1
a465 2
-static inline struct file *ftohf_index(const struct file *f, int index)
+static inline struct file *unionfs_lower_file_index(const struct file *f, int index)
d471 1
a471 2
-static inline void set_ftohf_index(struct file *f, int index, struct file *val)
+static inline void unionfs_set_lower_file_index(struct file *f, int index, struct file *val)
d477 1
a477 2
-static inline void set_ftohf(struct file *f, struct file *val)
+static inline void unionfs_set_lower_file(struct file *f, struct file *val)
d484 1
a484 2
-static inline struct inode *itohi(const struct inode *i)
+static inline struct inode *unionfs_lower_inode(const struct inode *i)
d490 1
a490 2
-static inline struct inode *itohi_index(const struct inode *i, int index)
+static inline struct inode *unionfs_lower_inode_index(const struct inode *i, int index)
d496 1
a496 2
-static inline void set_itohi_index(struct inode *i, int index,
+static inline void unionfs_set_lower_inode_index(struct inode *i, int index,
d503 1
a503 2
-static inline void set_itohi(struct inode *i, struct inode *val)
+static inline void unionfs_set_lower_inode(struct inode *i, struct inode *val)
d510 1
a510 2
-static inline struct super_block *stohs(const struct super_block *o)
+static inline struct super_block *unionfs_lower_super(const struct super_block *o)
d516 1
a516 2
-static inline struct super_block *stohs_index(const struct super_block *o, int index)
+static inline struct super_block *unionfs_lower_super_index(const struct super_block *o, int index)
d522 1
a522 2
-static inline void set_stohs_index(struct super_block *o, int index,
+static inline void unionfs_set_lower_super_index(struct super_block *o, int index,
d529 1
a529 2
-static inline void set_stohs(struct super_block *o, struct super_block *val)
+static inline void unionfs_set_lower_super(struct super_block *o, struct super_block *val)
d582 1
a582 2
-static inline void set_dtohd_index(struct dentry *dent, int index,
+static inline void unionfs_set_lower_dentry_index(struct dentry *dent, int index,
d589 1
a589 2
-static inline struct dentry *dtohd_index(const struct dentry *dent, int index)
+static inline struct dentry *unionfs_lower_dentry_index(const struct dentry *dent, int index)
d595 3
a597 9
-static inline struct dentry *dtohd(const struct dentry *dent)
+static inline struct dentry *unionfs_lower_dentry(const struct dentry *dent)
 {
-	return dtohd_index(dent, dbstart(dent));
+	return unionfs_lower_dentry_index(dent, dbstart(dent));
 }
 
-static inline void set_dtohm_index(struct dentry *dent, int index,
+static inline void unionfs_set_lower_mnt_index(struct dentry *dent, int index,
d604 1
a604 2
-static inline struct vfsmount *dtohm_index(const struct dentry *dent, int index)
+static inline struct vfsmount *unionfs_lower_mnt_index(const struct dentry *dent, int index)
d610 3
a612 5
-static inline struct vfsmount *dtohm(const struct dentry *dent)
+static inline struct vfsmount *unionfs_lower_mnt(const struct dentry *dent)
 {
-	return dtohm_index(dent,dbstart(dent));
+	return unionfs_lower_mnt_index(dent,dbstart(dent));
d630 1
a630 1
+++ b/fs/unionfs/lookup.c	Fri Dec 01 18:11:00 2006 -0500
a639 58
@@@@ -93,12 +93,12 @@@@ struct dentry *unionfs_lookup_backend(st
 	}
 
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 		if (lookupmode == INTERPOSE_PARTIAL && hidden_dentry)
 			continue;
 		BUG_ON(hidden_dentry != NULL);
 
-		hidden_dir_dentry = dtohd_index(parent_dentry, bindex);
+		hidden_dir_dentry = unionfs_lower_dentry_index(parent_dentry, bindex);
 
 		/* if the parent hidden dentry does not exist skip this */
 		if (!(hidden_dir_dentry && hidden_dir_dentry->d_inode))
@@@@ -148,9 +148,9 @@@@ struct dentry *unionfs_lookup_backend(st
 		wh_hidden_dentry = NULL;
 
 		/* Now do regular lookup; lookup foo */
-		nd->dentry = dtohd_index(dentry, bindex);
+		nd->dentry = unionfs_lower_dentry_index(dentry, bindex);
 		/* FIXME: fix following line for mount point crossing */
-		nd->mnt = dtohm_index(parent_dentry, bindex);
+		nd->mnt = unionfs_lower_mnt_index(parent_dentry, bindex);
 
 		hidden_dentry = lookup_one_len_nd(name, hidden_dir_dentry,
 					       namelen, nd);
@@@@ -168,7 +168,7 @@@@ struct dentry *unionfs_lookup_backend(st
 				first_hidden_dentry = hidden_dentry;
 				/* FIXME: following line needs to be changed
 				 * to allow mountpoint crossing */
-				first_hidden_mnt = mntget(dtohm_index(parent_dentry, bindex));
+				first_hidden_mnt = mntget(unionfs_lower_mnt_index(parent_dentry, bindex));
 				first_dentry_offset = bindex;
 			} else
 				dput(hidden_dentry);
@@@@ -182,10 +182,10 @@@@ struct dentry *unionfs_lookup_backend(st
 		/* store underlying dentry */
 		if (dbstart(dentry) == -1)
 			set_dbstart(dentry, bindex);
-		set_dtohd_index(dentry, bindex, hidden_dentry);
+		unionfs_set_lower_dentry_index(dentry, bindex, hidden_dentry);
 		/* FIXME: the following line needs to get fixed to allow
 		 * mountpoint crossing */
-		set_dtohm_index(dentry, bindex, mntget(dtohm_index(parent_dentry, bindex)));
+		unionfs_set_lower_mnt_index(dentry, bindex, mntget(unionfs_lower_mnt_index(parent_dentry, bindex)));
 		set_dbend(dentry, bindex);
 
 		/* update parent directory's atime with the bindex */
@@@@ -199,7 +199,7 @@@@ struct dentry *unionfs_lookup_backend(st
 			if (dentry_count == 1)
 				goto out_positive;
 			/* This can only happen with mixed D-*-F-* */
-			BUG_ON(!S_ISDIR(dtohd(dentry)->d_inode->i_mode));
+			BUG_ON(!S_ISDIR(unionfs_lower_dentry(dentry)->d_inode->i_mode));
 			continue;
 		}
 
d649 4
a652 32
@@@@ -237,7 +237,7 @@@@ out_negative:
 	if (first_dentry_offset == -1) {
 		nd->dentry = dentry;
 		/* FIXME: fix following line for mount point crossing */
-		nd->mnt = dtohm_index(parent_dentry, bindex);
+		nd->mnt = unionfs_lower_mnt_index(parent_dentry, bindex);
 
 		first_hidden_dentry = lookup_one_len_nd(name, hidden_dir_dentry,
 						     namelen, nd);
@@@@ -249,10 +249,10 @@@@ out_negative:
 		
 		/* FIXME: the following line needs to be changed to allow
 		 * mountpoint crossing */
-		first_hidden_mnt = mntget(dtohm_index(dentry, bindex));
-	}
-	set_dtohd_index(dentry, first_dentry_offset, first_hidden_dentry);
-	set_dtohm_index(dentry, first_dentry_offset, first_hidden_mnt);
+		first_hidden_mnt = mntget(unionfs_lower_mnt_index(dentry, bindex));
+	}
+	unionfs_set_lower_dentry_index(dentry, first_dentry_offset, first_hidden_dentry);
+	unionfs_set_lower_mnt_index(dentry, first_dentry_offset, first_hidden_mnt);
 	set_dbstart(dentry, first_dentry_offset);
 	set_dbend(dentry, first_dentry_offset);
 
@@@@ -302,18 +302,18 @@@@ out_free:
 	if (bstart >= 0) {
 		bend = dbend(dentry);
 		for (bindex = bstart; bindex <= bend; bindex++) {
-			dput(dtohd_index(dentry, bindex));
-			mntput(dtohm_index(dentry, bindex));
-		}
-	}
a654 4
+			dput(unionfs_lower_dentry_index(dentry, bindex));
+			mntput(unionfs_lower_mnt_index(dentry, bindex));
+		}
+	}
a667 9
@@@@ -351,7 +351,7 @@@@ static int is_opaque_dir(struct dentry *
 	struct inode *hidden_inode;
 	struct sioq_args args;
 
-	hidden_dentry = dtohd_index(dentry, bindex);
+	hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 	hidden_inode = hidden_dentry->d_inode;
 
 	BUG_ON(!S_ISDIR(hidden_inode->i_mode));
a746 21
@@@@ -486,7 +486,7 @@@@ void update_bstart(struct dentry *dentry
 	struct dentry *hidden_dentry;
 
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 		if (!hidden_dentry)
 			continue;
 		if (hidden_dentry->d_inode) {
@@@@ -494,7 +494,7 @@@@ void update_bstart(struct dentry *dentry
 			break;
 		}
 		dput(hidden_dentry);
-		set_dtohd_index(dentry, bindex, NULL);
-	}
-}
-
+		unionfs_set_lower_dentry_index(dentry, bindex, NULL);
+	}
+}
+
d749 1
a749 12
+++ b/fs/unionfs/main.c	Fri Dec 01 18:11:00 2006 -0500
@@@@ -37,8 +37,8 @@@@ int unionfs_interpose(struct dentry *den
 
 	/* Make sure that we didn't get a negative dentry. */
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		if (dtohd_index(dentry, bindex) &&
-		    dtohd_index(dentry, bindex)->d_inode) {
+		if (unionfs_lower_dentry_index(dentry, bindex) &&
+		    unionfs_lower_dentry_index(dentry, bindex)->d_inode) {
 			is_negative_dentry = 0;
 			break;
 		}
a771 49
@@@@ -83,9 +83,9 @@@@ int unionfs_interpose(struct dentry *den
 	}
 
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 		if (!hidden_dentry) {
-			set_itohi_index(inode, bindex, NULL);
+			unionfs_set_lower_inode_index(inode, bindex, NULL);
 			continue;
 		}
 
@@@@ -93,14 +93,14 @@@@ int unionfs_interpose(struct dentry *den
 		if (!hidden_dentry->d_inode)
 			continue;
 
-		set_itohi_index(inode, bindex, igrab(hidden_dentry->d_inode));
+		unionfs_set_lower_inode_index(inode, bindex, igrab(hidden_dentry->d_inode));
 	}
 
 	ibstart(inode) = dbstart(dentry);
 	ibend(inode) = dbend(dentry);
 
 	/* Use attributes from the first branch. */
-	hidden_inode = itohi(inode);
+	hidden_inode = unionfs_lower_inode(inode);
 
 	/* Use different set of inode ops for symlinks & directories */
 	if (S_ISLNK(hidden_inode->i_mode))
@@@@ -162,15 +162,15 @@@@ void unionfs_reinterpose(struct dentry *
 	bstart = dbstart(dentry);
 	bend = dbend(dentry);
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 		if (!hidden_dentry)
 			continue;
 
 		if (!hidden_dentry->d_inode)
 			continue;
-		if (itohi_index(inode, bindex))
-			continue;
-		set_itohi_index(inode, bindex, igrab(hidden_dentry->d_inode));
+		if (unionfs_lower_inode_index(inode, bindex))
+			continue;
+		unionfs_set_lower_inode_index(inode, bindex, igrab(hidden_dentry->d_inode));
 	}
 	ibstart(inode) = dbstart(dentry);
 	ibend(inode) = dbend(dentry);
d930 1
a930 1
@@@@ -515,25 +516,25 @@@@ static int unionfs_read_super(struct sup
a949 2
-
-		set_stohs_index(sb, bindex, d->d_sb);
d951 2
a952 2
+
+		unionfs_set_lower_super_index(sb, bindex, d->d_sb);
a953 7
 
 	/* Unionfs: Max Bytes is the maximum bytes from highest priority branch */
-	sb->s_maxbytes = stohs_index(sb, 0)->s_maxbytes;
+	sb->s_maxbytes = unionfs_lower_super_index(sb, 0)->s_maxbytes;
 
 	sb->s_op = &unionfs_sops;
 
d963 1
a963 1
@@@@ -558,17 +559,17 @@@@ static int unionfs_read_super(struct sup
a968 3
-
-		set_dtohd_index(sb->s_root, bindex, d);
-		set_dtohm_index(sb->s_root, bindex, m);
d971 4
a974 5
+
+		unionfs_set_lower_dentry_index(sb->s_root, bindex, d);
+		unionfs_set_lower_mnt_index(sb->s_root, bindex, m);
 	}
 	set_dbstart(sb->s_root, bstart);
d1039 2
a1040 2
+++ b/fs/unionfs/rdstate.c	Fri Dec 01 18:11:00 2006 -0500
@@@@ -63,11 +63,11 @@@@ static int guesstimate_hash_size(struct 
d1050 1
a1050 5
-		if (!(hidden_inode = itohi_index(inode, bindex)))
+		if (!(hidden_inode = unionfs_lower_inode_index(inode, bindex)))
 			continue;
 
 		if (hidden_inode->i_size == DENTPAGE) {
d1189 1
a1189 60
+++ b/fs/unionfs/rename.c	Fri Dec 01 18:11:00 2006 -0500
@@@@ -31,8 +31,8 @@@@ static int do_rename(struct inode *old_d
 	struct dentry *hidden_wh_dir_dentry;
 	char *wh_name = NULL;
 
-	hidden_new_dentry = dtohd_index(new_dentry, bindex);
-	hidden_old_dentry = dtohd_index(old_dentry, bindex);
+	hidden_new_dentry = unionfs_lower_dentry_index(new_dentry, bindex);
+	hidden_old_dentry = unionfs_lower_dentry_index(old_dentry, bindex);
 
 	if (!hidden_new_dentry) {
 		hidden_new_dentry =
@@@@ -180,7 +180,7 @@@@ static int do_unionfs_rename(struct inod
 		struct dentry *unlink_dentry;
 		struct dentry *unlink_dir_dentry;
 
-		unlink_dentry = dtohd_index(new_dentry, bindex);
+		unlink_dentry = unionfs_lower_dentry_index(new_dentry, bindex);
 		if (!unlink_dentry) {
 			continue;
 		}
@@@@ -202,7 +202,7 @@@@ static int do_unionfs_rename(struct inod
 		if (!err) {
 			if (bindex != new_bstart) {
 				dput(unlink_dentry);
-				set_dtohd_index(new_dentry, bindex, NULL);
+				unionfs_set_lower_dentry_index(new_dentry, bindex, NULL);
 			}
 		} else if (IS_COPYUP_ERR(err)) {
 			do_copyup = bindex - 1;
@@@@ -279,16 +279,16 @@@@ revert:
 		goto revert_out;
 	}
 
-	if (!dtohd_index(new_dentry, bindex)
-	    || !dtohd_index(new_dentry, bindex)->d_inode) {
+	if (!unionfs_lower_dentry_index(new_dentry, bindex)
+	    || !unionfs_lower_dentry_index(new_dentry, bindex)->d_inode) {
 		printk(KERN_WARNING
 		       "Revert failed in rename: the object disappeared from under us!\n");
 		eio = -EIO;
 		goto revert_out;
 	}
 
-	if (dtohd_index(old_dentry, bindex)
-	    && dtohd_index(old_dentry, bindex)->d_inode) {
+	if (unionfs_lower_dentry_index(old_dentry, bindex)
+	    && unionfs_lower_dentry_index(old_dentry, bindex)->d_inode) {
 		printk(KERN_WARNING
 		       "Revert failed in rename: the object was created underneath us!\n");
 		eio = -EIO;
@@@@ -357,7 +357,7 @@@@ static struct dentry *lookup_whiteout(st
 	bend = dbend(parent);
 	wh_dentry = ERR_PTR(-ENOENT);
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_parent = dtohd_index(parent, bindex);
+		hidden_parent = unionfs_lower_dentry_index(parent, bindex);
 		if (!hidden_parent)
 			continue;
 		wh_dentry =
d1201 1
a1201 1
+++ b/fs/unionfs/super.c	Fri Dec 01 18:11:00 2006 -0500
a1260 9
@@@@ -127,7 +127,7 @@@@ static int unionfs_statfs(struct dentry 
 
 	sb = dentry->d_sb;
 
-	hidden_sb = stohs_index(sb, sbstart(sb));
+	hidden_sb = unionfs_lower_super_index(sb, sbstart(sb));
 	err = vfs_statfs(hidden_sb->s_root, buf);
 
 	buf->f_type = UNIONFS_SUPER_MAGIC;
d1274 1
a1274 9
@@@@ -173,15 +173,15 @@@@ static void unionfs_clear_inode(struct i
 	bend = ibend(inode);
 	if (bstart >= 0) {
 		for (bindex = bstart; bindex <= bend; bindex++) {
-			hidden_inode = itohi_index(inode, bindex);
+			hidden_inode = unionfs_lower_inode_index(inode, bindex);
 			if (!hidden_inode)
 				continue;
 			iput(hidden_inode);
a1318 22
@@@@ -280,8 +280,8 @@@@ static void unionfs_umount_begin(struct 
 	bstart = sbstart(sb);
 	bend = sbend(sb);
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_mnt = dtohm_index(sb->s_root, bindex);
-		hidden_sb = stohs_index(sb, bindex);
+		hidden_mnt = unionfs_lower_mnt_index(sb->s_root, bindex);
+		hidden_sb = unionfs_lower_super_index(sb, bindex);
 
 		if (hidden_mnt && hidden_sb && hidden_sb->s_op &&
 		    hidden_sb->s_op->umount_begin)
@@@@ -311,8 +311,8 @@@@ static int unionfs_show_options(struct s
 
 	seq_printf(m, ",dirs=");
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		path = d_path(dtohd_index(sb->s_root, bindex),
-			   dtohm_index(sb->s_root, bindex), tmp_page,
+		path = d_path(unionfs_lower_dentry_index(sb->s_root, bindex),
+			   unionfs_lower_mnt_index(sb->s_root, bindex), tmp_page,
 			   PAGE_SIZE);
 		perms = branchperms(sb, bindex);
 
d1321 1
a1321 1
+++ b/fs/unionfs/union.h	Fri Dec 01 18:11:00 2006 -0500
d1482 1
a1482 22
@@@@ -226,7 +228,6 @@@@ extern int new_dentry_private_data(struc
 extern int new_dentry_private_data(struct dentry *dentry);
 void free_dentry_private_data(struct unionfs_dentry_info *udi);
 void update_bstart(struct dentry *dentry);
-#define sbt(sb) ((sb)->s_type->name)
 
 /*
  * EXTERNALS:
@@@@ -351,10 +352,10 @@@@ static inline int unionfs_get_nlinks(str
 		return 0;
 
 	if (!S_ISDIR(inode->i_mode))
-		return itohi(inode)->i_nlink;
+		return unionfs_lower_inode(inode)->i_nlink;
 
 	for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {
-		hidden_inode = itohi_index(inode, bindex);
+		hidden_inode = unionfs_lower_inode_index(inode, bindex);
 		if (!hidden_inode || !S_ISDIR(hidden_inode->i_mode))
 			continue;
 		BUG_ON(hidden_inode->i_nlink < 0);
@@@@ -392,64 +393,47 @@@@ static inline int branchperms(struct sup
a1486 1
-}
d1488 1
a1488 2
+}
+
d1498 1
a1499 37
 /* Is this file on a read-only branch? */
-static inline int __is_robranch_super(struct super_block *sb, int index,
-				      char *file, const char *function,
-				      int line)
+static inline int is_robranch_super(struct super_block *sb, int index)
+{
+	return (!(branchperms(sb, index) & MAY_WRITE)) ? -EROFS : 0;
+}
+
+/* Is this file on a read-only branch? */
+static inline int is_robranch_index(struct dentry *dentry, int index)
 {
 	int err = 0;
 
-	if (!(branchperms(sb, index) & MAY_WRITE))
+	BUG_ON(index < 0);
+
+	if ((!(branchperms(dentry->d_sb, index) & MAY_WRITE)) ||
+	    IS_RDONLY(unionfs_lower_dentry_index(dentry, index)->d_inode))
 		err = -EROFS;
 
 	return err;
 }
 
-/* Is this file on a read-only branch? */
-static inline int __is_robranch_index(struct dentry *dentry, int index,
-				      char *file, const char *function,
-				      int line)
-{
-	int err = 0;
-	int perms;
-
+static inline int is_robranch(struct dentry *dentry)
+{
+	int index;
+
+	index = UNIONFS_D(dentry)->bstart;
d1503 1
a1503 65
-
-	if ((!(perms & MAY_WRITE))
-	    || (IS_RDONLY(dtohd_index(dentry, index)->d_inode)))
-		err = -EROFS;
-
-	return err;
-}
-static inline int __is_robranch(struct dentry *dentry, char *file,
-				const char *function, int line)
-{
-	int index;
-	int err;
-
-	index = dtopd(dentry)->udi_bstart;
-	BUG_ON(index < 0);
-
-	err = __is_robranch_index(dentry, index, file, function, line);
-
-	return err;
-}
-
-#define is_robranch(d) __is_robranch(d, __FILE__, __FUNCTION__, __LINE__)
-#define is_robranch_super(s, n) __is_robranch_super(s, n, __FILE__, __FUNCTION__, __LINE__)
+	return is_robranch_index(dentry, index);
+}
 
 /* What do we use for whiteouts. */
 #define UNIONFS_WHPFX ".wh."
diff -r 3ab2c76610b7 fs/unionfs/copyup.c
--- a/fs/unionfs/copyup.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/copyup.c	Fri Dec 01 18:11:00 2006 -0500
@@@@ -198,10 +198,10 @@@@ static inline int __copyup_reg_data(stru
 	int err = 0;
 
 	/* open old file */
-	mntget(dtohm_index(dentry, old_bindex));
+	mntget(unionfs_lower_mnt_index(dentry, old_bindex));
 	branchget(sb, old_bindex);
 	input_file = dentry_open(old_hidden_dentry,
-			dtohm_index(dentry, old_bindex), O_RDONLY | O_LARGEFILE);
+			unionfs_lower_mnt_index(dentry, old_bindex), O_RDONLY | O_LARGEFILE);
 	if (IS_ERR(input_file)) {
 		dput(old_hidden_dentry);
 		err = PTR_ERR(input_file);
@@@@ -214,10 +214,10 @@@@ static inline int __copyup_reg_data(stru
 
 	/* open new file */
 	dget(new_hidden_dentry);
-	mntget(dtohm_index(dentry, new_bindex));
+	mntget(unionfs_lower_mnt_index(dentry, new_bindex));
 	branchget(sb, new_bindex);
 	output_file = dentry_open(new_hidden_dentry,
-			dtohm_index(dentry, new_bindex), O_WRONLY | O_LARGEFILE);
+			unionfs_lower_mnt_index(dentry, new_bindex), O_WRONLY | O_LARGEFILE);
 	if (IS_ERR(output_file)) {
 		err = PTR_ERR(output_file);
 		goto out_close_in2;
@@@@ -303,7 +303,7 @@@@ static inline void __clear(struct dentry
 			   int new_bindex)
 {
 	/* get rid of the hidden dentry and all its traces */
-	set_dtohd_index(dentry, new_bindex, NULL);
+	unionfs_set_lower_dentry_index(dentry, new_bindex, NULL);
 	set_dbstart(dentry, old_bstart);
 	set_dbend(dentry, old_bend);
d1505 4
a1508 136
@@@@ -352,7 +352,7 @@@@ int copyup_named_dentry(struct inode *di
 		goto out;
 	}
 
-	old_hidden_dentry = dtohd_index(dentry, old_bindex);
+	old_hidden_dentry = unionfs_lower_dentry_index(dentry, old_bindex);
 	dget(old_hidden_dentry);
 
 	/* For symlinks, we must read the link before we lock the directory. */
@@@@ -462,7 +462,7 @@@@ int copyup_named_file(struct inode *dir,
 				  len);
 	if (!err) {
 		fbstart(file) = new_bindex;
-		set_ftohf_index(file, new_bindex, output_file);
+		unionfs_set_lower_file_index(file, new_bindex, output_file);
 	}
 
 	return err;
@@@@ -481,7 +481,7 @@@@ int copyup_file(struct inode *dir, struc
 			    &output_file, len);
 	if (!err) {
 		fbstart(file) = new_bindex;
-		set_ftohf_index(file, new_bindex, output_file);
+		unionfs_set_lower_file_index(file, new_bindex, output_file);
 	}
 
 	return err;
@@@@ -515,7 +515,7 @@@@ static inline void __cleanup_dentry(stru
 	 * bindex (the newly looked dentry
 	 */
 	for (i = loop_start; i <= loop_end; i++) {
-		if (!dtohd_index(dentry, i))
+		if (!unionfs_lower_dentry_index(dentry, i))
 			continue;
 
 		if (i == bindex) {
@@@@ -525,9 +525,9 @@@@ static inline void __cleanup_dentry(stru
 			continue;
 		}
 
-		if (!dtohd_index(dentry, i)->d_inode) {
-			dput(dtohd_index(dentry, i));
-			set_dtohd_index(dentry, i, NULL);
+		if (!unionfs_lower_dentry_index(dentry, i)->d_inode) {
+			dput(unionfs_lower_dentry_index(dentry, i));
+			unionfs_set_lower_dentry_index(dentry, i, NULL);
 		} else {
 			if (new_bstart < 0)
 				new_bstart = i;
@@@@ -546,7 +546,7 @@@@ static inline void __set_inode(struct de
 static inline void __set_inode(struct dentry * upper, struct dentry * lower,
 				int bindex)
 {
-	set_itohi_index(upper->d_inode, bindex,
+	unionfs_set_lower_inode_index(upper->d_inode, bindex,
 			igrab(lower->d_inode));
 	if (likely(ibstart(upper->d_inode) > bindex))
 		ibstart(upper->d_inode) = bindex;
@@@@ -557,7 +557,7 @@@@ static inline void __set_dentry(struct d
 static inline void __set_dentry(struct dentry * upper, struct dentry * lower,
 				int bindex)
 {
-	set_dtohd_index(upper, bindex, lower);
+	unionfs_set_lower_dentry_index(upper, bindex, lower);
 	if (likely(dbstart(upper) > bindex))
 		set_dbstart(upper, bindex);
 	if (likely(dbend(upper) < bindex))
@@@@ -626,7 +626,7 @@@@ struct dentry *create_parents_named(stru
 		lock_dentry(parent_dentry);
 
 		/* find out the hidden_parent_dentry in the given branch */
-		hidden_parent_dentry = dtohd_index(parent_dentry, bindex);
+		hidden_parent_dentry = unionfs_lower_dentry_index(parent_dentry, bindex);
 
 		/* store the child dentry */
 		path[count++] = child_dentry;
@@@@ -657,7 +657,7 @@@@ struct dentry *create_parents_named(stru
 	 * horrible to follow and should be replaced with cleaner code. */
 	while (1) {
 		/* get hidden parent dir in the current branch */
-		hidden_parent_dentry = dtohd_index(parent_dentry, bindex);
+		hidden_parent_dentry = unionfs_lower_dentry_index(parent_dentry, bindex);
 		unlock_dentry(parent_dentry);
 
 		/* init the values to lookup */
@@@@ -682,8 +682,8 @@@@ struct dentry *create_parents_named(stru
 				goto out;
 
 			/* Replace the current dentry (if any) with the new one. */
-			dput(dtohd_index(dentry, bindex));
-			set_dtohd_index(dentry, bindex, hidden_dentry);
+			dput(unionfs_lower_dentry_index(dentry, bindex));
+			unionfs_set_lower_dentry_index(dentry, bindex, hidden_dentry);
 
 			__cleanup_dentry(dentry, bindex, old_bstart, old_bend);
 			break;
diff -r 3ab2c76610b7 fs/unionfs/file.c
--- a/fs/unionfs/file.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/file.c	Fri Dec 01 18:11:00 2006 -0500
@@@@ -35,7 +35,7 @@@@ static loff_t unionfs_llseek(struct file
 	if ((err = unionfs_file_revalidate(file, 0)))
 		goto out;
 
-	hidden_file = ftohf(file);
+	hidden_file = unionfs_lower_file(file);
 	/* always set hidden position to this one */
 	hidden_file->f_pos = file->f_pos;
 
@@@@ -64,7 +64,7 @@@@ ssize_t __unionfs_read(struct file * fil
 	struct file *hidden_file = NULL;
 	loff_t pos = *ppos;
 
-	hidden_file = ftohf(file);
+	hidden_file = unionfs_lower_file(file);
 	if (!hidden_file->f_op || !hidden_file->f_op->read)
 		goto out;
 
@@@@ -106,7 +106,7 @@@@ ssize_t __unionfs_write(struct file * fi
 
 	BUG_ON(bstart == -1);
 
-	hidden_file = ftohf(file);
+	hidden_file = unionfs_lower_file(file);
 	hidden_inode = hidden_file->f_dentry->d_inode;
 
 	if (!hidden_file->f_op || !hidden_file->f_op->write)
@@@@ -165,7 +165,7 @@@@ static unsigned int unionfs_poll(struct 
 		goto out;
 	}
 
-	hidden_file = ftohf(file);
+	hidden_file = unionfs_lower_file(file);
 
 	if (!hidden_file->f_op || !hidden_file->f_op->poll)
 		goto out;
@@@@ -181,7 +181,7 @@@@ static int __do_mmap(struct file *file, 
a1509 1
 	struct file *hidden_file;
d1511 3
a1513 2
-	hidden_file = ftohf(file);
+	hidden_file = unionfs_lower_file(file);
d1515 6
a1520 5
 	err = -ENODEV;
 	if (!hidden_file->f_op || !hidden_file->f_op->mmap)
@@@@ -224,7 +224,7 @@@@ static int unionfs_fsync(struct file *fi
 	if ((err = unionfs_file_revalidate(file, 1)))
 		goto out;
d1522 9
a1530 7
-	hidden_file = ftohf(file);
+	hidden_file = unionfs_lower_file(file);
 
 	err = -EINVAL;
 	if (!hidden_file->f_op || !hidden_file->f_op->fsync)
@@@@ -248,7 +248,7 @@@@ static int unionfs_fasync(int fd, struct
 	if ((err = unionfs_file_revalidate(file, 1)))
d1533 3
a1535 187
-	hidden_file = ftohf(file);
+	hidden_file = unionfs_lower_file(file);
 
 	if (hidden_file->f_op && hidden_file->f_op->fasync)
 		err = hidden_file->f_op->fasync(fd, hidden_file, flag);
diff -r 3ab2c76610b7 fs/unionfs/inode.c
--- a/fs/unionfs/inode.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/inode.c	Fri Dec 01 18:11:00 2006 -0500
@@@@ -41,7 +41,7 @@@@ static int unionfs_create(struct inode *
 
 	/* We start out in the leftmost branch. */
 	bstart = dbstart(dentry);
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
 
 	/* check if whiteout exists in this branch, i.e. lookup .wh.foo first */
 	name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
@@@@ -90,7 +90,7 @@@@ static int unionfs_create(struct inode *
 			       "unionfs: %s:%d: notify_change failed: %d, ignoring..\n",
 			       __FILE__, __LINE__, err);
 
-		new_hidden_dentry = dtohd(dentry);
+		new_hidden_dentry = unionfs_lower_dentry(dentry);
 		dget(new_hidden_dentry);
 
 		hidden_dir_dentry = dget_parent(whiteout_dentry);
@@@@ -128,10 +128,10 @@@@ static int unionfs_create(struct inode *
 			/* reset the unionfs dentry to point to the .wh.foo entry. */
 
 			/* Discard any old reference. */
-			dput(dtohd(dentry));
+			dput(unionfs_lower_dentry(dentry));
 
 			/* Trade one reference to another. */
-			set_dtohd_index(dentry, bstart, whiteout_dentry);
+			unionfs_set_lower_dentry_index(dentry, bstart, whiteout_dentry);
 			whiteout_dentry = NULL;
 
 			err = unionfs_interpose(dentry, parent->i_sb, 0);
@@@@ -140,7 +140,7 @@@@ static int unionfs_create(struct inode *
 	}
 
 	for (bindex = bstart; bindex >= 0; bindex--) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 		if (!hidden_dentry) {
 			/* if hidden_dentry is NULL, create the entire
 			 * dentry directory structure in branch 'bindex'.
@@@@ -220,7 +220,7 @@@@ static int unionfs_link(struct dentry *o
 
 	double_lock_dentry(new_dentry, old_dentry);
 
-	hidden_new_dentry = dtohd(new_dentry);
+	hidden_new_dentry = unionfs_lower_dentry(new_dentry);
 
 	/* check if whiteout exists in the branch of new dentry, i.e. lookup
 	 * .wh.foo first. If present, delete it */
@@@@ -267,8 +267,8 @@@@ static int unionfs_link(struct dentry *o
 		if (!hidden_new_dentry || IS_ERR(hidden_new_dentry))
 			goto out;
 	}
-	hidden_new_dentry = dtohd(new_dentry);
-	hidden_old_dentry = dtohd(old_dentry);
+	hidden_new_dentry = unionfs_lower_dentry(new_dentry);
+	hidden_old_dentry = unionfs_lower_dentry(old_dentry);
 
 	BUG_ON(dbstart(old_dentry) != dbstart(new_dentry));
 	hidden_dir_dentry = lock_parent(hidden_new_dentry);
@@@@ -292,7 +292,7 @@@@ docopyup:
 			if (!err) {
 				hidden_new_dentry =
 				    create_parents(dir, new_dentry, bindex);
-				hidden_old_dentry = dtohd(old_dentry);
+				hidden_old_dentry = unionfs_lower_dentry(old_dentry);
 				hidden_dir_dentry =
 				    lock_parent(hidden_new_dentry);
 				/* do vfs_link */
@@@@ -347,7 +347,7 @@@@ static int unionfs_symlink(struct inode 
 	/* We start out in the leftmost branch. */
 	bstart = dbstart(dentry);
 
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
 
 	/* check if whiteout exists in this branch, i.e. lookup .wh.foo first. If present, delete it */
 	name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
@@@@ -396,7 +396,7 @@@@ static int unionfs_symlink(struct inode 
 	/* deleted whiteout if it was present, now do a normal vfs_symlink() with
 	   possible recursive directory creation */
 	for (bindex = bstart; bindex >= 0; bindex--) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 		if (!hidden_dentry) {
 			/* if hidden_dentry is NULL, create the entire
 			 * dentry directory structure in branch 'bindex'. hidden_dentry will NOT be null when
@@@@ -464,7 +464,7 @@@@ static int unionfs_mkdir(struct inode *p
 	lock_dentry(dentry);
 	bstart = dbstart(dentry);
 
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
 
 	/* check if whiteout exists in this branch, i.e. lookup .wh.foo first */
 	name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
@@@@ -514,7 +514,7 @@@@ static int unionfs_mkdir(struct inode *p
 		if (is_robranch_super(dentry->d_sb, bindex))
 			continue;
 
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 		if (!hidden_dentry) {
 			hidden_dentry = create_parents(parent, dentry, bindex);
 			if (!hidden_dentry || IS_ERR(hidden_dentry)) {
@@@@ -541,9 +541,9 @@@@ static int unionfs_mkdir(struct inode *p
 			break;
 
 		for (i = bindex + 1; i < bend; i++) {
-			if (dtohd_index(dentry, i)) {
-				dput(dtohd_index(dentry, i));
-				set_dtohd_index(dentry, i, NULL);
+			if (unionfs_lower_dentry_index(dentry, i)) {
+				dput(unionfs_lower_dentry_index(dentry, i));
+				unionfs_set_lower_dentry_index(dentry, i, NULL);
 			}
 		}
 		set_dbend(dentry, bindex);
@@@@ -592,7 +592,7 @@@@ static int unionfs_mknod(struct inode *d
 	lock_dentry(dentry);
 	bstart = dbstart(dentry);
 
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
 
 	/* check if whiteout exists in this branch, i.e. lookup .wh.foo first */
 	name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
@@@@ -638,7 +638,7 @@@@ static int unionfs_mknod(struct inode *d
 		if (is_robranch_super(dentry->d_sb, bindex))
 			continue;
 
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 		if (!hidden_dentry) {
 			hidden_dentry = create_parents(dir, dentry, bindex);
 			if (IS_ERR(hidden_dentry)) {
@@@@ -695,7 +695,7 @@@@ int unionfs_readlink(struct dentry *dent
 	struct dentry *hidden_dentry;
 
 	lock_dentry(dentry);
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
 
 	if (!hidden_dentry->d_inode->i_op ||
 	    !hidden_dentry->d_inode->i_op->readlink) {
@@@@ -811,7 +811,7 @@@@ static int unionfs_permission(struct ino
 	bend = ibend(inode);
 
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_inode = itohi_index(inode, bindex);
+		hidden_inode = unionfs_lower_inode_index(inode, bindex);
 		if (!hidden_inode)
 			continue;
 
@@@@ -859,7 +859,7 @@@@ static int unionfs_setattr(struct dentry
 	inode = dentry->d_inode;
 
 	for (bindex = bstart; (bindex <= bend) || (bindex == bstart); bindex++) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 		if (!hidden_dentry)
 			continue;
 		BUG_ON(hidden_dentry->d_inode == NULL);
@@@@ -880,7 +880,7 @@@@ static int unionfs_setattr(struct dentry
 
 				if (!err) {
 					copyup = 1;
-					hidden_dentry = dtohd(dentry);
+					hidden_dentry = unionfs_lower_dentry(dentry);
 					break;
 				}
 				/* if error is in the leftmost branch, pass it up */
@@@@ -896,7 +896,7 @@@@ static int unionfs_setattr(struct dentry
 	}
 
 	/* get the size from the first hidden inode */
-	hidden_inode = itohi(dentry->d_inode);
+	hidden_inode = unionfs_lower_inode(dentry->d_inode);
 	fsstack_copy_attr_all(inode, hidden_inode, unionfs_get_nlinks);
d1538 2
a1539 19
diff -r 3ab2c76610b7 fs/unionfs/subr.c
--- a/fs/unionfs/subr.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/subr.c	Fri Dec 01 18:28:34 2006 -0500
@@@@ -44,7 +44,7 @@@@ int create_whiteout(struct dentry *dentr
 	}
 
 	for (bindex = start; bindex >= 0; bindex--) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 
 		if (!hidden_dentry) {
 			/* if hidden dentry is not present, create the entire
@@@@ -114,7 +114,7 @@@@ int unionfs_refresh_hidden_dentry(struct
 	verify_locked(dentry);
 
 	lock_dentry(dentry->d_parent);
-	hidden_parent = dtohd_index(dentry->d_parent, bindex);
+	hidden_parent = unionfs_lower_dentry_index(dentry->d_parent, bindex);
 	unlock_dentry(dentry->d_parent);
d1541 7
a1547 96
 	BUG_ON(!S_ISDIR(hidden_parent->d_inode->i_mode));
@@@@ -127,18 +127,16 @@@@ int unionfs_refresh_hidden_dentry(struct
 		goto out;
 	}
 
-	if (dtohd_index(dentry, bindex))
-		dput(dtohd_index(dentry, bindex));
-	if (itohi_index(dentry->d_inode, bindex)) {
-		iput(itohi_index(dentry->d_inode, bindex));
-		set_itohi_index(dentry->d_inode, bindex, NULL);
-	}
+	dput(unionfs_lower_dentry_index(dentry, bindex));
+	iput(unionfs_lower_inode_index(dentry->d_inode, bindex));
+	unionfs_set_lower_inode_index(dentry->d_inode, bindex, NULL);
+
 	if (!hidden_dentry->d_inode) {
 		dput(hidden_dentry);
-		set_dtohd_index(dentry, bindex, NULL);
+		unionfs_set_lower_dentry_index(dentry, bindex, NULL);
 	} else {
-		set_dtohd_index(dentry, bindex, hidden_dentry);
-		set_itohi_index(dentry->d_inode, bindex,
+		unionfs_set_lower_dentry_index(dentry, bindex, hidden_dentry);
+		unionfs_set_lower_inode_index(dentry->d_inode, bindex,
 				igrab(hidden_dentry->d_inode));
 	}
 
@@@@ -152,7 +150,7 @@@@ int make_dir_opaque(struct dentry *dentr
 	struct dentry *hidden_dentry, *diropq;
 	struct inode *hidden_dir;
 
-	hidden_dentry = dtohd_index(dentry, bindex);
+	hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 	hidden_dir = hidden_dentry->d_inode;
 	BUG_ON(!S_ISDIR(dentry->d_inode->i_mode)
 	       || !S_ISDIR(hidden_dir->i_mode));
diff -r 3ab2c76610b7 fs/unionfs/unlink.c
--- a/fs/unionfs/unlink.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/unlink.c	Fri Dec 01 18:11:00 2006 -0500
@@@@ -30,7 +30,7 @@@@ static int unionfs_unlink_whiteout(struc
 
 	bindex = dbstart(dentry);
 
-	hidden_dentry = dtohd_index(dentry, bindex);
+	hidden_dentry = unionfs_lower_dentry_index(dentry, bindex);
 	if (!hidden_dentry)
 		goto out;
 
@@@@ -97,7 +97,7 @@@@ static int unionfs_rmdir_first(struct in
 		goto out;
 	}
 
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
 
 	hidden_dir_dentry = lock_parent(hidden_dentry);
 
diff -r 3ab2c76610b7 fs/unionfs/xattr.c
--- a/fs/unionfs/xattr.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/xattr.c	Fri Dec 01 18:11:00 2006 -0500
@@@@ -58,7 +58,7 @@@@ ssize_t unionfs_getxattr(struct dentry *
 
 	lock_dentry(dentry);
 
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
 
 	err = vfs_getxattr(hidden_dentry, (char*) name, value, size);
 
@@@@ -76,7 +76,7 @@@@ int unionfs_setxattr(struct dentry *dent
 	int err = -EOPNOTSUPP;
 
 	lock_dentry(dentry);
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
 
 	err = vfs_setxattr(hidden_dentry, (char*) name, (void*) value, size, flags);
 
@@@@ -93,7 +93,7 @@@@ int unionfs_removexattr(struct dentry *d
 	int err = -EOPNOTSUPP;
 
 	lock_dentry(dentry);
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
 
 	err = vfs_removexattr(hidden_dentry, (char*) name);
 
@@@@ -112,7 +112,7 @@@@ ssize_t unionfs_listxattr(struct dentry 
 
 	lock_dentry(dentry);
 
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
 
 	encoded_list = list;
 	err = vfs_listxattr(hidden_dentry, encoded_list, size);
@


1.1.2.5
log
@Even more macro stuff
@
text
@d3 1
a3 1
+++ b/fs/unionfs/branchman.c	Fri Dec 01 19:14:47 2006 -0500
d23 1
a23 1
+		hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
d29 1
a29 1
+++ b/fs/unionfs/commonfops.c	Fri Dec 01 19:14:47 2006 -0500
d35 1
a35 1
+	hidden_dentry = unionfs_lower_dentry_idx(dentry, bstart);
d44 1
a44 1
+	hidden_dentry = unionfs_lower_dentry_idx(dentry, dbstart(dentry));
d61 1
a61 1
+		if (unionfs_lower_file_idx(file, bindex)) {
d70 1
a70 1
+			fput(unionfs_lower_file_idx(file, bindex));
d85 1
a85 1
+		hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
d91 1
a91 1
+		mntget(unionfs_lower_mnt_idx(dentry, bindex));
d96 1
a96 1
+				unionfs_lower_mnt_idx(dentry, bindex),
d103 1
a103 1
+			unionfs_set_lower_file_idx(file, bindex, hidden_file);
d129 1
a129 1
+	mntget(unionfs_lower_mnt_idx(dentry, bstart));
d133 1
a133 1
+			unionfs_lower_mnt_idx(dentry, bstart), file->f_flags);
d148 1
a148 1
+			if (unionfs_lower_file_idx(file, bindex)) {
d152 2
a153 2
+				fput(unionfs_lower_file_idx(file, bindex));
+				unionfs_set_lower_file_idx(file, bindex, NULL);
d211 1
a211 1
+		hidden_dentry = unionfs_lower_dentry_idx(file->f_dentry, bindex);
d217 1
a217 1
+		mntget(unionfs_lower_mnt_idx(file->f_dentry, bindex));
d220 1
a220 1
+					unionfs_lower_mnt_idx(file->f_dentry, bindex),
d226 1
a226 1
+		unionfs_set_lower_file_idx(file, bindex, hidden_file);
d244 1
a244 1
+	mntget(unionfs_lower_mnt_idx(file->f_dentry, bstart));
d247 1
a247 1
+				  unionfs_lower_mnt_idx(file->f_dentry, bstart),
d297 1
a297 1
+			hidden_file = unionfs_lower_file_idx(file, bindex);
d323 1
a323 1
+		hidden_file = unionfs_lower_file_idx(file, bindex);
d389 1
a389 1
+		hidden_file = unionfs_lower_file_idx(file, bindex);
d399 2
a400 2
+				dput(unionfs_lower_dentry_idx(file->f_dentry, bindex));
+				unionfs_set_lower_dentry_idx(file->f_dentry, bindex, NULL);
a403 134
diff -r 3ab2c76610b7 fs/unionfs/copyup.c
--- a/fs/unionfs/copyup.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/copyup.c	Fri Dec 01 19:14:47 2006 -0500
@@@@ -198,10 +198,10 @@@@ static inline int __copyup_reg_data(stru
 	int err = 0;
 
 	/* open old file */
-	mntget(dtohm_index(dentry, old_bindex));
+	mntget(unionfs_lower_mnt_idx(dentry, old_bindex));
 	branchget(sb, old_bindex);
 	input_file = dentry_open(old_hidden_dentry,
-			dtohm_index(dentry, old_bindex), O_RDONLY | O_LARGEFILE);
+			unionfs_lower_mnt_idx(dentry, old_bindex), O_RDONLY | O_LARGEFILE);
 	if (IS_ERR(input_file)) {
 		dput(old_hidden_dentry);
 		err = PTR_ERR(input_file);
@@@@ -214,10 +214,10 @@@@ static inline int __copyup_reg_data(stru
 
 	/* open new file */
 	dget(new_hidden_dentry);
-	mntget(dtohm_index(dentry, new_bindex));
+	mntget(unionfs_lower_mnt_idx(dentry, new_bindex));
 	branchget(sb, new_bindex);
 	output_file = dentry_open(new_hidden_dentry,
-			dtohm_index(dentry, new_bindex), O_WRONLY | O_LARGEFILE);
+			unionfs_lower_mnt_idx(dentry, new_bindex), O_WRONLY | O_LARGEFILE);
 	if (IS_ERR(output_file)) {
 		err = PTR_ERR(output_file);
 		goto out_close_in2;
@@@@ -303,7 +303,7 @@@@ static inline void __clear(struct dentry
 			   int new_bindex)
 {
 	/* get rid of the hidden dentry and all its traces */
-	set_dtohd_index(dentry, new_bindex, NULL);
+	unionfs_set_lower_dentry_idx(dentry, new_bindex, NULL);
 	set_dbstart(dentry, old_bstart);
 	set_dbend(dentry, old_bend);
 
@@@@ -352,7 +352,7 @@@@ int copyup_named_dentry(struct inode *di
 		goto out;
 	}
 
-	old_hidden_dentry = dtohd_index(dentry, old_bindex);
+	old_hidden_dentry = unionfs_lower_dentry_idx(dentry, old_bindex);
 	dget(old_hidden_dentry);
 
 	/* For symlinks, we must read the link before we lock the directory. */
@@@@ -462,7 +462,7 @@@@ int copyup_named_file(struct inode *dir,
 				  len);
 	if (!err) {
 		fbstart(file) = new_bindex;
-		set_ftohf_index(file, new_bindex, output_file);
+		unionfs_set_lower_file_idx(file, new_bindex, output_file);
 	}
 
 	return err;
@@@@ -481,7 +481,7 @@@@ int copyup_file(struct inode *dir, struc
 			    &output_file, len);
 	if (!err) {
 		fbstart(file) = new_bindex;
-		set_ftohf_index(file, new_bindex, output_file);
+		unionfs_set_lower_file_idx(file, new_bindex, output_file);
 	}
 
 	return err;
@@@@ -515,7 +515,7 @@@@ static inline void __cleanup_dentry(stru
 	 * bindex (the newly looked dentry
 	 */
 	for (i = loop_start; i <= loop_end; i++) {
-		if (!dtohd_index(dentry, i))
+		if (!unionfs_lower_dentry_idx(dentry, i))
 			continue;
 
 		if (i == bindex) {
@@@@ -525,9 +525,9 @@@@ static inline void __cleanup_dentry(stru
 			continue;
 		}
 
-		if (!dtohd_index(dentry, i)->d_inode) {
-			dput(dtohd_index(dentry, i));
-			set_dtohd_index(dentry, i, NULL);
+		if (!unionfs_lower_dentry_idx(dentry, i)->d_inode) {
+			dput(unionfs_lower_dentry_idx(dentry, i));
+			unionfs_set_lower_dentry_idx(dentry, i, NULL);
 		} else {
 			if (new_bstart < 0)
 				new_bstart = i;
@@@@ -546,7 +546,7 @@@@ static inline void __set_inode(struct de
 static inline void __set_inode(struct dentry * upper, struct dentry * lower,
 				int bindex)
 {
-	set_itohi_index(upper->d_inode, bindex,
+	unionfs_set_lower_inode_idx(upper->d_inode, bindex,
 			igrab(lower->d_inode));
 	if (likely(ibstart(upper->d_inode) > bindex))
 		ibstart(upper->d_inode) = bindex;
@@@@ -557,7 +557,7 @@@@ static inline void __set_dentry(struct d
 static inline void __set_dentry(struct dentry * upper, struct dentry * lower,
 				int bindex)
 {
-	set_dtohd_index(upper, bindex, lower);
+	unionfs_set_lower_dentry_idx(upper, bindex, lower);
 	if (likely(dbstart(upper) > bindex))
 		set_dbstart(upper, bindex);
 	if (likely(dbend(upper) < bindex))
@@@@ -626,7 +626,7 @@@@ struct dentry *create_parents_named(stru
 		lock_dentry(parent_dentry);
 
 		/* find out the hidden_parent_dentry in the given branch */
-		hidden_parent_dentry = dtohd_index(parent_dentry, bindex);
+		hidden_parent_dentry = unionfs_lower_dentry_idx(parent_dentry, bindex);
 
 		/* store the child dentry */
 		path[count++] = child_dentry;
@@@@ -657,7 +657,7 @@@@ struct dentry *create_parents_named(stru
 	 * horrible to follow and should be replaced with cleaner code. */
 	while (1) {
 		/* get hidden parent dir in the current branch */
-		hidden_parent_dentry = dtohd_index(parent_dentry, bindex);
+		hidden_parent_dentry = unionfs_lower_dentry_idx(parent_dentry, bindex);
 		unlock_dentry(parent_dentry);
 
 		/* init the values to lookup */
@@@@ -682,8 +682,8 @@@@ struct dentry *create_parents_named(stru
 				goto out;
 
 			/* Replace the current dentry (if any) with the new one. */
-			dput(dtohd_index(dentry, bindex));
-			set_dtohd_index(dentry, bindex, hidden_dentry);
+			dput(unionfs_lower_dentry_idx(dentry, bindex));
+			unionfs_set_lower_dentry_idx(dentry, bindex, hidden_dentry);
 
 			__cleanup_dentry(dentry, bindex, old_bstart, old_bend);
 			break;
d406 1
a406 1
+++ b/fs/unionfs/dentry.c	Fri Dec 01 19:32:26 2006 -0500
d432 1
a432 1
+				    unionfs_lower_dentry_idx(dentry, bindex);
d441 1
a441 1
+					    unionfs_lower_inode_idx(dentry->d_inode,
d469 1
a469 1
+		hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
d482 1
a482 1
@@@@ -200,14 +200,12 @@@@ void unionfs_d_release(struct dentry *de
d494 2
a495 1
-		   but this is a better check */
d498 1
a498 2
 		goto out_free;
@@@@ -217,20 +215,20 @@@@ void unionfs_d_release(struct dentry *de
d507 2
a508 2
+		dput(unionfs_lower_dentry_idx(dentry, bindex));
+		mntput(unionfs_lower_mnt_idx(dentry, bindex));
d510 2
a511 2
+		unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
+		unionfs_set_lower_mnt_idx(dentry, bindex, NULL);
d530 1
a530 1
+++ b/fs/unionfs/dirfops.c	Fri Dec 01 19:14:47 2006 -0500
d586 1
a586 1
+		hidden_file = unionfs_lower_file_idx(file, uds->bindex);
d669 1
a669 1
+++ b/fs/unionfs/dirhelper.c	Fri Dec 01 19:14:47 2006 -0500
d675 1
a675 1
+	hidden_dir_dentry = unionfs_lower_dentry_idx(dentry, bindex);
d695 1
a695 1
+	hidden_dir_dentry = unionfs_lower_dentry_idx(dentry, bindex);
d713 1
a713 1
+		hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
d722 1
a722 1
+		mntget(unionfs_lower_mnt_idx(dentry, bindex));
d726 1
a726 1
+		    dentry_open(hidden_dentry, unionfs_lower_mnt_idx(dentry, bindex),
d741 1
a741 1
+++ b/fs/unionfs/fanout.h	Fri Dec 01 19:14:47 2006 -0500
d789 1
a789 1
+static inline struct file *unionfs_lower_file_idx(const struct file *f, int index)
d796 1
a796 1
+static inline void unionfs_set_lower_file_idx(struct file *f, int index, struct file *val)
d818 1
a818 1
+static inline struct inode *unionfs_lower_inode_idx(const struct inode *i, int index)
d825 1
a825 1
+static inline void unionfs_set_lower_inode_idx(struct inode *i, int index,
d848 1
a848 1
+static inline struct super_block *unionfs_lower_super_idx(const struct super_block *o, int index)
d855 1
a855 1
+static inline void unionfs_set_lower_super_idx(struct super_block *o, int index,
d917 1
a917 1
+static inline void unionfs_set_lower_dentry_idx(struct dentry *dent, int index,
d925 1
a925 1
+static inline struct dentry *unionfs_lower_dentry_idx(const struct dentry *dent, int index)
d935 1
a935 1
+	return unionfs_lower_dentry_idx(dent, dbstart(dent));
d939 1
a939 1
+static inline void unionfs_set_lower_mnt_idx(struct dentry *dent, int index,
d947 1
a947 1
+static inline struct vfsmount *unionfs_lower_mnt_idx(const struct dentry *dent, int index)
d957 1
a957 1
+	return unionfs_lower_mnt_idx(dent,dbstart(dent));
d973 21
a993 6
diff -r 3ab2c76610b7 fs/unionfs/file.c
--- a/fs/unionfs/file.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/file.c	Fri Dec 01 19:14:47 2006 -0500
@@@@ -35,7 +35,7 @@@@ static loff_t unionfs_llseek(struct file
 	if ((err = unionfs_file_revalidate(file, 0)))
 		goto out;
d995 2
a996 4
-	hidden_file = ftohf(file);
+	hidden_file = unionfs_lower_file(file);
 	/* always set hidden position to this one */
 	hidden_file->f_pos = file->f_pos;
d998 4
a1001 3
@@@@ -64,7 +64,7 @@@@ ssize_t __unionfs_read(struct file * fil
 	struct file *hidden_file = NULL;
 	loff_t pos = *ppos;
d1003 6
a1008 4
-	hidden_file = ftohf(file);
+	hidden_file = unionfs_lower_file(file);
 	if (!hidden_file->f_op || !hidden_file->f_op->read)
 		goto out;
d1010 22
a1031 1
@@@@ -106,7 +106,7 @@@@ ssize_t __unionfs_write(struct file * fi
d1033 9
a1041 1
 	BUG_ON(bstart == -1);
d1043 6
a1048 3
-	hidden_file = ftohf(file);
+	hidden_file = unionfs_lower_file(file);
 	hidden_inode = hidden_file->f_dentry->d_inode;
a1049 2
 	if (!hidden_file->f_op || !hidden_file->f_op->write)
@@@@ -165,7 +165,7 @@@@ static unsigned int unionfs_poll(struct 
d1052 6
d1059 16
a1074 2
-	hidden_file = ftohf(file);
+	hidden_file = unionfs_lower_file(file);
d1076 18
a1093 5
 	if (!hidden_file->f_op || !hidden_file->f_op->poll)
 		goto out;
@@@@ -181,7 +181,7 @@@@ static int __do_mmap(struct file *file, 
 	int err;
 	struct file *hidden_file;
d1095 11
a1105 2
-	hidden_file = ftohf(file);
+	hidden_file = unionfs_lower_file(file);
d1107 3
a1109 5
 	err = -ENODEV;
 	if (!hidden_file->f_op || !hidden_file->f_op->mmap)
@@@@ -224,7 +224,7 @@@@ static int unionfs_fsync(struct file *fi
 	if ((err = unionfs_file_revalidate(file, 1)))
 		goto out;
d1111 3
a1113 2
-	hidden_file = ftohf(file);
+	hidden_file = unionfs_lower_file(file);
d1115 33
a1147 5
 	err = -EINVAL;
 	if (!hidden_file->f_op || !hidden_file->f_op->fsync)
@@@@ -248,7 +248,7 @@@@ static int unionfs_fasync(int fd, struct
 	if ((err = unionfs_file_revalidate(file, 1)))
 		goto out;
d1149 3
a1151 2
-	hidden_file = ftohf(file);
+	hidden_file = unionfs_lower_file(file);
d1153 19
a1171 6
 	if (hidden_file->f_op && hidden_file->f_op->fasync)
 		err = hidden_file->f_op->fasync(fd, hidden_file, flag);
diff -r 3ab2c76610b7 fs/unionfs/inode.c
--- a/fs/unionfs/inode.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/inode.c	Fri Dec 01 19:14:47 2006 -0500
@@@@ -41,7 +41,7 @@@@ static int unionfs_create(struct inode *
d1173 2
a1174 4
 	/* We start out in the leftmost branch. */
 	bstart = dbstart(dentry);
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
d1176 2
a1177 5
 	/* check if whiteout exists in this branch, i.e. lookup .wh.foo first */
 	name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
@@@@ -90,7 +90,7 @@@@ static int unionfs_create(struct inode *
 			       "unionfs: %s:%d: notify_change failed: %d, ignoring..\n",
 			       __FILE__, __LINE__, err);
d1179 3
a1181 3
-		new_hidden_dentry = dtohd(dentry);
+		new_hidden_dentry = unionfs_lower_dentry(dentry);
 		dget(new_hidden_dentry);
d1183 10
a1192 3
 		hidden_dir_dentry = dget_parent(whiteout_dentry);
@@@@ -128,10 +128,10 @@@@ static int unionfs_create(struct inode *
 			/* reset the unionfs dentry to point to the .wh.foo entry. */
d1194 22
a1215 3
 			/* Discard any old reference. */
-			dput(dtohd(dentry));
+			dput(unionfs_lower_dentry(dentry));
d1217 32
a1248 7
 			/* Trade one reference to another. */
-			set_dtohd_index(dentry, bstart, whiteout_dentry);
+			unionfs_set_lower_dentry_idx(dentry, bstart, whiteout_dentry);
 			whiteout_dentry = NULL;
 
 			err = unionfs_interpose(dentry, parent->i_sb, 0);
@@@@ -140,7 +140,7 @@@@ static int unionfs_create(struct inode *
d1251 1
a1251 1
 	for (bindex = bstart; bindex >= 0; bindex--) {
d1253 1
a1253 1
+		hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
d1255 4
a1258 3
 			/* if hidden_dentry is NULL, create the entire
 			 * dentry directory structure in branch 'bindex'.
@@@@ -220,7 +220,7 @@@@ static int unionfs_link(struct dentry *o
d1260 3
a1262 1
 	double_lock_dentry(new_dentry, old_dentry);
d1264 2
a1265 8
-	hidden_new_dentry = dtohd(new_dentry);
+	hidden_new_dentry = unionfs_lower_dentry(new_dentry);
 
 	/* check if whiteout exists in the branch of new dentry, i.e. lookup
 	 * .wh.foo first. If present, delete it */
@@@@ -267,8 +267,8 @@@@ static int unionfs_link(struct dentry *o
 		if (!hidden_new_dentry || IS_ERR(hidden_new_dentry))
 			goto out;
a1266 4
-	hidden_new_dentry = dtohd(new_dentry);
-	hidden_old_dentry = dtohd(old_dentry);
+	hidden_new_dentry = unionfs_lower_dentry(new_dentry);
+	hidden_old_dentry = unionfs_lower_dentry(old_dentry);
d1268 2
a1269 14
 	BUG_ON(dbstart(old_dentry) != dbstart(new_dentry));
 	hidden_dir_dentry = lock_parent(hidden_new_dentry);
@@@@ -292,7 +292,7 @@@@ docopyup:
 			if (!err) {
 				hidden_new_dentry =
 				    create_parents(dir, new_dentry, bindex);
-				hidden_old_dentry = dtohd(old_dentry);
+				hidden_old_dentry = unionfs_lower_dentry(old_dentry);
 				hidden_dir_dentry =
 				    lock_parent(hidden_new_dentry);
 				/* do vfs_link */
@@@@ -347,7 +347,7 @@@@ static int unionfs_symlink(struct inode 
 	/* We start out in the leftmost branch. */
 	bstart = dbstart(dentry);
d1271 3
a1273 2
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
d1275 6
a1280 6
 	/* check if whiteout exists in this branch, i.e. lookup .wh.foo first. If present, delete it */
 	name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
@@@@ -396,7 +396,7 @@@@ static int unionfs_symlink(struct inode 
 	/* deleted whiteout if it was present, now do a normal vfs_symlink() with
 	   possible recursive directory creation */
 	for (bindex = bstart; bindex >= 0; bindex--) {
d1282 3
a1284 7
+		hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
 		if (!hidden_dentry) {
 			/* if hidden_dentry is NULL, create the entire
 			 * dentry directory structure in branch 'bindex'. hidden_dentry will NOT be null when
@@@@ -464,7 +464,7 @@@@ static int unionfs_mkdir(struct inode *p
 	lock_dentry(dentry);
 	bstart = dbstart(dentry);
d1286 1
a1286 7
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
 
 	/* check if whiteout exists in this branch, i.e. lookup .wh.foo first */
 	name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
@@@@ -514,7 +514,7 @@@@ static int unionfs_mkdir(struct inode *p
 		if (is_robranch_super(dentry->d_sb, bindex))
d1288 11
d1300 10
a1309 7
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
 		if (!hidden_dentry) {
 			hidden_dentry = create_parents(parent, dentry, bindex);
 			if (!hidden_dentry || IS_ERR(hidden_dentry)) {
@@@@ -541,9 +541,9 @@@@ static int unionfs_mkdir(struct inode *p
 			break;
d1311 10
a1320 8
 		for (i = bindex + 1; i < bend; i++) {
-			if (dtohd_index(dentry, i)) {
-				dput(dtohd_index(dentry, i));
-				set_dtohd_index(dentry, i, NULL);
+			if (unionfs_lower_dentry_idx(dentry, i)) {
+				dput(unionfs_lower_dentry_idx(dentry, i));
+				unionfs_set_lower_dentry_idx(dentry, i, NULL);
 			}
a1321 4
 		set_dbend(dentry, bindex);
@@@@ -592,7 +592,7 @@@@ static int unionfs_mknod(struct inode *d
 	lock_dentry(dentry);
 	bstart = dbstart(dentry);
d1323 31
a1353 2
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
d1355 13
a1367 5
 	/* check if whiteout exists in this branch, i.e. lookup .wh.foo first */
 	name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
@@@@ -638,7 +638,7 @@@@ static int unionfs_mknod(struct inode *d
 		if (is_robranch_super(dentry->d_sb, bindex))
 			continue;
d1369 4
a1372 7
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
 		if (!hidden_dentry) {
 			hidden_dentry = create_parents(dir, dentry, bindex);
 			if (IS_ERR(hidden_dentry)) {
@@@@ -695,7 +695,7 @@@@ int unionfs_readlink(struct dentry *dent
 	struct dentry *hidden_dentry;
d1374 20
a1393 3
 	lock_dentry(dentry);
-	hidden_dentry = dtohd(dentry);
+	hidden_dentry = unionfs_lower_dentry(dentry);
d1395 4
a1398 4
 	if (!hidden_dentry->d_inode->i_op ||
 	    !hidden_dentry->d_inode->i_op->readlink) {
@@@@ -811,7 +811,7 @@@@ static int unionfs_permission(struct ino
 	bend = ibend(inode);
d1400 10
a1409 5
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_inode = itohi_index(inode, bindex);
+		hidden_inode = unionfs_lower_inode_idx(inode, bindex);
 		if (!hidden_inode)
 			continue;
d1411 4
a1414 2
@@@@ -859,7 +859,7 @@@@ static int unionfs_setattr(struct dentry
 	inode = dentry->d_inode;
d1416 1
a1416 7
 	for (bindex = bstart; (bindex <= bend) || (bindex == bstart); bindex++) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
 		if (!hidden_dentry)
 			continue;
 		BUG_ON(hidden_dentry->d_inode == NULL);
@@@@ -880,7 +880,7 @@@@ static int unionfs_setattr(struct dentry
d1418 2
a1419 8
 				if (!err) {
 					copyup = 1;
-					hidden_dentry = dtohd(dentry);
+					hidden_dentry = unionfs_lower_dentry(dentry);
 					break;
 				}
 				/* if error is in the leftmost branch, pass it up */
@@@@ -896,7 +896,7 @@@@ static int unionfs_setattr(struct dentry
d1422 8
a1429 4
 	/* get the size from the first hidden inode */
-	hidden_inode = itohi(dentry->d_inode);
+	hidden_inode = unionfs_lower_inode(dentry->d_inode);
 	fsstack_copy_attr_all(inode, hidden_inode, unionfs_get_nlinks);
d1431 1
d1433 25
a1457 10
diff -r 3ab2c76610b7 fs/unionfs/lookup.c
--- a/fs/unionfs/lookup.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/lookup.c	Fri Dec 01 19:14:47 2006 -0500
@@@@ -48,7 +48,7 @@@@ struct dentry *unionfs_lookup_backend(st
 	    || lookupmode == INTERPOSE_REVAL_NEG)
 		verify_locked(dentry);
 	else {
-		BUG_ON(dtopd_nocheck(dentry) != NULL);
+		BUG_ON(UNIONFS_D(dentry) != NULL);
 		locked_child = 1;
d1459 4
a1462 2
 	if (lookupmode != INTERPOSE_PARTIAL)
@@@@ -93,12 +93,12 @@@@ struct dentry *unionfs_lookup_backend(st
d1465 6
d1472 15
a1486 5
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
 		if (lookupmode == INTERPOSE_PARTIAL && hidden_dentry)
 			continue;
 		BUG_ON(hidden_dentry != NULL);
d1488 2
a1489 2
-		hidden_dir_dentry = dtohd_index(parent_dentry, bindex);
+		hidden_dir_dentry = unionfs_lower_dentry_idx(parent_dentry, bindex);
d1491 5
a1495 4
 		/* if the parent hidden dentry does not exist skip this */
 		if (!(hidden_dir_dentry && hidden_dir_dentry->d_inode))
@@@@ -148,9 +148,9 @@@@ struct dentry *unionfs_lookup_backend(st
 		wh_hidden_dentry = NULL;
d1497 3
a1499 6
 		/* Now do regular lookup; lookup foo */
-		nd->dentry = dtohd_index(dentry, bindex);
+		nd->dentry = unionfs_lower_dentry_idx(dentry, bindex);
 		/* FIXME: fix following line for mount point crossing */
-		nd->mnt = dtohm_index(parent_dentry, bindex);
+		nd->mnt = unionfs_lower_mnt_idx(parent_dentry, bindex);
d1501 13
a1513 22
 		hidden_dentry = lookup_one_len_nd(name, hidden_dir_dentry,
 					       namelen, nd);
@@@@ -168,7 +168,7 @@@@ struct dentry *unionfs_lookup_backend(st
 				first_hidden_dentry = hidden_dentry;
 				/* FIXME: following line needs to be changed
 				 * to allow mountpoint crossing */
-				first_hidden_mnt = mntget(dtohm_index(parent_dentry, bindex));
+				first_hidden_mnt = mntget(unionfs_lower_mnt_idx(parent_dentry, bindex));
 				first_dentry_offset = bindex;
 			} else
 				dput(hidden_dentry);
@@@@ -182,10 +182,10 @@@@ struct dentry *unionfs_lookup_backend(st
 		/* store underlying dentry */
 		if (dbstart(dentry) == -1)
 			set_dbstart(dentry, bindex);
-		set_dtohd_index(dentry, bindex, hidden_dentry);
+		unionfs_set_lower_dentry_idx(dentry, bindex, hidden_dentry);
 		/* FIXME: the following line needs to get fixed to allow
 		 * mountpoint crossing */
-		set_dtohm_index(dentry, bindex, mntget(dtohm_index(parent_dentry, bindex)));
+		unionfs_set_lower_mnt_idx(dentry, bindex, mntget(unionfs_lower_mnt_idx(parent_dentry, bindex)));
 		set_dbend(dentry, bindex);
d1515 3
a1517 9
 		/* update parent directory's atime with the bindex */
@@@@ -199,7 +199,7 @@@@ struct dentry *unionfs_lookup_backend(st
 			if (dentry_count == 1)
 				goto out_positive;
 			/* This can only happen with mixed D-*-F-* */
-			BUG_ON(!S_ISDIR(dtohd(dentry)->d_inode->i_mode));
+			BUG_ON(!S_ISDIR(unionfs_lower_dentry(dentry)->d_inode->i_mode));
 			continue;
 		}
d1519 4
a1522 6
@@@@ -229,7 +229,7 @@@@ out_negative:
 	/* If we've only got negative dentries, then use the leftmost one. */
 	if (lookupmode == INTERPOSE_REVAL) {
 		if (dentry->d_inode)
-			itopd(dentry->d_inode)->uii_stale = 1;
+			UNIONFS_I(dentry->d_inode)->stale = 1;
d1524 7
a1530 1
 		goto out;
d1532 15
a1546 6
@@@@ -237,7 +237,7 @@@@ out_negative:
 	if (first_dentry_offset == -1) {
 		nd->dentry = dentry;
 		/* FIXME: fix following line for mount point crossing */
-		nd->mnt = dtohm_index(parent_dentry, bindex);
+		nd->mnt = unionfs_lower_mnt_idx(parent_dentry, bindex);
d1548 11
a1558 16
 		first_hidden_dentry = lookup_one_len_nd(name, hidden_dir_dentry,
 						     namelen, nd);
@@@@ -249,10 +249,10 @@@@ out_negative:
 		
 		/* FIXME: the following line needs to be changed to allow
 		 * mountpoint crossing */
-		first_hidden_mnt = mntget(dtohm_index(dentry, bindex));
-	}
-	set_dtohd_index(dentry, first_dentry_offset, first_hidden_dentry);
-	set_dtohm_index(dentry, first_dentry_offset, first_hidden_mnt);
+		first_hidden_mnt = mntget(unionfs_lower_mnt_idx(dentry, bindex));
+	}
+	unionfs_set_lower_dentry_idx(dentry, first_dentry_offset, first_hidden_dentry);
+	unionfs_set_lower_mnt_idx(dentry, first_dentry_offset, first_hidden_mnt);
 	set_dbstart(dentry, first_dentry_offset);
 	set_dbend(dentry, first_dentry_offset);
d1560 7
a1566 18
@@@@ -302,18 +302,18 @@@@ out_free:
 	if (bstart >= 0) {
 		bend = dbend(dentry);
 		for (bindex = bstart; bindex <= bend; bindex++) {
-			dput(dtohd_index(dentry, bindex));
-			mntput(dtohm_index(dentry, bindex));
-		}
-	}
-	kfree(dtohp_ptr(dentry));
-	dtohp_ptr(dentry) = NULL;
+			dput(unionfs_lower_dentry_idx(dentry, bindex));
+			mntput(unionfs_lower_mnt_idx(dentry, bindex));
+		}
+	}
+	kfree(UNIONFS_D(dentry)->lower_paths);
+	UNIONFS_D(dentry)->lower_paths = NULL;
 	set_dbstart(dentry, -1);
 	set_dbend(dentry, -1);
d1569 4
a1572 6
-	if (!err && dtopd(dentry)) {
-		BUG_ON(dbend(dentry) > dtopd(dentry)->udi_bcount);
+	if (!err && UNIONFS_D(dentry)) {
+		BUG_ON(dbend(dentry) > UNIONFS_D(dentry)->bcount);
 		BUG_ON(dbend(dentry) > sbmax(dentry->d_sb));
 		BUG_ON(dbstart(dentry) < 0);
d1574 7
a1580 3
@@@@ -351,7 +351,7 @@@@ static int is_opaque_dir(struct dentry *
 	struct inode *hidden_inode;
 	struct sioq_args args;
d1582 4
a1585 3
-	hidden_dentry = dtohd_index(dentry, bindex);
+	hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
 	hidden_inode = hidden_dentry->d_inode;
d1587 4
a1590 3
 	BUG_ON(!S_ISDIR(hidden_inode->i_mode));
@@@@ -425,23 +425,23 @@@@ int new_dentry_private_data(struct dentr
 	int oldsize = 0;
d1592 6
a1597 10
 	spin_lock(&dentry->d_lock);
-	if (!dtopd(dentry)) {
-		dtopd_lhs(dentry) = (struct unionfs_dentry_info *)
+	if (!UNIONFS_D(dentry)) {
+		dentry->d_fsdata = (struct unionfs_dentry_info *)
 		    kmem_cache_alloc(unionfs_dentry_cachep, SLAB_ATOMIC);
-		if (!dtopd(dentry))
+		if (!UNIONFS_D(dentry))
 			goto out;
-		init_MUTEX_LOCKED(&dtopd_nocheck(dentry)->udi_sem);
d1599 2
a1600 2
-		dtohp_ptr(dentry) = NULL;
+		init_MUTEX_LOCKED(&UNIONFS_D(dentry)->sem);
d1602 31
a1632 19
+		UNIONFS_D(dentry)->lower_paths = NULL;
 	} else
-		oldsize = sizeof(struct path) * dtopd(dentry)->udi_bcount;
-
-	dtopd(dentry)->udi_bstart = -1;
-	dtopd(dentry)->udi_bend = -1;
-	dtopd(dentry)->udi_bopaque = -1;
-	dtopd(dentry)->udi_bcount = sbmax(dentry->d_sb);
-	atomic_set(&dtopd(dentry)->udi_generation,
-		   atomic_read(&stopd(dentry->d_sb)->usi_generation));
+		oldsize = sizeof(struct path) * UNIONFS_D(dentry)->bcount;
+
+	UNIONFS_D(dentry)->bstart = -1;
+	UNIONFS_D(dentry)->bend = -1;
+	UNIONFS_D(dentry)->bopaque = -1;
+	UNIONFS_D(dentry)->bcount = sbmax(dentry->d_sb);
+	atomic_set(&UNIONFS_D(dentry)->generation,
+		   atomic_read(&UNIONFS_SB(dentry->d_sb)->generation));
 	newsize = sizeof(struct path) * sbmax(dentry->d_sb);
d1634 3
a1636 3
 	/* Don't reallocate when we already have enough space. */
@@@@ -452,28 +452,28 @@@@ int new_dentry_private_data(struct dentr
 		int minsize = malloc_sizes[0].cs_size;
d1638 8
a1645 5
 		if (!newsize || ((oldsize < newsize) && (newsize > minsize))) {
-			kfree(dtohp_ptr(dentry));
-			dtohp_ptr(dentry) = NULL;
-		}
-	}
d1647 11
a1657 7
-	if (!dtohp_ptr(dentry) && newsize) {
-		dtohp_ptr(dentry) = kmalloc(newsize, GFP_ATOMIC);
-		if (!dtohp_ptr(dentry))
+			kfree(UNIONFS_D(dentry)->lower_paths);
+			UNIONFS_D(dentry)->lower_paths = NULL;
+		}
+	}
d1659 10
a1668 5
+	if (!UNIONFS_D(dentry)->lower_paths && newsize) {
+		UNIONFS_D(dentry)->lower_paths = kmalloc(newsize, GFP_ATOMIC);
+		if (!UNIONFS_D(dentry)->lower_paths)
 			goto out_free;
 	}
d1670 5
a1674 2
-	memset(dtohp_ptr(dentry), 0, (oldsize > newsize ? oldsize : newsize));
+	memset(UNIONFS_D(dentry)->lower_paths, 0, (oldsize > newsize ? oldsize : newsize));
d1676 5
a1680 2
 	spin_unlock(&dentry->d_lock);
 	return 0;
d1682 3
a1684 3
 out_free:
-	kfree(dtohp_ptr(dentry));
+	kfree(UNIONFS_D(dentry)->lower_paths);
d1686 2
a1687 24
 out:
-	free_dentry_private_data(dtopd(dentry));
-	dtopd_lhs(dentry) = NULL;
+	free_dentry_private_data(UNIONFS_D(dentry));
+	dentry->d_fsdata = NULL;
 	spin_unlock(&dentry->d_lock);
 	return -ENOMEM;
 }
@@@@ -486,7 +486,7 @@@@ void update_bstart(struct dentry *dentry
 	struct dentry *hidden_dentry;
 
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
 		if (!hidden_dentry)
 			continue;
 		if (hidden_dentry->d_inode) {
@@@@ -494,7 +494,7 @@@@ void update_bstart(struct dentry *dentry
 			break;
 		}
 		dput(hidden_dentry);
-		set_dtohd_index(dentry, bindex, NULL);
-	}
-}
d1689 2
a1690 3
+		unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
+	}
+}
d1692 3
a1694 4
diff -r 3ab2c76610b7 fs/unionfs/main.c
--- a/fs/unionfs/main.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/main.c	Fri Dec 01 19:14:47 2006 -0500
@@@@ -37,8 +37,8 @@@@ int unionfs_interpose(struct dentry *den
d1696 11
a1706 7
 	/* Make sure that we didn't get a negative dentry. */
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		if (dtohd_index(dentry, bindex) &&
-		    dtohd_index(dentry, bindex)->d_inode) {
+		if (unionfs_lower_dentry_idx(dentry, bindex) &&
+		    unionfs_lower_dentry_idx(dentry, bindex)->d_inode) {
 			is_negative_dentry = 0;
d1709 2
a1710 24
@@@@ -54,14 +54,14 @@@@ int unionfs_interpose(struct dentry *den
 	 * to fix it up. */
 	if (flag == INTERPOSE_REVAL) {
 		inode = dentry->d_inode;
-		itopd(inode)->b_start = -1;
-		itopd(inode)->b_end = -1;
-		atomic_set(&itopd(inode)->uii_generation,
-			   atomic_read(&stopd(sb)->usi_generation));
-
-		itohi_ptr(inode) =
+		UNIONFS_I(inode)->bstart = -1;
+		UNIONFS_I(inode)->bend = -1;
+		atomic_set(&UNIONFS_I(inode)->generation,
+			   atomic_read(&UNIONFS_SB(sb)->generation));
+
+		UNIONFS_I(inode)->lower_inodes =
 		    kcalloc(sbmax(sb), sizeof(struct inode *), GFP_KERNEL);
-		if (!itohi_ptr(inode)) {
+		if (!UNIONFS_I(inode)->lower_inodes) {
 			err = -ENOMEM;
 			goto out;
 		}
@@@@ -83,9 +83,9 @@@@ int unionfs_interpose(struct dentry *den
 	}
d1712 5
a1716 8
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
 		if (!hidden_dentry) {
-			set_itohi_index(inode, bindex, NULL);
+			unionfs_set_lower_inode_idx(inode, bindex, NULL);
 			continue;
 		}
d1718 5
a1722 3
@@@@ -93,14 +93,14 @@@@ int unionfs_interpose(struct dentry *den
 		if (!hidden_dentry->d_inode)
 			continue;
d1724 2
a1725 3
-		set_itohi_index(inode, bindex, igrab(hidden_dentry->d_inode));
+		unionfs_set_lower_inode_idx(inode, bindex, igrab(hidden_dentry->d_inode));
 	}
d1727 8
a1734 2
 	ibstart(inode) = dbstart(dentry);
 	ibend(inode) = dbend(dentry);
d1736 4
a1739 3
 	/* Use attributes from the first branch. */
-	hidden_inode = itohi(inode);
+	hidden_inode = unionfs_lower_inode(inode);
d1741 5
a1745 10
 	/* Use different set of inode ops for symlinks & directories */
 	if (S_ISLNK(hidden_inode->i_mode))
@@@@ -162,15 +162,15 @@@@ void unionfs_reinterpose(struct dentry *
 	bstart = dbstart(dentry);
 	bend = dbend(dentry);
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
 		if (!hidden_dentry)
 			continue;
d1747 3
a1749 1
 		if (!hidden_dentry->d_inode)
d1751 12
a1762 21
-		if (itohi_index(inode, bindex))
-			continue;
-		set_itohi_index(inode, bindex, igrab(hidden_dentry->d_inode));
+		if (unionfs_lower_inode_idx(inode, bindex))
+			continue;
+		unionfs_set_lower_inode_idx(inode, bindex, igrab(hidden_dentry->d_inode));
 	}
 	ibstart(inode) = dbstart(dentry);
 	ibend(inode) = dbend(dentry);
@@@@ -251,16 +251,16 @@@@ static int parse_dirs_option(struct supe
 			branches++;
 
 	/* allocate space for underlying pointers to hidden dentry */
-	stopd(sb)->usi_data = kcalloc(branches,
-			sizeof(struct unionfs_usi_data), GFP_KERNEL);
-	if (!stopd(sb)->usi_data) {
+	UNIONFS_SB(sb)->data = kcalloc(branches,
+			sizeof(struct unionfs_data), GFP_KERNEL);
+	if (!UNIONFS_SB(sb)->data) {
 		err = -ENOMEM;
 		goto out;
d1765 8
a1772 7
-	hidden_root_info->udi_path = kcalloc(branches,
+	hidden_root_info->lower_paths = kcalloc(branches,
 			sizeof(struct path), GFP_KERNEL);
-	if (!hidden_root_info->udi_path) {
+	if (!hidden_root_info->lower_paths) {
 		err = -ENOMEM;
 		goto out;
a1773 3
@@@@ -296,15 +296,15 @@@@ static int parse_dirs_option(struct supe
 			goto out;
 		}
d1775 23
a1797 4
-		hidden_root_info->udi_path[bindex].dentry = nd.dentry;
-		hidden_root_info->udi_path[bindex].mnt = nd.mnt;
+		hidden_root_info->lower_paths[bindex].dentry = nd.dentry;
+		hidden_root_info->lower_paths[bindex].mnt = nd.mnt;
d1799 7
a1805 2
 		set_branchperms(sb, bindex, perms);
 		set_branch_count(sb, bindex, 0);
d1807 5
a1811 7
-		if (hidden_root_info->udi_bstart < 0)
-			hidden_root_info->udi_bstart = bindex;
-		hidden_root_info->udi_bend = bindex;
+		if (hidden_root_info->bstart < 0)
+			hidden_root_info->bstart = bindex;
+		hidden_root_info->bend = bindex;
 		bindex++;
d1814 18
a1831 3
@@@@ -314,13 +314,13 @@@@ static int parse_dirs_option(struct supe
 		goto out;
 	}
d1833 11
a1843 2
-	BUG_ON(branches != (hidden_root_info->udi_bend + 1));
+	BUG_ON(branches != (hidden_root_info->bend + 1));
d1845 8
a1852 7
 	/* 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_path[i].dentry;
-			dent2 = hidden_root_info->udi_path[j].dentry;
+			dent1 = hidden_root_info->lower_paths[i].dentry;
+			dent2 = hidden_root_info->lower_paths[j].dentry;
d1854 6
a1859 13
 			if (is_branch_overlap(dent1, dent2)) {
 				printk(KERN_WARNING "unionfs: branches %d and %d overlap\n", i, j);
@@@@ -333,19 +333,19 @@@@ out:
 out:
 	if (err) {
 		for (i = 0; i < branches; 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);
+			if (hidden_root_info->lower_paths[i].dentry) {
+				dput(hidden_root_info->lower_paths[i].dentry);
+				mntput(hidden_root_info->lower_paths[i].mnt);
 			}
d1861 2
a1862 4
-		kfree(hidden_root_info->udi_path);
-		kfree(stopd(sb)->usi_data);
+		kfree(hidden_root_info->lower_paths);
+		kfree(UNIONFS_SB(sb)->data);
d1864 1
a1864 20
 		/* MUST clear the pointers to prevent potential double free if
 		 * the caller dies later on
 		 */
-		hidden_root_info->udi_path = NULL;
-		stopd(sb)->usi_data = NULL;
+		hidden_root_info->lower_paths = NULL;
+		UNIONFS_SB(sb)->data = NULL;
 	}
 	return err;
 }
@@@@ -373,9 +373,9 @@@@ static struct unionfs_dentry_info *union
 	    kzalloc(sizeof(struct unionfs_dentry_info), GFP_KERNEL);
 	if (!hidden_root_info)
 		goto out_error;
-	hidden_root_info->udi_bstart = -1;
-	hidden_root_info->udi_bend = -1;
-	hidden_root_info->udi_bopaque = -1;
+	hidden_root_info->bstart = -1;
+	hidden_root_info->bend = -1;
+	hidden_root_info->bopaque = -1;
d1866 3
a1868 4
 	while ((optname = strsep(&options, ",")) != NULL) {
 		char *optarg;
@@@@ -433,15 +433,15 @@@@ static struct unionfs_dentry_info *union
 	goto out;
d1870 4
a1873 10
 out_error:
-	if (hidden_root_info && hidden_root_info->udi_path) {
-		for (bindex = hidden_root_info->udi_bstart;
-		     bindex >= 0 && bindex <= hidden_root_info->udi_bend;
+	if (hidden_root_info && hidden_root_info->lower_paths) {
+		for (bindex = hidden_root_info->bstart;
+		     bindex >= 0 && bindex <= hidden_root_info->bend;
 		     bindex++) {
 			struct dentry *d;
 			struct vfsmount *m;
d1875 8
a1882 4
-			d = hidden_root_info->udi_path[bindex].dentry;
-			m = hidden_root_info->udi_path[bindex].mnt;
+			d = hidden_root_info->lower_paths[bindex].dentry;
+			m = hidden_root_info->lower_paths[bindex].mnt;
d1884 9
a1892 3
 			dput(d);
 
@@@@ -450,11 +450,11 @@@@ out_error:
d1896 14
a1909 3
-	kfree(hidden_root_info->udi_path);
+	kfree(hidden_root_info->lower_paths);
 	kfree(hidden_root_info);
d1911 4
a1914 4
-	kfree(stopd(sb)->usi_data);
-	stopd(sb)->usi_data = NULL;
+	kfree(UNIONFS_SB(sb)->data);
+	UNIONFS_SB(sb)->data = NULL;
d1916 15
a1930 13
 	hidden_root_info = ERR_PTR(err);
 out:
@@@@ -496,15 +496,16 @@@@ static int unionfs_read_super(struct sup
 	/*
 	 * Allocate superblock private data
 	 */
-	stopd_lhs(sb) = kzalloc(sizeof(struct unionfs_sb_info), GFP_KERNEL);
-	if (!stopd(sb)) {
+	sb->s_fs_info = kzalloc(sizeof(struct unionfs_sb_info), GFP_KERNEL);
+	if (!UNIONFS_SB(sb)) {
 		printk(KERN_WARNING "%s: out of memory\n", __FUNCTION__);
 		err = -ENOMEM;
 		goto out;
d1932 13
a1944 7
-	stopd(sb)->b_end = -1;
-	atomic_set(&stopd(sb)->usi_generation, 1);
-	init_rwsem(&stopd(sb)->usi_rwsem);
+
+	UNIONFS_SB(sb)->bend = -1;
+	atomic_set(&UNIONFS_SB(sb)->generation, 1);
+	init_rwsem(&UNIONFS_SB(sb)->rwsem);
d1946 3
a1948 11
 	hidden_root_info = unionfs_parse_options(sb, raw_data);
 	if (IS_ERR(hidden_root_info)) {
@@@@ -515,25 +516,25 @@@@ static int unionfs_read_super(struct sup
 		hidden_root_info = NULL;
 		goto out_free;
 	}
-	if (hidden_root_info->udi_bstart == -1) {
+	if (hidden_root_info->bstart == -1) {
 		err = -ENOENT;
 		goto out_free;
 	}
d1950 1
a1950 6
 	/* set the hidden superblock field of upper superblock */
-	bstart = hidden_root_info->udi_bstart;
+	bstart = hidden_root_info->bstart;
 	BUG_ON(bstart != 0);
-	sbend(sb) = bend = hidden_root_info->udi_bend;
+	sbend(sb) = bend = hidden_root_info->bend;
d1952 16
a1967 1
 		struct dentry *d;
d1969 3
a1971 7
-		d = hidden_root_info->udi_path[bindex].dentry;
-
-		set_stohs_index(sb, bindex, d->d_sb);
+		d = hidden_root_info->lower_paths[bindex].dentry;
+
+		unionfs_set_lower_super_idx(sb, bindex, d->d_sb);
 	}
d1973 8
a1980 3
 	/* Unionfs: Max Bytes is the maximum bytes from highest priority branch */
-	sb->s_maxbytes = stohs_index(sb, 0)->s_maxbytes;
+	sb->s_maxbytes = unionfs_lower_super_idx(sb, 0)->s_maxbytes;
d1982 4
a1985 1
 	sb->s_op = &unionfs_sops;
d1987 29
a2015 2
@@@@ -549,7 +550,7 @@@@ static int unionfs_read_super(struct sup
 	}
d2017 20
a2036 5
 	/* link the upper and lower dentries */
-	dtopd_lhs(sb->s_root) = NULL;
+	sb->s_root->d_fsdata = NULL;
 	if ((err = new_dentry_private_data(sb->s_root)))
 		goto out_freedpd;
d2038 7
a2044 3
@@@@ -558,17 +559,17 @@@@ static int unionfs_read_super(struct sup
 		struct dentry *d;
 		struct vfsmount *m;
d2046 7
a2052 2
-		d = hidden_root_info->udi_path[bindex].dentry;
-		m = hidden_root_info->udi_path[bindex].mnt;
d2054 6
a2059 4
-		set_dtohd_index(sb->s_root, bindex, d);
-		set_dtohm_index(sb->s_root, bindex, m);
+		d = hidden_root_info->lower_paths[bindex].dentry;
+		m = hidden_root_info->lower_paths[bindex].mnt;
d2061 2
a2062 5
+		unionfs_set_lower_dentry_idx(sb->s_root, bindex, d);
+		unionfs_set_lower_mnt_idx(sb->s_root, bindex, m);
 	}
 	set_dbstart(sb->s_root, bstart);
 	set_dbend(sb->s_root, bend);
d2064 2
a2065 3
 	/* Set the generation number to one, since this is for the mount. */
-	atomic_set(&dtopd(sb->s_root)->udi_generation, 1);
+	atomic_set(&UNIONFS_D(sb->s_root)->generation, 1);
d2067 22
a2088 4
 	/* call interpose to create the upper level inode */
 	if ((err = unionfs_interpose(sb->s_root, sb, 0)))
@@@@ -577,21 +578,21 @@@@ static int unionfs_read_super(struct sup
 	goto out;
d2090 3
a2092 9
 out_freedpd:
-	if (dtopd(sb->s_root)) {
-		kfree(dtohp_ptr(sb->s_root));
-		free_dentry_private_data(dtopd(sb->s_root));
+	if (UNIONFS_D(sb->s_root)) {
+		kfree(UNIONFS_D(sb->s_root)->lower_paths);
+		free_dentry_private_data(UNIONFS_D(sb->s_root));
 	}
 	dput(sb->s_root);
d2094 3
a2096 8
 out_dput:
 	if (hidden_root_info && !IS_ERR(hidden_root_info)) {
-		for (bindex = hidden_root_info->udi_bstart;
-		     bindex <= hidden_root_info->udi_bend; bindex++) {
+		for (bindex = hidden_root_info->bstart;
+		     bindex <= hidden_root_info->bend; bindex++) {
 			struct dentry *d;
 			struct vfsmount *m;
d2098 12
a2109 4
-			d = hidden_root_info->udi_path[bindex].dentry;
-			m = hidden_root_info->udi_path[bindex].mnt;
+			d = hidden_root_info->lower_paths[bindex].dentry;
+			m = hidden_root_info->lower_paths[bindex].mnt;
d2111 8
a2118 11
 			if (d)
 				dput(d);
@@@@ -599,19 +600,19 @@@@ out_dput:
 			if (m)
 				mntput(m);
 		}
-		kfree(hidden_root_info->udi_path);
+		kfree(hidden_root_info->lower_paths);
 		kfree(hidden_root_info);
 		hidden_root_info = NULL;
 	}
d2120 7
a2126 7
 out_free:
-	kfree(stopd(sb)->usi_data);
-	kfree(stopd(sb));
-	stopd_lhs(sb) = NULL;
+	kfree(UNIONFS_SB(sb)->data);
+	kfree(UNIONFS_SB(sb));
+	sb->s_fs_info = NULL;
d2128 4
a2131 13
 out:
 	if (hidden_root_info && !IS_ERR(hidden_root_info)) {
-		kfree(hidden_root_info->udi_path);
+		kfree(hidden_root_info->lower_paths);
 		kfree(hidden_root_info);
 	}
 	return err;
diff -r 3ab2c76610b7 fs/unionfs/rdstate.c
--- a/fs/unionfs/rdstate.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/rdstate.c	Fri Dec 01 19:14:47 2006 -0500
@@@@ -63,11 +63,11 @@@@ static int guesstimate_hash_size(struct 
 	int bindex;
 	int hashsize = MINHASHSIZE;
d2133 3
a2135 4
-	if (itopd(inode)->uii_hashsize > 0)
-		return itopd(inode)->uii_hashsize;
+	if (UNIONFS_I(inode)->hashsize > 0)
+		return UNIONFS_I(inode)->hashsize;
d2138 3
a2140 2
-		if (!(hidden_inode = itohi_index(inode, bindex)))
+		if (!(hidden_inode = unionfs_lower_inode_idx(inode, bindex)))
d2142 4
d2147 6
a2152 3
 		if (hidden_inode->i_size == DENTPAGE) {
@@@@ -84,11 +84,11 @@@@ int init_rdstate(struct file *file)
 int init_rdstate(struct file *file)
d2154 4
a2157 16
 	BUG_ON(sizeof(loff_t) != (sizeof(unsigned int) + sizeof(unsigned int)));
-	BUG_ON(ftopd(file)->rdstate != NULL);
-
-	ftopd(file)->rdstate =
+	BUG_ON(UNIONFS_F(file)->rdstate != NULL);
+
+	UNIONFS_F(file)->rdstate =
 	    alloc_rdstate(file->f_dentry->d_inode, fbstart(file));
-	if (!ftopd(file)->rdstate)
+	if (!UNIONFS_F(file)->rdstate)
 		return -ENOMEM;
 	return 0;
 }
@@@@ -98,18 +98,18 @@@@ struct unionfs_dir_state *find_rdstate(s
 	struct unionfs_dir_state *rdstate = NULL;
 	struct list_head *pos;
d2159 1
a2159 19
-	spin_lock(&itopd(inode)->uii_rdlock);
-	list_for_each(pos, &itopd(inode)->uii_readdircache) {
+	spin_lock(&UNIONFS_I(inode)->rdlock);
+	list_for_each(pos, &UNIONFS_I(inode)->readdircache) {
 		struct unionfs_dir_state *r =
-		    list_entry(pos, struct unionfs_dir_state, uds_cache);
+		    list_entry(pos, struct unionfs_dir_state, cache);
 		if (fpos == rdstate2offset(r)) {
-			itopd(inode)->uii_rdcount--;
-			list_del(&r->uds_cache);
+			UNIONFS_I(inode)->rdcount--;
+			list_del(&r->cache);
 			rdstate = r;
 			break;
 		}
 	}
-	spin_unlock(&itopd(inode)->uii_rdlock);
+	spin_unlock(&UNIONFS_I(inode)->rdlock);
 	return rdstate;
d2162 13
a2174 3
@@@@ -143,22 +143,22 @@@@ struct unionfs_dir_state *alloc_rdstate(
 	if (!rdstate)
 		return NULL;
d2176 2
a2177 20
-	spin_lock(&itopd(inode)->uii_rdlock);
-	if (itopd(inode)->uii_cookie >= (MAXRDCOOKIE - 1))
-		itopd(inode)->uii_cookie = 1;
+	spin_lock(&UNIONFS_I(inode)->rdlock);
+	if (UNIONFS_I(inode)->cookie >= (MAXRDCOOKIE - 1))
+		UNIONFS_I(inode)->cookie = 1;
 	else
-		itopd(inode)->uii_cookie++;
-
-	rdstate->uds_cookie = itopd(inode)->uii_cookie;
-	spin_unlock(&itopd(inode)->uii_rdlock);
-	rdstate->uds_offset = 1;
-	rdstate->uds_access = jiffies;
-	rdstate->uds_bindex = bindex;
-	rdstate->uds_dirpos = 0;
-	rdstate->uds_hashentries = 0;
-	rdstate->uds_size = hashsize;
-	for (i = 0; i < rdstate->uds_size; i++)
-		INIT_LIST_HEAD(&rdstate->uds_list[i]);
+		UNIONFS_I(inode)->cookie++;
d2179 3
a2181 10
+	rdstate->cookie = UNIONFS_I(inode)->cookie;
+	spin_unlock(&UNIONFS_I(inode)->rdlock);
+	rdstate->offset = 1;
+	rdstate->access = jiffies;
+	rdstate->bindex = bindex;
+	rdstate->dirpos = 0;
+	rdstate->hashentries = 0;
+	rdstate->size = hashsize;
+	for (i = 0; i < rdstate->size; i++)
+		INIT_LIST_HEAD(&rdstate->list[i]);
d2183 1
a2183 1
 	return rdstate;
a2184 3
@@@@ -175,8 +175,8 @@@@ void free_rdstate(struct unionfs_dir_sta
 	struct filldir_node *tmp;
 	int i;
d2186 14
a2199 5
-	for (i = 0; i < state->uds_size; i++) {
-		struct list_head *head = &(state->uds_list[i]);
+	for (i = 0; i < state->size; i++) {
+		struct list_head *head = &(state->list[i]);
 		struct list_head *pos, *n;
d2201 21
a2221 6
 		/* traverse the list and deallocate space */
@@@@ -203,9 +203,9 @@@@ struct filldir_node *find_filldir_node(s
 	BUG_ON(namelen <= 0);
 
 	hash = full_name_hash(name, namelen);
-	index = hash % rdstate->uds_size;
d2223 4
a2226 6
-	head = &(rdstate->uds_list[index]);
+	index = hash % rdstate->size;
+
+	head = &(rdstate->list[index]);
 	list_for_each(pos, head) {
 		cursor = list_entry(pos, struct filldir_node, file_list);
d2228 7
a2234 15
@@@@ -214,10 +214,10 @@@@ struct filldir_node *find_filldir_node(s
 			/* a duplicate exists, and hence no need to create entry to the list */
 			found = 1;
 			/* if the duplicate is in this branch, then the file system is corrupted. */
-			if (cursor->bindex == rdstate->uds_bindex) {
+			if (cursor->bindex == rdstate->bindex) {
 				printk(KERN_DEBUG
 				       "Possible I/O error unionfs_filldir: a file is duplicated in the same branch %d: %s\n",
-				       rdstate->uds_bindex, cursor->name);
+				       rdstate->bindex, cursor->name);
 			}
 			break;
 		}
@@@@ -256,8 +256,8 @@@@ int add_filldir_node(struct unionfs_dir_
 	BUG_ON(namelen <= 0);
d2236 11
a2246 5
 	hash = full_name_hash(name, namelen);
-	index = hash % rdstate->uds_size;
-	head = &(rdstate->uds_list[index]);
+	index = hash % rdstate->size;
+	head = &(rdstate->list[index]);
d2248 19
a2266 5
 	new = alloc_filldir_node(name, namelen, hash, bindex);
 	if (!new) {
@@@@ -285,7 +285,7 @@@@ int add_filldir_node(struct unionfs_dir_
 	memcpy(new->name, name, namelen);
 	new->name[namelen] = '\0';
d2268 3
a2270 2
-	rdstate->uds_hashentries++;
+	rdstate->hashentries++;
d2272 3
a2274 8
 	list_add(&(new->file_list), head);
 out:
diff -r 3ab2c76610b7 fs/unionfs/rename.c
--- a/fs/unionfs/rename.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/rename.c	Fri Dec 01 19:14:47 2006 -0500
@@@@ -31,8 +31,8 @@@@ static int do_rename(struct inode *old_d
 	struct dentry *hidden_wh_dir_dentry;
 	char *wh_name = NULL;
d2276 7
a2282 27
-	hidden_new_dentry = dtohd_index(new_dentry, bindex);
-	hidden_old_dentry = dtohd_index(old_dentry, bindex);
+	hidden_new_dentry = unionfs_lower_dentry_idx(new_dentry, bindex);
+	hidden_old_dentry = unionfs_lower_dentry_idx(old_dentry, bindex);
 
 	if (!hidden_new_dentry) {
 		hidden_new_dentry =
@@@@ -180,7 +180,7 @@@@ static int do_unionfs_rename(struct inod
 		struct dentry *unlink_dentry;
 		struct dentry *unlink_dir_dentry;
 
-		unlink_dentry = dtohd_index(new_dentry, bindex);
+		unlink_dentry = unionfs_lower_dentry_idx(new_dentry, bindex);
 		if (!unlink_dentry) {
 			continue;
 		}
@@@@ -202,7 +202,7 @@@@ static int do_unionfs_rename(struct inod
 		if (!err) {
 			if (bindex != new_bstart) {
 				dput(unlink_dentry);
-				set_dtohd_index(new_dentry, bindex, NULL);
+				unionfs_set_lower_dentry_idx(new_dentry, bindex, NULL);
 			}
 		} else if (IS_COPYUP_ERR(err)) {
 			do_copyup = bindex - 1;
@@@@ -279,16 +279,16 @@@@ revert:
 		goto revert_out;
d2285 7
a2291 8
-	if (!dtohd_index(new_dentry, bindex)
-	    || !dtohd_index(new_dentry, bindex)->d_inode) {
+	if (!unionfs_lower_dentry_idx(new_dentry, bindex)
+	    || !unionfs_lower_dentry_idx(new_dentry, bindex)->d_inode) {
 		printk(KERN_WARNING
 		       "Revert failed in rename: the object disappeared from under us!\n");
 		eio = -EIO;
 		goto revert_out;
d2294 7
a2300 14
-	if (dtohd_index(old_dentry, bindex)
-	    && dtohd_index(old_dentry, bindex)->d_inode) {
+	if (unionfs_lower_dentry_idx(old_dentry, bindex)
+	    && unionfs_lower_dentry_idx(old_dentry, bindex)->d_inode) {
 		printk(KERN_WARNING
 		       "Revert failed in rename: the object was created underneath us!\n");
 		eio = -EIO;
@@@@ -357,7 +357,7 @@@@ static struct dentry *lookup_whiteout(st
 	bend = dbend(parent);
 	wh_dentry = ERR_PTR(-ENOENT);
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_parent = dtohd_index(parent, bindex);
+		hidden_parent = unionfs_lower_dentry_idx(parent, bindex);
 		if (!hidden_parent)
a2301 8
 		wh_dentry =
@@@@ -469,7 +469,7 @@@@ out:
 		/* force re-lookup since the dir on ro branch is not renamed,
 		   and hidden dentries still indicate the un-renamed ones. */
 		if (S_ISDIR(old_dentry->d_inode->i_mode))
-			atomic_dec(&dtopd(old_dentry)->udi_generation);
+			atomic_dec(&UNIONFS_D(old_dentry)->generation);
 	}
d2303 4
a2306 6
 	unlock_dentry(new_dentry);
diff -r 3ab2c76610b7 fs/unionfs/subr.c
--- a/fs/unionfs/subr.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/subr.c	Fri Dec 01 19:14:47 2006 -0500
@@@@ -44,7 +44,7 @@@@ int create_whiteout(struct dentry *dentr
 	}
d2308 29
a2336 3
 	for (bindex = start; bindex >= 0; bindex--) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
d2338 3
a2340 4
 		if (!hidden_dentry) {
 			/* if hidden dentry is not present, create the entire
@@@@ -114,7 +114,7 @@@@ int unionfs_refresh_hidden_dentry(struct
 	verify_locked(dentry);
d2342 9
a2350 4
 	lock_dentry(dentry->d_parent);
-	hidden_parent = dtohd_index(dentry->d_parent, bindex);
+	hidden_parent = unionfs_lower_dentry_idx(dentry->d_parent, bindex);
 	unlock_dentry(dentry->d_parent);
d2352 3
a2354 4
 	BUG_ON(!S_ISDIR(hidden_parent->d_inode->i_mode));
@@@@ -127,18 +127,16 @@@@ int unionfs_refresh_hidden_dentry(struct
 		goto out;
 	}
d2356 5
a2360 21
-	if (dtohd_index(dentry, bindex))
-		dput(dtohd_index(dentry, bindex));
-	if (itohi_index(dentry->d_inode, bindex)) {
-		iput(itohi_index(dentry->d_inode, bindex));
-		set_itohi_index(dentry->d_inode, bindex, NULL);
-	}
+	dput(unionfs_lower_dentry_idx(dentry, bindex));
+	iput(unionfs_lower_inode_idx(dentry->d_inode, bindex));
+	unionfs_set_lower_inode_idx(dentry->d_inode, bindex, NULL);
+
 	if (!hidden_dentry->d_inode) {
 		dput(hidden_dentry);
-		set_dtohd_index(dentry, bindex, NULL);
+		unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
 	} else {
-		set_dtohd_index(dentry, bindex, hidden_dentry);
-		set_itohi_index(dentry->d_inode, bindex,
+		unionfs_set_lower_dentry_idx(dentry, bindex, hidden_dentry);
+		unionfs_set_lower_inode_idx(dentry->d_inode, bindex,
 				igrab(hidden_dentry->d_inode));
 	}
d2362 8
a2369 3
@@@@ -152,7 +150,7 @@@@ int make_dir_opaque(struct dentry *dentr
 	struct dentry *hidden_dentry, *diropq;
 	struct inode *hidden_dir;
d2371 4
a2374 11
-	hidden_dentry = dtohd_index(dentry, bindex);
+	hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
 	hidden_dir = hidden_dentry->d_inode;
 	BUG_ON(!S_ISDIR(dentry->d_inode->i_mode)
 	       || !S_ISDIR(hidden_dir->i_mode));
diff -r 3ab2c76610b7 fs/unionfs/super.c
--- a/fs/unionfs/super.c	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/super.c	Fri Dec 01 19:14:47 2006 -0500
@@@@ -27,25 +27,25 @@@@ static void unionfs_read_inode(struct in
 	static struct address_space_operations unionfs_empty_aops;
 	int size;
d2376 3
a2378 6
-	if (!itopd(inode)) {
+	if (!UNIONFS_I(inode)) {
 		printk(KERN_ERR "No kernel memory when allocating inode "
 				"private data!\n");
 		BUG();
 	}
d2380 4
a2383 18
-	memset(itopd(inode), 0, sizeof(struct unionfs_inode_info));
-	itopd(inode)->b_start = -1;
-	itopd(inode)->b_end = -1;
-	atomic_set(&itopd(inode)->uii_generation,
-		   atomic_read(&stopd(inode->i_sb)->usi_generation));
-	spin_lock_init(&itopd(inode)->uii_rdlock);
-	itopd(inode)->uii_rdcount = 1;
-	itopd(inode)->uii_hashsize = -1;
-	INIT_LIST_HEAD(&itopd(inode)->uii_readdircache);
+	memset(UNIONFS_I(inode), 0, sizeof(struct unionfs_inode_info));
+	UNIONFS_I(inode)->bstart = -1;
+	UNIONFS_I(inode)->bend = -1;
+	atomic_set(&UNIONFS_I(inode)->generation,
+		   atomic_read(&UNIONFS_SB(inode->i_sb)->generation));
+	spin_lock_init(&UNIONFS_I(inode)->rdlock);
+	UNIONFS_I(inode)->rdcount = 1;
+	UNIONFS_I(inode)->hashsize = -1;
+	INIT_LIST_HEAD(&UNIONFS_I(inode)->readdircache);
d2385 1
a2385 11
 	size = sbmax(inode->i_sb) * sizeof(struct inode *);
-	itohi_ptr(inode) = kzalloc(size, GFP_KERNEL);
-	if (!itohi_ptr(inode)) {
+	UNIONFS_I(inode)->lower_inodes = kzalloc(size, GFP_KERNEL);
+	if (!UNIONFS_I(inode)->lower_inodes) {
 		printk(KERN_ERR "No kernel memory when allocating lower-"
 				"pointer array!\n");
 		BUG();
@@@@ -96,7 +96,7 @@@@ static void unionfs_put_super(struct sup
 	int bindex, bstart, bend;
 	struct unionfs_sb_info *spd;
d2387 1
a2387 12
-	spd = stopd(sb);
+	spd = UNIONFS_SB(sb);
 	if (!spd)
 		return;
 		
@@@@ -105,16 +105,16 @@@@ static void unionfs_put_super(struct sup
 #if 0
 	/* this shouldn't be needed */
 	for (bindex = bstart; bindex <= bend; bindex++)
-		mntput(stohiddenmnt_index(sb, bindex));
+		mntput(stohiddenmnt_idx(sb, bindex));
 #endif
d2389 3
a2391 3
 	/* Make sure we have no leaks of branchget/branchput. */
 	for (bindex = bstart; bindex <= bend; bindex++)
 		BUG_ON(branch_count(sb, bindex) != 0);
d2393 4
a2396 6
-	kfree(spd->usi_data);
+	kfree(spd->data);
 	kfree(spd);
-	stopd_lhs(sb) = NULL;
+	sb->s_fs_info = NULL;
 }
d2398 2
a2399 2
 /* Since people use this to answer the "How big of a file can I write?"
@@@@ -127,7 +127,7 @@@@ static int unionfs_statfs(struct dentry 
d2401 5
a2405 1
 	sb = dentry->d_sb;
d2407 2
a2408 3
-	hidden_sb = stohs_index(sb, sbstart(sb));
+	hidden_sb = unionfs_lower_super_idx(sb, sbstart(sb));
 	err = vfs_statfs(hidden_sb->s_root, buf);
d2410 5
a2414 4
 	buf->f_type = UNIONFS_SUPER_MAGIC;
@@@@ -161,9 +161,9 @@@@ static void unionfs_clear_inode(struct i
 	struct list_head *pos, *n;
 	struct unionfs_dir_state *rdstate;
d2416 2
a2417 8
-	list_for_each_safe(pos, n, &itopd(inode)->uii_readdircache) {
-		rdstate = list_entry(pos, struct unionfs_dir_state, uds_cache);
-		list_del(&rdstate->uds_cache);
+	list_for_each_safe(pos, n, &UNIONFS_I(inode)->readdircache) {
+		rdstate = list_entry(pos, struct unionfs_dir_state, cache);
+		list_del(&rdstate->cache);
 		free_rdstate(rdstate);
 	}
d2419 5
a2423 11
@@@@ -173,15 +173,15 @@@@ static void unionfs_clear_inode(struct i
 	bend = ibend(inode);
 	if (bstart >= 0) {
 		for (bindex = bstart; bindex <= bend; bindex++) {
-			hidden_inode = itohi_index(inode, bindex);
+			hidden_inode = unionfs_lower_inode_idx(inode, bindex);
 			if (!hidden_inode)
 				continue;
 			iput(hidden_inode);
 		}
 	}
d2425 2
a2426 5
-	kfree(itohi_ptr(inode));
-	itohi_ptr(inode) = NULL;
+	kfree(UNIONFS_I(inode)->lower_inodes);
+	UNIONFS_I(inode)->lower_inodes = NULL;
 }
d2428 6
a2433 2
 static struct inode *unionfs_alloc_inode(struct super_block *sb)
@@@@ -201,7 +201,7 @@@@ static struct inode *unionfs_alloc_inode
d2435 4
a2438 5
 static void unionfs_destroy_inode(struct inode *inode)
 {
-	kmem_cache_free(unionfs_inode_cachep, itopd(inode));
+	kmem_cache_free(unionfs_inode_cachep, UNIONFS_I(inode));
 }
d2440 5
a2444 4
 static void init_once(void *v, struct kmem_cache * cachep, unsigned long flags)
@@@@ -240,17 +240,17 @@@@ static int unionfs_write_inode(struct in
 	struct list_head *pos, *n;
 	struct unionfs_dir_state *rdstate;
d2446 3
a2448 18
-	spin_lock(&itopd(inode)->uii_rdlock);
-	list_for_each_safe(pos, n, &itopd(inode)->uii_readdircache) {
-		rdstate = list_entry(pos, struct unionfs_dir_state, uds_cache);
+	spin_lock(&UNIONFS_I(inode)->rdlock);
+	list_for_each_safe(pos, n, &UNIONFS_I(inode)->readdircache) {
+		rdstate = list_entry(pos, struct unionfs_dir_state, cache);
 		/* We keep this list in LRU order. */
-		if ((rdstate->uds_access + RDCACHE_JIFFIES) > jiffies)
+		if ((rdstate->access + RDCACHE_JIFFIES) > jiffies)
 			break;
-		itopd(inode)->uii_rdcount--;
-		list_del(&rdstate->uds_cache);
+		UNIONFS_I(inode)->rdcount--;
+		list_del(&rdstate->cache);
 		free_rdstate(rdstate);
 	}
-	spin_unlock(&itopd(inode)->uii_rdlock);
+	spin_unlock(&UNIONFS_I(inode)->rdlock);
d2450 3
a2452 10
 	return 0;
 }
@@@@ -280,8 +280,8 @@@@ static void unionfs_umount_begin(struct 
 	bstart = sbstart(sb);
 	bend = sbend(sb);
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_mnt = dtohm_index(sb->s_root, bindex);
-		hidden_sb = stohs_index(sb, bindex);
+		hidden_mnt = unionfs_lower_mnt_idx(sb->s_root, bindex);
+		hidden_sb = unionfs_lower_super_idx(sb, bindex);
d2454 3
a2456 3
 		if (hidden_mnt && hidden_sb && hidden_sb->s_op &&
 		    hidden_sb->s_op->umount_begin)
@@@@ -311,8 +311,8 @@@@ static int unionfs_show_options(struct s
d2458 4
a2461 8
 	seq_printf(m, ",dirs=");
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		path = d_path(dtohd_index(sb->s_root, bindex),
-			   dtohm_index(sb->s_root, bindex), tmp_page,
+		path = d_path(unionfs_lower_dentry_idx(sb->s_root, bindex),
+			   unionfs_lower_mnt_idx(sb->s_root, bindex), tmp_page,
 			   PAGE_SIZE);
 		perms = branchperms(sb, bindex);
d2463 3
a2465 5
diff -r 3ab2c76610b7 fs/unionfs/union.h
--- a/fs/unionfs/union.h	Thu Nov 30 23:49:30 2006 -0500
+++ b/fs/unionfs/union.h	Fri Dec 01 19:14:47 2006 -0500
@@@@ -54,7 +54,7 @@@@
 #define UNIONFS_ROOT_INO     1
d2467 7
a2473 3
 /* Mount time flags */
-#define MOUNT_FLAG(sb)     (stopd(sb)->usi_mount_flag)
+#define MOUNT_FLAG(sb)     (UNIONFS_SB(sb)->mount_flag)
d2475 1
a2475 3
 /* number of characters while generating unique temporary file names */
 #define	UNIONFS_TMPNAM_LEN	12
@@@@ -76,29 +76,31 @@@@ extern struct dentry_operations unionfs_
d2477 2
a2478 8
 /* file private data. */
 struct unionfs_file_info {
-	int b_start;
-	int b_end;
-	atomic_t ufi_generation;
+	int bstart;
+	int bend;
+	atomic_t generation;
d2480 10
a2489 4
 	struct unionfs_dir_state *rdstate;
-	struct file **ufi_file;
+	struct file **lower_files;
 };
d2491 14
a2504 29
 /* unionfs inode data in memory */
 struct unionfs_inode_info {
-	int b_start;
-	int b_end;
-	atomic_t uii_generation;
-	int uii_stale;
+	int bstart;
+	int bend;
+	atomic_t generation;
+	int stale;
 	/* Stuff for readdir over NFS. */
-	spinlock_t uii_rdlock;
-	struct list_head uii_readdircache;
-	int uii_rdcount;
-	int uii_hashsize;
-	int uii_cookie; /* The hidden inodes */
-	struct inode **uii_inode;
+	spinlock_t rdlock;
+	struct list_head readdircache;
+	int rdcount;
+	int hashsize;
+	int cookie;
+	
+	/* The hidden inodes */
+	struct inode **lower_inodes;
 	/* to keep track of reads/writes for unlinks before closes */
-	atomic_t uii_totalopens;
+	atomic_t totalopens;
 };
d2506 2
a2507 20
 struct unionfs_inode_container {
@@@@ -111,17 +113,17 @@@@ struct unionfs_dentry_info {
 	/* The semaphore is used to lock the dentry as soon as we get into a
 	 * unionfs function from the VFS.  Our lock ordering is that children
 	 * go before their parents. */
-	struct semaphore udi_sem;
-	int udi_bstart;
-	int udi_bend;
-	int udi_bopaque;
-	int udi_bcount;
-	atomic_t udi_generation;
-	struct path *udi_path;
+	struct semaphore sem;
+	int bstart;
+	int bend;
+	int bopaque;
+	int bcount;
+	atomic_t generation;
+	struct path *lower_paths;
 };
d2509 14
a2522 7
 /* These are the pointers to our various objects. */
-struct unionfs_usi_data {
+struct unionfs_data {
 	struct super_block *sb;
 	struct vfsmount *hidden_mnt;
 	atomic_t sbcount;
@@@@ -130,13 +132,13 @@@@ struct unionfs_usi_data {
d2524 2
a2525 17
 /* unionfs super-block data in memory */
 struct unionfs_sb_info {
-	int b_end;
-
-	atomic_t usi_generation;
-	unsigned long usi_mount_flag;
-	struct rw_semaphore usi_rwsem;
-
-	struct unionfs_usi_data *usi_data;
+	int bend;
+
+	atomic_t generation;
+	unsigned long mount_flag;
+	struct rw_semaphore rwsem;
+
+	struct unionfs_data *data;
 };
d2527 5
a2531 2
 /*
@@@@ -155,16 +157,16 @@@@ struct filldir_node {
d2533 7
a2539 22
 /* Directory hash table. */
 struct unionfs_dir_state {
-	unsigned int uds_cookie;	/* The cookie, which is based off of uii_rdversion */
-	unsigned int uds_offset;	/* The entry we have returned. */
-	int uds_bindex;
-	loff_t uds_dirpos;	/* The offset within the lower level directory. */
-	int uds_size;		/* How big is the hash table? */
-	int uds_hashentries;	/* How many entries have been inserted? */
-	unsigned long uds_access;
+	unsigned int cookie;	/* The cookie, which is based off of rdversion */
+	unsigned int offset;	/* The entry we have returned. */
+	int bindex;
+	loff_t dirpos;	/* The offset within the lower level directory. */
+	int size;		/* How big is the hash table? */
+	int hashentries;	/* How many entries have been inserted? */
+	unsigned long access;
 	/* This cache list is used when the inode keeps us around. */
-	struct list_head uds_cache;
-	struct list_head uds_list[0];
+	struct list_head cache;
+	struct list_head list[0];
 };
d2541 13
a2553 3
 /* include miscellaneous macros */
@@@@ -190,7 +192,7 @@@@ struct filldir_node *find_filldir_node(s
 				       const char *name, int namelen);
d2555 2
a2556 3
 struct dentry **alloc_new_dentries(int objs);
-struct unionfs_usi_data *alloc_new_data(int objs);
+struct unionfs_data *alloc_new_data(int objs);
d2558 5
a2562 12
 /* We can only use 32-bits of offset for rdstate --- blech! */
 #define DIREOF (0xfffff)
@@@@ -200,15 +202,15 @@@@ static inline off_t rdstate2offset(struc
 static inline off_t rdstate2offset(struct unionfs_dir_state *buf)
 {
 	off_t tmp;
-	tmp = ((buf->uds_cookie & MAXRDCOOKIE) << RDOFFBITS)
-		| (buf->uds_offset & DIREOF);
+	tmp = ((buf->cookie & MAXRDCOOKIE) << RDOFFBITS)
+		| (buf->offset & DIREOF);
 	return tmp;
 }
d2564 7
a2570 8
-#define unionfs_read_lock(sb) down_read(&stopd(sb)->usi_rwsem)
-#define unionfs_read_unlock(sb) up_read(&stopd(sb)->usi_rwsem)
-#define unionfs_write_lock(sb) down_write(&stopd(sb)->usi_rwsem)
-#define unionfs_write_unlock(sb) up_write(&stopd(sb)->usi_rwsem)
+#define unionfs_read_lock(sb) down_read(&UNIONFS_SB(sb)->rwsem)
+#define unionfs_read_unlock(sb) up_read(&UNIONFS_SB(sb)->rwsem)
+#define unionfs_write_lock(sb) down_write(&UNIONFS_SB(sb)->rwsem)
+#define unionfs_write_unlock(sb) up_write(&UNIONFS_SB(sb)->rwsem)
d2572 3
a2574 7
 /* The double lock function needs to go after the debugmacros, so that
  * dtopd is defined.  */
@@@@ -226,7 +228,6 @@@@ extern int new_dentry_private_data(struc
 extern int new_dentry_private_data(struct dentry *dentry);
 void free_dentry_private_data(struct unionfs_dentry_info *udi);
 void update_bstart(struct dentry *dentry);
-#define sbt(sb) ((sb)->s_type->name)
d2576 4
a2579 5
 /*
  * EXTERNALS:
@@@@ -338,7 +339,8 @@@@ static inline int d_deleted(struct dentr
 	return d_unhashed(d) && (d != d->d_sb->s_root);
 }
d2581 5
a2585 8
-/* returns the sum of the n_link values of all the underlying inodes of the passed inode */
+/* returns the sum of the n_link values of all the underlying inodes of the
+ * passed inode */
 static inline int unionfs_get_nlinks(struct inode *inode)
 {
 	int sum_nlinks = 0;
@@@@ -351,10 +353,10 @@@@ static inline int unionfs_get_nlinks(str
 		return 0;
d2587 2
a2588 3
 	if (!S_ISDIR(inode->i_mode))
-		return itohi(inode)->i_nlink;
+		return unionfs_lower_inode(inode)->i_nlink;
d2590 4
a2593 4
 	for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {
-		hidden_inode = itohi_index(inode, bindex);
+		hidden_inode = unionfs_lower_inode_idx(inode, bindex);
 		if (!hidden_inode || !S_ISDIR(hidden_inode->i_mode))
d2595 12
a2606 4
 		BUG_ON(hidden_inode->i_nlink < 0);
@@@@ -392,64 +394,47 @@@@ static inline int branchperms(struct sup
 {
 	BUG_ON(index < 0);
d2608 4
a2611 8
-	return stopd(sb)->usi_data[index].branchperms;
-}
+	return UNIONFS_SB(sb)->data[index].branchperms;
+}
+
 static inline int set_branchperms(struct super_block *sb, int index, int perms)
 {
 	BUG_ON(index < 0);
d2613 6
a2618 2
-	stopd(sb)->usi_data[index].branchperms = perms;
+	UNIONFS_SB(sb)->data[index].branchperms = perms;
d2620 3
a2622 2
 	return perms;
 }
d2624 4
a2627 13
 /* Is this file on a read-only branch? */
-static inline int __is_robranch_super(struct super_block *sb, int index,
-				      char *file, const char *function,
-				      int line)
+static inline int is_robranch_super(struct super_block *sb, int index)
+{
+	return (!(branchperms(sb, index) & MAY_WRITE)) ? -EROFS : 0;
+}
+
+/* Is this file on a read-only branch? */
+static inline int is_robranch_idx(struct dentry *dentry, int index)
 {
 	int err = 0;
d2629 4
a2632 6
-	if (!(branchperms(sb, index) & MAY_WRITE))
+	BUG_ON(index < 0);
+
+	if ((!(branchperms(dentry->d_sb, index) & MAY_WRITE)) ||
+	    IS_RDONLY(unionfs_lower_dentry_idx(dentry, index)->d_inode))
 		err = -EROFS;
d2634 4
a2637 2
 	return err;
 }
d2639 9
a2647 11
-/* Is this file on a read-only branch? */
-static inline int __is_robranch_index(struct dentry *dentry, int index,
-				      char *file, const char *function,
-				      int line)
-{
-	int err = 0;
-	int perms;
-
+static inline int is_robranch(struct dentry *dentry)
+{
+	int index;
d2649 11
a2659 2
+	index = UNIONFS_D(dentry)->bstart;
 	BUG_ON(index < 0);
d2661 3
a2663 26
-	perms = stopd(dentry->d_sb)->usi_data[index].branchperms;
-
-	if ((!(perms & MAY_WRITE))
-	    || (IS_RDONLY(dtohd_index(dentry, index)->d_inode)))
-		err = -EROFS;
-
-	return err;
-}
-static inline int __is_robranch(struct dentry *dentry, char *file,
-				const char *function, int line)
-{
-	int index;
-	int err;
-
-	index = dtopd(dentry)->udi_bstart;
-	BUG_ON(index < 0);
-
-	err = __is_robranch_index(dentry, index, file, function, line);
-
-	return err;
-}
-
-#define is_robranch(d) __is_robranch(d, __FILE__, __FUNCTION__, __LINE__)
-#define is_robranch_super(s, n) __is_robranch_super(s, n, __FILE__, __FUNCTION__, __LINE__)
+	return is_robranch_idx(dentry, index);
+}
d2665 5
a2669 2
 /* What do we use for whiteouts. */
 #define UNIONFS_WHPFX ".wh."
d2672 1
a2672 1
+++ b/fs/unionfs/unlink.c	Fri Dec 01 19:14:47 2006 -0500
d2678 1
a2678 1
+	hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
d2693 1
a2693 1
+++ b/fs/unionfs/xattr.c	Fri Dec 01 19:14:47 2006 -0500
@


1.1.2.6
log
@Move vfs_inode into unionfs_inode_info - ala ext2
Little variable rename
@
text
@d1 3
a3 3
diff -r 0dcf184aa12a fs/unionfs/branchman.c
--- a/fs/unionfs/branchman.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/branchman.c	Fri Dec 01 19:37:37 2006 -0500
d27 3
a29 3
diff -r 0dcf184aa12a fs/unionfs/commonfops.c
--- a/fs/unionfs/commonfops.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/commonfops.c	Fri Dec 01 19:37:37 2006 -0500
d404 3
a406 3
diff -r 0dcf184aa12a fs/unionfs/copyup.c
--- a/fs/unionfs/copyup.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/copyup.c	Fri Dec 01 19:37:37 2006 -0500
d538 3
a540 3
diff -r 0dcf184aa12a fs/unionfs/dentry.c
--- a/fs/unionfs/dentry.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/dentry.c	Fri Dec 01 19:37:37 2006 -0500
d662 3
a664 3
diff -r 0dcf184aa12a fs/unionfs/dirfops.c
--- a/fs/unionfs/dirfops.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/dirfops.c	Fri Dec 01 19:37:37 2006 -0500
d801 3
a803 3
diff -r 0dcf184aa12a fs/unionfs/dirhelper.c
--- a/fs/unionfs/dirhelper.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/dirhelper.c	Fri Dec 01 19:37:37 2006 -0500
d873 4
a876 4
diff -r 0dcf184aa12a fs/unionfs/fanout.h
--- a/fs/unionfs/fanout.h	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/fanout.h	Fri Dec 01 21:02:11 2006 -0500
@@@@ -19,172 +19,159 @@@@
d883 3
a885 4
-	return
-	    &(container_of(inode, struct unionfs_inode_container, vfs_inode)->
-	      info);
+	return container_of(inode, struct unionfs_inode_info, vfs_inode);
d975 1
a975 1
+static inline struct super_block *unionfs_lower_super(const struct super_block *sb)
d978 1
a978 1
+	return UNIONFS_SB(sb)->data[sbstart(sb)].sb;
d982 1
a982 1
+static inline struct super_block *unionfs_lower_super_idx(const struct super_block *sb, int index)
d985 1
a985 1
+	return UNIONFS_SB(sb)->data[index].sb;
d989 1
a989 1
+static inline void unionfs_set_lower_super_idx(struct super_block *sb, int index,
d993 1
a993 1
+	UNIONFS_SB(sb)->data[index].sb = val;
d997 1
a997 1
+static inline void unionfs_set_lower_super(struct super_block *sb, struct super_block *val)
d1000 1
a1000 1
+	UNIONFS_SB(sb)->data[sbstart(sb)].sb = val;
d1004 1
a1004 2
-static inline int branch_count(struct super_block *o, int index)
+static inline int branch_count(struct super_block *sb, int index)
d1007 1
a1007 1
+	return atomic_read(&UNIONFS_SB(sb)->data[index].sbcount);
d1010 1
a1010 2
-static inline void set_branch_count(struct super_block *o, int index, int val)
+static inline void set_branch_count(struct super_block *sb, int index, int val)
d1013 1
a1013 1
+	atomic_set(&UNIONFS_SB(sb)->data[index].sbcount, val);
d1016 1
a1016 2
-static inline void branchget(struct super_block *o, int index)
+static inline void branchget(struct super_block *sb, int index)
d1019 1
a1019 1
+	atomic_inc(&UNIONFS_SB(sb)->data[index].sbcount);
d1022 1
a1022 2
-static inline void branchput(struct super_block *o, int index)
+static inline void branchput(struct super_block *sb, int index)
d1025 1
a1025 1
+	atomic_dec(&UNIONFS_SB(sb)->data[index].sbcount);
d1107 3
a1109 3
diff -r 0dcf184aa12a fs/unionfs/file.c
--- a/fs/unionfs/file.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/file.c	Fri Dec 01 19:37:37 2006 -0500
d1173 3
a1175 3
diff -r 0dcf184aa12a fs/unionfs/inode.c
--- a/fs/unionfs/inode.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/inode.c	Fri Dec 01 19:37:37 2006 -0500
d1357 3
a1359 3
diff -r 0dcf184aa12a fs/unionfs/lookup.c
--- a/fs/unionfs/lookup.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/lookup.c	Fri Dec 01 19:37:37 2006 -0500
d1596 3
a1598 3
diff -r 0dcf184aa12a fs/unionfs/main.c
--- a/fs/unionfs/main.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/main.c	Fri Dec 01 19:37:37 2006 -0500
d1959 3
a1961 3
diff -r 0dcf184aa12a fs/unionfs/rdstate.c
--- a/fs/unionfs/rdstate.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/rdstate.c	Fri Dec 01 19:37:37 2006 -0500
d2113 3
a2115 3
diff -r 0dcf184aa12a fs/unionfs/rename.c
--- a/fs/unionfs/rename.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/rename.c	Fri Dec 01 19:37:37 2006 -0500
d2184 3
a2186 3
diff -r 0dcf184aa12a fs/unionfs/subr.c
--- a/fs/unionfs/subr.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/subr.c	Fri Dec 01 19:37:37 2006 -0500
d2240 3
a2242 3
diff -r 0dcf184aa12a fs/unionfs/super.c
--- a/fs/unionfs/super.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/super.c	Fri Dec 01 21:10:24 2006 -0500
d2332 1
a2332 1
@@@@ -173,44 +173,43 @@@@ static void unionfs_clear_inode(struct i
d2351 1
a2351 22
 {
-	struct unionfs_inode_container *c;
-
-	c = kmem_cache_alloc(unionfs_inode_cachep, SLAB_KERNEL);
-	if (!c) {
+	struct unionfs_inode_info *i;
+
+	i = kmem_cache_alloc(unionfs_inode_cachep, SLAB_KERNEL);
+	if (!i)
 		return NULL;
-	}
-
-	memset(&c->info, 0, sizeof(c->info));
-
-	c->vfs_inode.i_version = 1;
-	return &c->vfs_inode;
+
+	memset(i, 0, sizeof(i));
+
+	i->vfs_inode.i_version = 1;
+	return &i->vfs_inode;
 }
d2360 1
a2360 21
 {
-	struct unionfs_inode_container *c = v;
+	struct unionfs_inode_info *i = v;
 
 	if ((flags & (SLAB_CTOR_VERIFY | SLAB_CTOR_CONSTRUCTOR)) ==
 	    SLAB_CTOR_CONSTRUCTOR)
-		inode_init_once(&c->vfs_inode);
+		inode_init_once(&i->vfs_inode);
 }
 
 int init_inode_cache(void)
@@@@ -219,7 +218,7 @@@@ int init_inode_cache(void)
 
 	unionfs_inode_cachep =
 	    kmem_cache_create("unionfs_inode_cache",
-			      sizeof(struct unionfs_inode_container), 0,
+			      sizeof(struct unionfs_inode_info), 0,
 			      SLAB_RECLAIM_ACCOUNT, init_once, NULL);
 	if (!unionfs_inode_cachep)
 		err = -ENOMEM;
@@@@ -240,17 +239,17 @@@@ static int unionfs_write_inode(struct in
d2385 1
a2385 1
@@@@ -280,8 +279,8 @@@@ static void unionfs_umount_begin(struct 
d2396 1
a2396 1
@@@@ -311,8 +310,8 @@@@ static int unionfs_show_options(struct s
d2407 3
a2409 3
diff -r 0dcf184aa12a fs/unionfs/union.h
--- a/fs/unionfs/union.h	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/union.h	Fri Dec 01 21:08:33 2006 -0500
d2419 1
a2419 1
@@@@ -76,34 +76,33 @@@@ extern struct dentry_operations unionfs_
a2440 2
+	struct inode vfs_inode;
+
a2461 5
-};
-
-struct unionfs_inode_container {
-	struct unionfs_inode_info info;
-	struct inode vfs_inode;
d2465 2
a2466 2
 /* unionfs dentry data in memory */
@@@@ -111,17 +110,17 @@@@ struct unionfs_dentry_info {
d2492 1
a2492 1
@@@@ -130,13 +129,13 @@@@ struct unionfs_usi_data {
d2513 1
a2513 1
@@@@ -155,16 +154,16 @@@@ struct filldir_node {
d2539 1
a2539 1
@@@@ -190,7 +189,7 @@@@ struct filldir_node *find_filldir_node(s
d2548 1
a2548 1
@@@@ -200,15 +199,15 @@@@ static inline off_t rdstate2offset(struc
d2570 1
a2570 1
@@@@ -226,7 +225,6 @@@@ extern int new_dentry_private_data(struc
d2578 1
a2578 1
@@@@ -338,7 +336,8 @@@@ static inline int d_deleted(struct dentr
d2588 1
a2588 1
@@@@ -351,10 +350,10 @@@@ static inline int unionfs_get_nlinks(str
d2601 1
a2601 1
@@@@ -392,64 +391,47 @@@@ static inline int branchperms(struct sup
d2688 3
a2690 3
diff -r 0dcf184aa12a fs/unionfs/unlink.c
--- a/fs/unionfs/unlink.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/unlink.c	Fri Dec 01 19:37:37 2006 -0500
d2709 3
a2711 3
diff -r 0dcf184aa12a fs/unionfs/xattr.c
--- a/fs/unionfs/xattr.c	Fri Dec 01 19:37:37 2006 -0500
+++ b/fs/unionfs/xattr.c	Fri Dec 01 19:37:37 2006 -0500
@


1.1.2.7
log
@Fixed inode container; few tiny cleanups
@
text
@d875 1
a875 1
+++ b/fs/unionfs/fanout.h	Fri Dec 01 21:35:38 2006 -0500
d915 1
a915 1
-/* File to hidden file. */
a916 1
+/* File to lower file. */
d944 1
a944 1
-/* Inode to hidden inode. */
a945 1
+/* Inode to lower inode. */
d974 1
a974 1
-/* Superblock to hidden superblock. */
a975 1
+/* Superblock to lower superblock. */
d2247 2
a2248 3
+++ b/fs/unionfs/super.c	Fri Dec 01 22:02:15 2006 -0500
@@@@ -26,26 +26,27 @@@@ static void unionfs_read_inode(struct in
 {
d2251 1
a2251 1
-
d2253 1
a2253 3
+	struct unionfs_inode_info *info = UNIONFS_I(inode);
+
+	if (!info) {
d2268 4
a2271 4
+	memset(info, 0, offsetof(struct unionfs_inode_info, vfs_inode));
+	info->bstart = -1;
+	info->bend = -1;
+	atomic_set(&info->generation,
d2273 4
a2276 4
+	spin_lock_init(&info->rdlock);
+	info->rdcount = 1;
+	info->hashsize = -1;
+	INIT_LIST_HEAD(&info->readdircache);
d2281 2
a2282 2
+	info->lower_inodes = kzalloc(size, GFP_KERNEL);
+	if (!info->lower_inodes) {
d2286 1
a2286 1
@@@@ -96,7 +97,7 @@@@ static void unionfs_put_super(struct sup
d2295 1
a2295 1
@@@@ -105,16 +106,16 @@@@ static void unionfs_put_super(struct sup
d2315 1
a2315 1
@@@@ -127,7 +128,7 @@@@ static int unionfs_statfs(struct dentry 
d2324 1
a2324 1
@@@@ -161,9 +162,9 @@@@ static void unionfs_clear_inode(struct i
d2337 1
a2337 1
@@@@ -173,44 +174,44 @@@@ static void unionfs_clear_inode(struct i
d2373 1
a2373 2
+	/* memset everything up to the inode to 0 */
+	memset(i, 0, offsetof(struct unionfs_inode_info, vfs_inode));
d2397 1
a2397 1
@@@@ -219,7 +220,7 @@@@ int init_inode_cache(void)
d2406 1
a2406 1
@@@@ -240,17 +241,17 @@@@ static int unionfs_write_inode(struct in
d2431 1
a2431 1
@@@@ -280,8 +281,8 @@@@ static void unionfs_umount_begin(struct 
d2442 1
a2442 1
@@@@ -311,8 +312,8 @@@@ static int unionfs_show_options(struct s
d2455 1
a2455 1
+++ b/fs/unionfs/union.h	Fri Dec 01 21:25:23 2006 -0500
d2465 1
a2465 1
@@@@ -76,33 +76,32 @@@@ extern struct dentry_operations unionfs_
d2487 2
d2514 1
a2515 2
+
 	struct inode vfs_inode;
d2518 1
@


1.1.2.8
log
@Some cleanup
@
text
@d3 2
a4 11
+++ b/fs/unionfs/branchman.c	Fri Dec 01 23:52:27 2006 -0500
@@@@ -18,6 +18,8 @@@@
 
 #include "union.h"
 
+/* increase the superblock generation count; effectively invalidating every
+ * upper inode, dentry and file object */
 int unionfs_ioctl_incgen(struct file *file, unsigned int cmd, unsigned long arg)
 {
 	struct super_block *sb;
@@@@ -27,16 +29,21 @@@@ int unionfs_ioctl_incgen(struct file *fi
d18 1
a18 12
 	return gen;
 }
 
+/* return to userspace the branch indices containing the file in question
+ *
+ * We use fd_set and therefore we are limited to the number of the branches
+ * to FD_SETSIZE, which is currently 1024 - plenty for most people
+ */
 int unionfs_ioctl_queryfile(struct file *file, unsigned int cmd,
 			    unsigned long arg)
 {
@@@@ -56,7 +63,7 @@@@ int unionfs_ioctl_queryfile(struct file 
d29 1
a29 1
+++ b/fs/unionfs/commonfops.c	Sat Dec 02 02:51:56 2006 -0500
d48 2
a49 8
@@@@ -75,51 +75,57 @@@@ out:
 	return err;
 }
 
-static void cleanup_file(struct file *file, struct dentry *dentry)
+/* put all references held by upper struct file and free lower file pointer
+ * array */
+static void cleanup_file(struct file *file)
d61 2
a62 1
-			branchput(dentry->d_sb, bindex);
a69 6
-	}
-}
-
-static int open_all_files(struct file *file, struct dentry *dentry)
+		if (unionfs_lower_file_idx(file, bindex)) {
+			branchput(file->f_dentry->d_sb, bindex);
d74 5
a78 12
+	UNIONFS_F(file)->lower_files = NULL;
+	kfree(lf);
+}
+
+/* open all lower files for a given file */
+static int open_all_files(struct file *file)
 {
 	int bindex, bstart, bend, err = 0;
 	struct file *hidden_file;
 	struct dentry *hidden_dentry;
+	struct dentry *dentry = file->f_dentry;
 	struct super_block *sb = dentry->d_sb;
d80 1
a80 1
 	bstart = dbstart(dentry);
d107 1
a107 1
@@@@ -138,7 +144,7 @@@@ static int open_highest_file(struct file
d116 1
a116 1
@@@@ -148,21 +154,21 @@@@ static int open_highest_file(struct file
d143 1
a143 1
@@@@ -196,10 +202,10 @@@@ static int do_delayed_copyup(struct file
d157 1
a157 1
@@@@ -226,9 +232,9 @@@@ int unionfs_file_revalidate(struct file 
d170 1
a170 9
@@@@ -239,22 +245,22 @@@@ int unionfs_file_revalidate(struct file 
 	if (!d_deleted(dentry) &&
 	    (sbgen > fgen || dbstart(dentry) != fbstart(file))) {
 		/* First we throw out the existing files. */
-		cleanup_file(file, dentry);
+		cleanup_file(file);
 
 		/* Now we reopen the file(s) as in unionfs_open. */
 		bstart = fbstart(file) = dbstart(dentry);
d181 1
a181 9
 
 		if (S_ISDIR(dentry->d_inode->i_mode)) {
 			/* We need to open all the files. */
-			err = open_all_files(file, dentry);
+			err = open_all_files(file);
 			if (err)
 				goto out;
 		} else {
@@@@ -263,16 +269,17 @@@@ int unionfs_file_revalidate(struct file 
d206 1
a206 1
@@@@ -293,19 +300,19 @@@@ static inline int __open_dir(struct inod
d220 2
a221 3
-					file->f_flags);
+				unionfs_lower_mnt_idx(file->f_dentry, bindex),
+				file->f_flags);
d230 1
a230 1
@@@@ -323,7 +330,7 @@@@ static inline int __open_file(struct ino
d239 1
a239 1
@@@@ -355,14 +362,14 @@@@ static inline int __open_file(struct ino
d257 1
a257 1
@@@@ -376,19 +383,19 @@@@ int unionfs_open(struct inode *inode, st
d283 1
a283 1
@@@@ -401,9 +408,10 @@@@ int unionfs_open(struct inode *inode, st
a287 2
-
-	/* open all directories and make the unionfs file struct point to these hidden file structs */
d289 2
a290 3
+
+	/* open all directories and make the unionfs file struct point to
+	 * these hidden file structs */
d292 1
a292 3
 		err = __open_dir(inode, file);	/* open a dir */
 	else
@@@@ -412,7 +420,7 @@@@ int unionfs_open(struct inode *inode, st
d301 1
a301 1
@@@@ -427,8 +435,8 @@@@ int unionfs_open(struct inode *inode, st
d312 1
a312 1
@@@@ -441,12 +449,12 @@@@ int unionfs_file_release(struct inode *i
d327 1
a327 1
@@@@ -455,36 +463,38 @@@@ int unionfs_file_release(struct inode *i
d366 1
a366 3
+/* pass the ioctl to the lower fs */
 static inline long do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
d375 1
a375 12
 		goto out;
+
 	err = -ENOTTY;
 	if (!hidden_file || !hidden_file->f_op)
 		goto out;
@@@@ -503,7 +513,7 @@@@ out:
 
 long unionfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-	long err = 0;		/* don't fail by default */
+	long err;
 
d378 3
a380 35
@@@@ -511,18 +521,20 @@@@ long unionfs_ioctl(struct file *file, un
 	/* check if asked for local commands */
 	switch (cmd) {
 		case UNIONFS_IOCTL_INCGEN:
-			if (!capable(CAP_SYS_ADMIN)) {
-				err = -EACCES;
+			/* Increment the superblock generation count */
+			err = -EACCES;
+			if (!capable(CAP_SYS_ADMIN))
 				goto out;
-			}
 			err = unionfs_ioctl_incgen(file, cmd, arg);
 			break;
 
 		case UNIONFS_IOCTL_QUERYFILE:
+			/* Return list of branches containing the given file */
 			err = unionfs_ioctl_queryfile(file, cmd, arg);
 			break;
 
 		default:
+			/* pass the ioctl down */
 			err = do_ioctl(file, cmd, arg);
 			break;
 	}
@@@@ -533,41 +545,40 @@@@ out:
 
 int unionfs_flush(struct file *file, fl_owner_t id)
 {
-	int err = 0;		/* assume ok (see open.c:close_fp) */
+	int err = 0;
 	struct file *hidden_file = NULL;
+	struct dentry *dentry = file->f_dentry;
 	int bindex, bstart, bend;
 
 	if ((err = unionfs_file_revalidate(file, 1)))
a381 9
-	if (!atomic_dec_and_test
-	    (&itopd(file->f_dentry->d_inode)->uii_totalopens))
-		goto out;
-
-	lock_dentry(file->f_dentry);
+	if (!atomic_dec_and_test(&UNIONFS_I(dentry->d_inode)->totalopens))
+		goto out;
+
+	lock_dentry(dentry);
d383 2
a388 3
-
-		if (hidden_file && hidden_file->f_op
-		    && hidden_file->f_op->flush) {
d390 4
a393 5
+
+		if (hidden_file && hidden_file->f_op && hidden_file->f_op->flush) {
 			err = hidden_file->f_op->flush(hidden_file, id);
 			if (err)
 				goto out_lock;
d396 1
a396 1
-			if (d_deleted(file->f_dentry)) {
d399 2
a400 3
+			if (d_deleted(dentry)) {
+				dput(unionfs_lower_dentry_idx(dentry, bindex));
+				unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
a403 13
 	}
 
 out_lock:
-	unlock_dentry(file->f_dentry);
-out:
-	return err;
-}
-
+	unlock_dentry(dentry);
+out:
+	return err;
+}
+
d875 1
a875 1
+++ b/fs/unionfs/fanout.h	Fri Dec 01 23:45:31 2006 -0500
d1110 2
a1111 2
+#define lock_dentry(d)		down(&UNIONFS_D(d)->sem)
+#define unlock_dentry(d)	up(&UNIONFS_D(d)->sem)
d2462 1
a2462 1
+++ b/fs/unionfs/union.h	Fri Dec 01 23:46:45 2006 -0500
@


1.1.2.9
log
@More macro changes & cleanup
@
text
@d3 1
a3 1
+++ b/fs/unionfs/branchman.c	Sat Dec 02 21:21:26 2006 -0500
d49 1
a49 1
+++ b/fs/unionfs/commonfops.c	Sun Dec 03 01:02:00 2006 -0500
d68 1
a68 1
@@@@ -75,99 +75,104 @@@@ out:
a140 7
-	}
-out:
-	return err;
-}
-
-static int open_highest_file(struct file *file, struct dentry *dentry,
-			     int willwrite)
d142 4
a145 18
+	}
+out:
+	return err;
+}
+
+/* open the highest priority file for a given upper file */
+static int open_highest_file(struct file *file, int willwrite)
 {
 	int bindex, bstart, bend, err = 0;
 	struct file *hidden_file;
 	struct dentry *hidden_dentry;
+
+	struct dentry *dentry = file->f_dentry;
 	struct inode *parent_inode = dentry->d_parent->d_inode;
-	size_t inode_size = file->f_dentry->d_inode->i_size;
 	struct super_block *sb = dentry->d_sb;
+	size_t inode_size = dentry->d_inode->i_size;
 
a149 2
-	if (willwrite && IS_WRITE_FLAG(file->f_flags)
-	    && is_robranch(dentry)) {
d151 2
a152 1
+	if (willwrite && IS_WRITE_FLAG(file->f_flags) && is_robranch(dentry)) {
d154 1
a154 3
 			err = copyup_file(parent_inode, file, bstart, bindex,
 					  inode_size);
 			if (!err)
d156 2
a157 2
-
-		}
a159 1
+		}
d181 1
a181 7
-	memcpy(&(hidden_file->f_ra), &(file->f_ra),
-	       sizeof(struct file_ra_state));
+	memcpy(&hidden_file->f_ra, &file->f_ra, sizeof(struct file_ra_state));
 out:
 	return err;
 }
@@@@ -196,10 +201,10 @@@@ static int do_delayed_copyup(struct file
a194 8
@@@@ -207,6 +212,7 @@@@ static int do_delayed_copyup(struct file
 	return err;
 }
 
+/* revalidate the stuct file */
 int unionfs_file_revalidate(struct file *file, int willwrite)
 {
 	struct super_block *sb;
d208 1
a208 1
@@@@ -239,40 +245,41 @@@@ int unionfs_file_revalidate(struct file 
d235 1
a235 3
 			/* We only open the highest priority branch. */
-			err = open_highest_file(file, dentry, willwrite);
+			err = open_highest_file(file, willwrite);
d361 1
a361 1
@@@@ -427,26 +435,29 @@@@ int unionfs_open(struct inode *inode, st
a366 5
-	}
-
-	return err;
-}
-
d369 4
a372 12
+	}
+
+	return err;
+}
+
+/* release all lower object references & free the file info structure */
 int unionfs_file_release(struct inode *inode, struct file *file)
 {
 	struct file *hidden_file = NULL;
+	struct unionfs_file_info *fileinfo = UNIONFS_F(file);
+	struct unionfs_inode_info *inodeinfo = UNIONFS_I(inode);
 	int bindex, bstart, bend;
d377 1
a377 1
+	fgen = atomic_read(&fileinfo->generation);
d387 1
a387 1
@@@@ -455,36 +466,38 @@@@ int unionfs_file_release(struct inode *i
d395 1
a395 1
+	kfree(fileinfo->lower_files);
d397 2
a398 2
+	if (fileinfo->rdstate) {
+		fileinfo->rdstate->access = jiffies;
d407 7
a413 7
+		       fileinfo->rdstate->cookie,
+		       fileinfo->rdstate->bindex,
+		       (long long)fileinfo->rdstate->dirpos);
+		spin_lock(&inodeinfo->rdlock);
+		inodeinfo->rdcount++;
+		list_add_tail(&fileinfo->rdstate->cache,
+			      &inodeinfo->readdircache);
d419 2
a420 2
+		spin_unlock(&inodeinfo->rdlock);
+		fileinfo->rdstate = NULL;
d422 1
a422 1
+	kfree(fileinfo);
d442 1
a442 1
@@@@ -503,7 +516,7 @@@@ out:
d451 1
a451 1
@@@@ -511,18 +524,20 @@@@ long unionfs_ioctl(struct file *file, un
d475 1
a475 1
@@@@ -533,41 +548,40 @@@@ out:
d536 2
a537 10
+++ b/fs/unionfs/copyup.c	Sun Dec 03 01:55:22 2006 -0500
@@@@ -19,6 +19,7 @@@@
 #include "union.h"
 
 #ifdef CONFIG_UNION_FS_XATTR
+/* copyup all extended attrs for a given dentry */
 static int copyup_xattrs(struct dentry *old_hidden_dentry,
 			 struct dentry *new_hidden_dentry)
 {
@@@@ -198,10 +199,10 @@@@ static inline int __copyup_reg_data(stru
d550 1
a550 1
@@@@ -214,10 +215,10 @@@@ static inline int __copyup_reg_data(stru
d563 1
a563 10
@@@@ -296,6 +297,8 @@@@ out:
 	return err;
 }
 
+/* dput the lower references for old and new dentry & clear a lower dentry
+ * pointer */
 static inline void __clear(struct dentry *dentry,
 			   struct dentry *old_hidden_dentry,
 			   int old_bstart, int old_bend,
@@@@ -303,7 +306,7 @@@@ static inline void __clear(struct dentry
d572 1
a572 9
@@@@ -311,6 +314,7 @@@@ static inline void __clear(struct dentry
 	dput(old_hidden_dentry);
 }
 
+/* copy up a dentry to a file of specified name */
 int copyup_named_dentry(struct inode *dir, struct dentry *dentry,
 			int bstart, int new_bindex, const char *name,
 			int namelen, struct file **copyup_file, loff_t len)
@@@@ -352,7 +356,7 @@@@ int copyup_named_dentry(struct inode *di
d581 1
a581 1
@@@@ -462,7 +466,7 @@@@ int copyup_named_file(struct inode *dir,
d590 1
a590 1
@@@@ -481,7 +485,7 @@@@ int copyup_file(struct inode *dir, struc
d599 1
a599 1
@@@@ -515,7 +519,7 @@@@ static inline void __cleanup_dentry(stru
d608 1
a608 1
@@@@ -525,9 +529,9 @@@@ static inline void __cleanup_dentry(stru
d621 1
a621 6
@@@@ -543,10 +547,12 @@@@ static inline void __cleanup_dentry(stru
 	set_dbend(dentry, new_bend);
 
 }
+
+/* set lower inode ptr and update bstart & bend if necessary */
d630 1
a630 6
@@@@ -554,15 +560,18 @@@@ static inline void __set_inode(struct de
 		ibend(upper->d_inode) = bindex;
 
 }
+
+/* set lower dentry ptr and update bstart & bend if necessary */
d639 1
a639 7
 		set_dbend(upper, bindex);
 }
+
 /* This function replicates the directory structure upto given dentry
  * in the bindex branch.  */
 struct dentry *create_parents_named(struct inode *dir, struct dentry *dentry,
@@@@ -626,7 +635,7 @@@@ struct dentry *create_parents_named(stru
d648 1
a648 1
@@@@ -657,7 +666,7 @@@@ struct dentry *create_parents_named(stru
d657 1
a657 1
@@@@ -682,8 +691,8 @@@@ struct dentry *create_parents_named(stru
d670 1
a670 10
+++ b/fs/unionfs/dentry.c	Sun Dec 03 01:57:24 2006 -0500
@@@@ -38,7 +38,7 @@@@ int unionfs_d_revalidate(struct dentry *
 	int restart = 0;
 	int interpose_flag;
 
-	struct nameidata lowernd;
+	struct nameidata lowernd; /* TODO: be gentler to the stack */
 
 	if (nd)
 		memcpy(&lowernd, nd, sizeof(struct nameidata));
d691 1
a691 1
@@@@ -98,9 +98,7 @@@@ restart:
a695 2
-				if (!hidden_dentry)
-					continue;
d697 2
d700 1
a700 3
 			}
 		}
@@@@ -117,15 +115,13 @@@@ restart:
d707 2
a708 2
-					if (!hidden_inode)
-						continue;
d719 1
a719 1
@@@@ -143,7 +139,7 @@@@ restart:
d728 1
a728 1
@@@@ -157,7 +153,7 @@@@ restart:
d737 1
a737 1
@@@@ -169,7 +165,7 @@@@ restart:
d746 1
a746 13
@@@@ -183,10 +179,9 @@@@ int unionfs_d_revalidate_wrap(struct den
 	int err;
 
 	lock_dentry(dentry);
-
 	err = unionfs_d_revalidate(dentry, nd);
-
 	unlock_dentry(dentry);
+
 	return err;
 }
 
@@@@ -200,14 +195,12 @@@@ void unionfs_d_release(struct dentry *de
d762 1
a762 1
@@@@ -217,20 +210,20 @@@@ void unionfs_d_release(struct dentry *de
d794 1
a794 1
+++ b/fs/unionfs/dirfops.c	Sun Dec 03 02:00:21 2006 -0500
d806 1
a806 20
@@@@ -35,7 +35,7 @@@@ struct unionfs_getdents_callback {
 	struct super_block *sb;
 };
 
-/* copied from generic filldir in fs/readir.c */
+/* based on generic filldir in fs/readir.c */
 static int unionfs_filldir(void *dirent, const char *name, int namelen,
 			   loff_t offset, u64 ino, unsigned int d_type)
 {
@@@@ -46,7 +46,8 @@@@ static int unionfs_filldir(void *dirent,
 
 	buf->filldir_called++;
 
-	if ((namelen > UNIONFS_WHLEN) && !strncmp(name, UNIONFS_WHPFX, UNIONFS_WHLEN)) {
+	if ((namelen > UNIONFS_WHLEN) &&
+	    !strncmp(name, UNIONFS_WHPFX, UNIONFS_WHLEN)) {
 		name += UNIONFS_WHLEN;
 		namelen -= UNIONFS_WHLEN;
 		is_wh_entry = 1;
@@@@ -65,7 +66,7 @@@@ static int unionfs_filldir(void *dirent,
d815 1
a815 1
@@@@ -76,7 +77,7 @@@@ static int unionfs_filldir(void *dirent,
d824 1
a824 1
@@@@ -98,7 +99,7 @@@@ static int unionfs_readdir(struct file *
d833 1
a833 1
@@@@ -108,19 +109,19 @@@@ static int unionfs_readdir(struct file *
d859 1
a859 1
@@@@ -134,7 +135,7 @@@@ static int unionfs_readdir(struct file *
d868 1
a868 1
@@@@ -147,7 +148,7 @@@@ static int unionfs_readdir(struct file *
d877 1
a877 1
@@@@ -159,16 +160,16 @@@@ static int unionfs_readdir(struct file *
d902 1
a902 1
@@@@ -196,7 +197,7 @@@@ static loff_t unionfs_dir_llseek(struct 
d911 1
a911 1
@@@@ -204,7 +205,7 @@@@ static loff_t unionfs_dir_llseek(struct 
d920 1
a920 1
@@@@ -230,8 +231,8 @@@@ static loff_t unionfs_dir_llseek(struct 
d933 2
a934 14
+++ b/fs/unionfs/dirhelper.c	Sun Dec 03 02:08:57 2006 -0500
@@@@ -18,7 +18,10 @@@@
 
 #include "union.h"
 
-/* Delete all of the whiteouts in a given directory for rmdir. */
+/* Delete all of the whiteouts in a given directory for rmdir.
+ *
+ * hidden directory inode should be locked
+ */
 int do_delete_whiteouts(struct dentry *dentry, int bindex,
 		     struct unionfs_dir_state *namelist)
 {
@@@@ -33,7 +36,7 @@@@ int do_delete_whiteouts(struct dentry *d
d943 1
a943 1
@@@@ -46,8 +49,8 @@@@ int do_delete_whiteouts(struct dentry *d
d954 1
a954 9
@@@@ -81,6 +84,7 @@@@ out:
 	return err;
 }
 
+/* delete whiteouts in a dir (for rmdir operation) using sioq if necessary */
 int delete_whiteouts(struct dentry *dentry, int bindex,
 		     struct unionfs_dir_state *namelist)
 {
@@@@ -101,7 +105,7 @@@@ int delete_whiteouts(struct dentry *dent
d963 1
a963 1
@@@@ -165,7 +169,7 @@@@ static int readdir_util_callback(void *d
d972 1
a972 1
@@@@ -212,7 +216,7 @@@@ int check_empty(struct dentry *dentry, s
d981 1
a981 1
@@@@ -221,10 +225,10 @@@@ int check_empty(struct dentry *dentry, s
d994 1
a994 1
@@@@ -235,7 +239,7 @@@@ int check_empty(struct dentry *dentry, s
d1247 2
a1248 2
+++ b/fs/unionfs/file.c	Sun Dec 03 02:30:15 2006 -0500
@@@@ -35,12 +35,11 @@@@ static loff_t unionfs_llseek(struct file
d1257 3
a1259 9
-	memcpy(&hidden_file->f_ra, &file->f_ra,
-	       sizeof(struct file_ra_state));
+	memcpy(&hidden_file->f_ra, &file->f_ra, sizeof(struct file_ra_state));
 
 	if (hidden_file->f_op && hidden_file->f_op->llseek)
 		err = hidden_file->f_op->llseek(hidden_file, offset, origin);
@@@@ -57,33 +56,23 @@@@ out:
 	return err;
 }
a1260 11
-ssize_t __unionfs_read(struct file * file, char __user * buf, size_t count,
-		       loff_t * ppos)
-{
-	int err = -EINVAL;
-	struct file *hidden_file = NULL;
+ssize_t unionfs_read(struct file * file, char __user * buf, size_t count,
+		     loff_t * ppos)
+{
+	struct file *hidden_file;
 	loff_t pos = *ppos;
-
a1261 6
+	int err;
+
+	if ((err = unionfs_file_revalidate(file, 0)))
+		goto out;
+
+	err = -EINVAL;
d1266 1
a1266 20
 	err = hidden_file->f_op->read(hidden_file, buf, count, &pos);
 	*ppos = pos;
-
-out:
-	return err;
-}
-
-ssize_t unionfs_read(struct file * file, char __user * buf, size_t count,
-		     loff_t * ppos)
-{
-	int err = -EINVAL;
-
-	if ((err = unionfs_file_revalidate(file, 0)))
-		goto out;
-
-	err = __unionfs_read(file, buf, count, ppos);
 
 out:
 	return err;
@@@@ -106,7 +95,7 @@@@ ssize_t __unionfs_write(struct file * fi
d1275 1
a1275 1
@@@@ -165,7 +154,7 @@@@ static unsigned int unionfs_poll(struct 
d1284 1
a1284 1
@@@@ -181,7 +170,7 @@@@ static int __do_mmap(struct file *file, 
d1293 1
a1293 13
@@@@ -195,11 +184,6 @@@@ out:
 	return err;
 }
 
-/* SP: mmap code now maps upper file
- * like old code, will only copyup at this point, it's possible to copyup
- * in writepage(), but I haven't bothered with that, as only apt-get seem
- * to want to write to a shared/write mapping
- */
 static int unionfs_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	int err = 0;
@@@@ -224,7 +208,7 @@@@ static int unionfs_fsync(struct file *fi
d1302 1
a1302 1
@@@@ -248,7 +232,7 @@@@ static int unionfs_fasync(int fd, struct
d1313 1
a1313 1
+++ b/fs/unionfs/inode.c	Sun Dec 03 02:42:15 2006 -0500
d1323 3
a1325 2
@@@@ -86,11 +86,11 @@@@ static int unionfs_create(struct inode *
 		mutex_unlock(&whiteout_dentry->d_inode->i_mutex);
a1326 5
 		if (err)
-			printk(KERN_WARNING
-			       "unionfs: %s:%d: notify_change failed: %d, ignoring..\n",
-			       __FILE__, __LINE__, err);
-
a1327 4
+			printk(KERN_WARNING "unionfs: %s:%d: notify_change "
+				"failed: %d, ignoring..\n",
+				__FILE__, __LINE__, err);
+
d1363 1
a1363 28
@@@@ -230,9 +230,8 @@@@ static int unionfs_link(struct dentry *o
 		goto out;
 	}
 
-	whiteout_dentry =
-	    lookup_one_len(name, hidden_new_dentry->d_parent,
-			   new_dentry->d_name.len + UNIONFS_WHLEN);
+	whiteout_dentry = lookup_one_len(name, hidden_new_dentry->d_parent,
+				new_dentry->d_name.len + UNIONFS_WHLEN);
 	if (IS_ERR(whiteout_dentry)) {
 		err = PTR_ERR(whiteout_dentry);
 		goto out;
@@@@ -244,11 +243,11 @@@@ static int unionfs_link(struct dentry *o
 	} else {
 		/* found a .wh.foo entry, unlink it and then call vfs_link() */
 		hidden_dir_dentry = lock_parent(whiteout_dentry);
-		if (!(err = is_robranch_super(new_dentry->d_sb,
-				       dbstart(new_dentry)))) {
+		err = is_robranch_super(new_dentry->d_sb, dbstart(new_dentry));
+		if (!err)
 			err = vfs_unlink(hidden_dir_dentry->d_inode,
 				       whiteout_dentry);
-		}
+
 		fsstack_copy_attr_times(dir, hidden_dir_dentry->d_inode);
 		dir->i_nlink = unionfs_get_nlinks(dir);
 		unlock_dir(hidden_dir_dentry);
@@@@ -267,14 +266,13 @@@@ static int unionfs_link(struct dentry *o
d1374 1
a1374 8
 	if (!(err = is_robranch(old_dentry)))
-		err =
-		    vfs_link(hidden_old_dentry, hidden_dir_dentry->d_inode,
+		err = vfs_link(hidden_old_dentry, hidden_dir_dentry->d_inode,
 			     hidden_new_dentry);
 	unlock_dir(hidden_dir_dentry);
 
@@@@ -292,12 +290,11 @@@@ docopyup:
d1383 1
a1383 7
-				err =
-				    vfs_link(hidden_old_dentry,
+				err = vfs_link(hidden_old_dentry,
 					     hidden_dir_dentry->d_inode,
 					     hidden_new_dentry);
 				unlock_dir(hidden_dir_dentry);
@@@@ -347,9 +344,10 @@@@ static int unionfs_symlink(struct inode 
a1387 2
-
-	/* check if whiteout exists in this branch, i.e. lookup .wh.foo first. If present, delete it */
d1389 2
a1390 3
+
+	/* check if whiteout exists in this branch, i.e. lookup .wh.foo
+	 * first. If present, delete it */
d1392 3
a1394 24
 	if (IS_ERR(name)) {
 		err = PTR_ERR(name);
@@@@ -371,11 +369,9 @@@@ static int unionfs_symlink(struct inode 
 		/* found a .wh.foo entry, unlink it and then call vfs_symlink() */
 		hidden_dir_dentry = lock_parent(whiteout_dentry);
 
-		if (!(err = is_robranch_super(dentry->d_sb, bstart))) {
-			err =
-			    vfs_unlink(hidden_dir_dentry->d_inode,
+		if (!(err = is_robranch_super(dentry->d_sb, bstart)))
+			err = vfs_unlink(hidden_dir_dentry->d_inode,
 				       whiteout_dentry);
-		}
 		dput(whiteout_dentry);
 
 		fsstack_copy_attr_times(dir, hidden_dir_dentry->d_inode);
@@@@ -393,23 +389,24 @@@@ static int unionfs_symlink(struct inode 
 		}
 	}
 
-	/* deleted whiteout if it was present, now do a normal vfs_symlink() with
-	   possible recursive directory creation */
+	/* deleted whiteout if it was present, now do a normal vfs_symlink()
+	 * with possible recursive directory creation */
d1400 2
a1401 22
-			 * dentry directory structure in branch 'bindex'. hidden_dentry will NOT be null when
-			 * bindex == bstart because lookup passed as a negative unionfs dentry pointing to a
-			 * lone negative underlying dentry */
+			 * dentry directory structure in branch 'bindex'.
+			 * hidden_dentry will NOT be null when bindex ==
+			 * bstart because lookup passed as a negative
+			 * unionfs dentry pointing to a lone negative
+			 * underlying dentry */
 			hidden_dentry = create_parents(dir, dentry, bindex);
 			if (!hidden_dentry || IS_ERR(hidden_dentry)) {
 				if (IS_ERR(hidden_dentry))
 					err = PTR_ERR(hidden_dentry);
 
-				printk(KERN_DEBUG
-				       "hidden dentry NULL (or error) for bindex = %d\n",
-				       bindex);
+				printk(KERN_DEBUG "hidden dentry NULL (or error)"
+					"for bindex = %d\n", bindex);
 				continue;
 			}
 		}
@@@@ -464,7 +461,7 @@@@ static int unionfs_mkdir(struct inode *p
d1410 1
a1410 12
@@@@ -502,9 +499,8 @@@@ static int unionfs_mkdir(struct inode *p
 			if (!IS_COPYUP_ERR(err))
 				goto out;
 			bstart--;
-		} else {
+		} else
 			whiteout_unlinked = 1;
-		}
 	}
 
 	for (bindex = bstart; bindex >= 0; bindex--) {
@@@@ -514,13 +510,12 @@@@ static int unionfs_mkdir(struct inode *p
d1419 1
a1419 9
-				printk(KERN_DEBUG
-				       "hidden dentry NULL for bindex = %d\n",
-				       bindex);
+				printk(KERN_DEBUG "hidden dentry NULL for "
+					"bindex = %d\n", bindex);
 				continue;
 			}
 		}
@@@@ -541,9 +536,9 @@@@ static int unionfs_mkdir(struct inode *p
d1432 1
a1432 11
@@@@ -561,7 +556,8 @@@@ static int unionfs_mkdir(struct inode *p
 
 		err = make_dir_opaque(dentry, dbstart(dentry));
 		if (err) {
-			printk(KERN_DEBUG "mkdir: error creating .wh.__dir_opaque: %d\n", err);
+			printk(KERN_ERROR "mkdir: error creating "
+				".wh.__dir_opaque: %d\n", err);
 			goto out;
 		}
 
@@@@ -592,7 +588,7 @@@@ static int unionfs_mknod(struct inode *d
d1441 1
a1441 23
@@@@ -601,9 +597,8 @@@@ static int unionfs_mknod(struct inode *d
 		goto out;
 	}
 
-	whiteout_dentry =
-	    lookup_one_len(name, hidden_dentry->d_parent,
-			   dentry->d_name.len + UNIONFS_WHLEN);
+	whiteout_dentry = lookup_one_len(name, hidden_dentry->d_parent,
+				dentry->d_name.len + UNIONFS_WHLEN);
 	if (IS_ERR(whiteout_dentry)) {
 		err = PTR_ERR(whiteout_dentry);
 		goto out;
@@@@ -629,16 +624,15 @@@@ static int unionfs_mknod(struct inode *d
 				goto out;
 
 			bstart--;
-		} else {
+		} else
 			whiteout_unlinked = 1;
-		}
 	}
 
 	for (bindex = bstart; bindex >= 0; bindex--) {
d1450 1
a1450 12
@@@@ -681,9 +675,7 @@@@ out:
 	if (!dentry->d_inode)
 		d_drop(dentry);
 
-	if (name) {
-		kfree(name);
-	}
+	kfree(name);
 
 	unlock_dentry(dentry);
 	return err;
@@@@ -695,7 +687,7 @@@@ int unionfs_readlink(struct dentry *dent
d1459 1
a1459 22
@@@@ -703,8 +695,7 @@@@ int unionfs_readlink(struct dentry *dent
 		goto out;
 	}
 
-	err = hidden_dentry->d_inode->i_op->readlink(hidden_dentry,
-						     buf, bufsiz);
+	err = hidden_dentry->d_inode->i_op->readlink(hidden_dentry, buf, bufsiz);
 	if (err > 0)
 		fsstack_copy_attr_atime(dentry->d_inode, hidden_dentry->d_inode);
 
@@@@ -787,9 +778,8 @@@@ static int inode_permission(struct inode
 		    (branchperms(nd->mnt->mnt_sb, bindex) & MAY_NFSRO)) {
 			retval = generic_permission(inode, submask, NULL);
 		}
-	} else {
+	} else
 		retval = generic_permission(inode, submask, NULL);
-	}
 
 	if (retval && retval != -EROFS)	/* ignore EROFS */
 		return retval;
@@@@ -811,7 +801,7 @@@@ static int unionfs_permission(struct ino
d1468 1
a1468 18
@@@@ -821,13 +811,16 @@@@ static int unionfs_permission(struct ino
 		 */
 		if (!is_file && !S_ISDIR(hidden_inode->i_mode))
 			continue;
+
 		/* We use our own special version of permission, such that
 		 * only the first branch returns -EROFS. */
 		err = inode_permission(hidden_inode, mask, nd, bindex);
+
 		/* The permissions are an intersection of the overall directory
 		 * permissions, so we fail if one fails. */
 		if (err)
 			goto out;
+
 		/* only the leftmost file matters. */
 		if (is_file || write_mask) {
 			if (is_file && write_mask) {
@@@@ -859,7 +852,7 @@@@ static int unionfs_setattr(struct dentry
d1477 1
a1477 1
@@@@ -880,7 +873,7 @@@@ static int unionfs_setattr(struct dentry
d1486 1
a1486 1
@@@@ -896,7 +889,7 @@@@ static int unionfs_setattr(struct dentry
d1497 3
a1499 19
+++ b/fs/unionfs/lookup.c	Sun Dec 03 02:59:26 2006 -0500
@@@@ -21,7 +21,8 @@@@ static int is_opaque_dir(struct dentry *
 static int is_opaque_dir(struct dentry *dentry, int bindex);
 static int is_validname(const char *name);
 
-struct dentry *unionfs_lookup_backend(struct dentry *dentry, struct nameidata *nd, int lookupmode)
+struct dentry *unionfs_lookup_backend(struct dentry *dentry, struct nameidata *nd,
+				      int lookupmode)
 {
 	int err = 0;
 	struct dentry *hidden_dentry = NULL;
@@@@ -44,11 +45,11 @@@@ struct dentry *unionfs_lookup_backend(st
 	/* We should already have a lock on this dentry in the case of a
 	 * partial lookup, or a revalidation. Otherwise it is returned from
 	 * new_dentry_private_data already locked.  */
-	if (lookupmode == INTERPOSE_PARTIAL || lookupmode == INTERPOSE_REVAL
-	    || lookupmode == INTERPOSE_REVAL_NEG)
+	if (lookupmode == INTERPOSE_PARTIAL || lookupmode == INTERPOSE_REVAL ||
+	    lookupmode == INTERPOSE_REVAL_NEG)
d1507 1
a1507 1
@@@@ -93,12 +94,12 @@@@ struct dentry *unionfs_lookup_backend(st
d1522 1
a1522 1
@@@@ -148,9 +149,9 @@@@ struct dentry *unionfs_lookup_backend(st
d1534 1
a1534 1
@@@@ -168,7 +169,7 @@@@ struct dentry *unionfs_lookup_backend(st
d1543 1
a1543 1
@@@@ -182,10 +183,11 @@@@ struct dentry *unionfs_lookup_backend(st
d1552 1
a1552 2
+		unionfs_set_lower_mnt_idx(dentry, bindex,
+			mntget(unionfs_lower_mnt_idx(parent_dentry, bindex)));
d1556 1
a1556 1
@@@@ -199,7 +201,7 @@@@ struct dentry *unionfs_lookup_backend(st
d1565 1
a1565 11
@@@@ -209,8 +211,7 @@@@ struct dentry *unionfs_lookup_backend(st
 			mntput(first_hidden_mnt);
 			err = opaque;
 			goto out_free;
-		}
-		if (opaque) {
+		} else if (opaque) {
 			set_dbend(dentry, bindex);
 			set_dbopaque(dentry, bindex);
 			break;
@@@@ -229,7 +230,7 @@@@ out_negative:
d1574 1
a1574 1
@@@@ -237,7 +238,7 @@@@ out_negative:
d1583 1
a1583 1
@@@@ -249,10 +250,10 @@@@ out_negative:
d1598 1
a1598 1
@@@@ -302,18 +303,18 @@@@ out_free:
d1625 1
a1625 1
@@@@ -351,7 +352,7 @@@@ static int is_opaque_dir(struct dentry *
d1634 1
a1634 37
@@@@ -382,6 +383,7 @@@@ out:
 	return err;
 }
 
+/* is the filename valid == !(whiteout for a file or opaque dir marker) */
 static int is_validname(const char *name)
 {
 	if (!strncmp(name, UNIONFS_WHPFX, UNIONFS_WHLEN))
@@@@ -396,14 +398,11 @@@@ static struct kmem_cache *unionfs_dentry
 static struct kmem_cache *unionfs_dentry_cachep;
 int init_dentry_cache(void)
 {
-	unionfs_dentry_cachep =
-	    kmem_cache_create("unionfs_dentry",
-			      sizeof(struct unionfs_dentry_info), 0,
-			      SLAB_RECLAIM_ACCOUNT, NULL, NULL);
-
-	if (!unionfs_dentry_cachep)
-		return -ENOMEM;
-	return 0;
+	unionfs_dentry_cachep = kmem_cache_create("unionfs_dentry",
+					sizeof(struct unionfs_dentry_info), 0,
+					SLAB_RECLAIM_ACCOUNT, NULL, NULL);
+
+	return (unionfs_dentry_cachep ? 0 : -ENOMEM);
 }
 
 void destroy_dentry_cache(void)
@@@@ -419,29 +418,33 @@@@ void free_dentry_private_data(struct uni
 	kmem_cache_free(unionfs_dentry_cachep, udi);
 }
 
+/* allocate new dentry private data, free old one if necessary */
 int new_dentry_private_data(struct dentry *dentry)
 {
+	struct unionfs_dentry_info *info;
 	int newsize;
d1663 5
a1667 7
+	info = UNIONFS_D(dentry);
+
+	info->bstart = -1;
+	info->bend = -1;
+	info->bopaque = -1;
+	info->bcount = sbmax(dentry->d_sb);
+	atomic_set(&info->generation,
d1672 1
a1672 1
@@@@ -452,32 +455,35 @@@@ int new_dentry_private_data(struct dentr
d1684 2
a1685 2
+			kfree(info->lower_paths);
+			info->lower_paths = NULL;
d1689 3
a1691 3
+	if (!info->lower_paths && newsize) {
+		info->lower_paths = kmalloc(newsize, GFP_ATOMIC);
+		if (!info->lower_paths)
d1696 1
a1696 1
+	memset(info->lower_paths, 0, (oldsize > newsize ? oldsize : newsize));
a1699 1
+	/* */
d1703 1
a1703 1
+	kfree(info->lower_paths);
d1708 1
a1708 1
+	free_dentry_private_data(info);
d1713 1
a1713 7
 
+/* scan through the lower dentry objects, and set bstart to reflect the
+ * starting branch */
 void update_bstart(struct dentry *dentry)
 {
 	int bindex;
@@@@ -486,7 +492,7 @@@@ void update_bstart(struct dentry *dentry
d1722 1
a1722 1
@@@@ -494,7 +500,7 @@@@ void update_bstart(struct dentry *dentry
d1736 1
a1736 1
+++ b/fs/unionfs/main.c	Sun Dec 03 03:07:29 2006 -0500
d1782 1
a1782 1
@@@@ -93,14 +93,15 @@@@ int unionfs_interpose(struct dentry *den
d1787 1
a1787 2
+		unionfs_set_lower_inode_idx(inode, bindex,
+				igrab(hidden_dentry->d_inode));
d1799 1
a1799 1
@@@@ -162,20 +163,26 @@@@ void unionfs_reinterpose(struct dentry *
d1819 1
a1819 39
 }
 
+/* make sure the branch we just looked up (nd) makes sense:
+ *
+ * 1) we're not trying to stack unionfs on top of unionfs
+ * 2) it exists
+ * 3) is a directory
+ */
 int check_branch(struct nameidata *nd)
 {
 	if (!strcmp(nd->dentry->d_sb->s_type->name, "unionfs"))
@@@@ -205,6 +212,8 @@@@ int is_branch_overlap(struct dentry *den
 
 	return (dent == dent1);
 }
+
+/* parse branch mode */
 static int parse_branch_mode(char *name)
 {
 	int perms;
@@@@ -212,9 +221,6 @@@@ static int parse_branch_mode(char *name)
 	if (!strcmp(name + l - 3, "=ro")) {
 		perms = MAY_READ;
 		name[l - 3] = '\0';
-	} else if (!strcmp(name + l - 6, "=nfsro")) {
-		perms = MAY_READ | MAY_NFSRO;
-		name[l - 6] = '\0';
 	} else if (!strcmp(name + l - 3, "=rw")) {
 		perms = MAY_READ | MAY_WRITE;
 		name[l - 3] = '\0';
@@@@ -224,6 +230,7 @@@@ static int parse_branch_mode(char *name)
 	return perms;
 }
 
+/* parse the dirs= mount argument */
 static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info
 			     *hidden_root_info, char *options)
 {
@@@@ -251,16 +258,16 @@@@ static int parse_dirs_option(struct supe
d1841 1
a1841 1
@@@@ -296,15 +303,15 @@@@ static int parse_dirs_option(struct supe
d1862 1
a1862 1
@@@@ -314,16 +321,17 @@@@ static int parse_dirs_option(struct supe
d1878 2
a1879 7
-				printk(KERN_WARNING "unionfs: branches %d and %d overlap\n", i, j);
+				printk(KERN_WARNING "unionfs: branches %d and "
+					"%d overlap\n", i, j);
 				err = -EINVAL;
 				goto out;
 			}
@@@@ -333,19 +341,19 @@@@ out:
d1906 1
a1906 10
@@@@ -355,8 +363,6 @@@@ out:
  *
  * Returns the dentry object of the lower-level (hidden) directory;
  * We want to mount our stackable file system on top of that hidden directory.
- *
- * Sets default debugging level to N, if any.
  */
 static struct unionfs_dentry_info *unionfs_parse_options(struct super_block *sb,
 							 char *options)
@@@@ -373,9 +379,9 @@@@ static struct unionfs_dentry_info *union
d1919 1
a1919 1
@@@@ -433,15 +439,15 @@@@ static struct unionfs_dentry_info *union
d1940 1
a1940 1
@@@@ -450,17 +456,22 @@@@ out_error:
d1955 1
a1955 12
 	return hidden_root_info;
 }
 
+/* our custom d_alloc_root workalike 
+ *
+ * we can't use d_alloc_root if we want to use our own interpose function
+ * unchanged, so we simply call our own "fake" d_alloc_root
+ */
 static struct dentry *unionfs_d_alloc_root(struct super_block *sb)
 {
 	struct dentry *ret = NULL;
@@@@ -496,52 +507,49 @@@@ static int unionfs_read_super(struct sup
d1977 1
a1977 6
 		printk(KERN_WARNING
-		       "unionfs_read_super: error while parsing options (err = %ld)\n",
-		       PTR_ERR(hidden_root_info));
+		       "unionfs_read_super: error while parsing options "
+		       "(err = %ld)\n", PTR_ERR(hidden_root_info));
 		err = PTR_ERR(hidden_root_info);
d2010 1
a2010 10
-	/*
-	 * we can't use d_alloc_root if we want to use
-	 * our own interpose function unchanged,
-	 * so we simply call our own "fake" d_alloc_root
-	 */
+	/* See comment next to the definition of unionfs_d_alloc_root */
 	sb->s_root = unionfs_d_alloc_root(sb);
 	if (!sb->s_root) {
 		err = -ENOMEM;
@@@@ -549,7 +557,7 @@@@ static int unionfs_read_super(struct sup
d2019 1
a2019 1
@@@@ -558,17 +566,17 @@@@ static int unionfs_read_super(struct sup
d2043 1
a2043 1
@@@@ -577,41 +585,38 @@@@ static int unionfs_read_super(struct sup
a2066 8
-
-			if (d)
-				dput(d);
-
-			if (m)
-				mntput(m);
-		}
-		kfree(hidden_root_info->udi_path);
d2069 8
a2076 4
+
+			dput(d);
+			mntput(m);
+		}
d2099 2
a2100 14
+++ b/fs/unionfs/rdstate.c	Sun Dec 03 03:11:41 2006 -0500
@@@@ -33,10 +33,7 @@@@ int init_filldir_cache(void)
 	    kmem_cache_create("unionfs_filldir", sizeof(struct filldir_node), 0,
 			      SLAB_RECLAIM_ACCOUNT, NULL, NULL);
 
-	if (!unionfs_filldir_cachep)
-		return -ENOMEM;
-
-	return 0;
+	return (unionfs_filldir_cachep ? 0 : -ENOMEM);
 }
 
 void destroy_filldir_cache(void)
@@@@ -63,19 +60,17 @@@@ static int guesstimate_hash_size(struct 
d2114 2
a2115 13
-		if (hidden_inode->i_size == DENTPAGE) {
+		if (hidden_inode->i_size == DENTPAGE)
 			hashsize += DENTPERONEPAGE;
-		} else {
-			hashsize +=
-			    (hidden_inode->i_size / DENTPAGE) * DENTPERPAGE;
-		}
+		else
+			hashsize += (hidden_inode->i_size / DENTPAGE) * DENTPERPAGE;
 	}
 
 	return hashsize;
@@@@ -84,13 +79,12 @@@@ int init_rdstate(struct file *file)
a2121 4
-	    alloc_rdstate(file->f_dentry->d_inode, fbstart(file));
-	if (!ftopd(file)->rdstate)
-		return -ENOMEM;
-	return 0;
d2124 6
a2129 4
+	UNIONFS_F(file)->rdstate = alloc_rdstate(file->f_dentry->d_inode,
+						 fbstart(file));
+	
+	return (UNIONFS_F(file)->rdstate ? 0 : -ENOMEM);
d2131 1
a2131 3
 
 struct unionfs_dir_state *find_rdstate(struct inode *inode, loff_t fpos)
@@@@ -98,18 +92,18 @@@@ struct unionfs_dir_state *find_rdstate(s
d2156 1
a2156 10
@@@@ -135,30 +129,29 @@@@ struct unionfs_dir_state *alloc_rdstate(
 	if (mallocsize > PAGE_SIZE)
 		mallocsize = PAGE_SIZE;
 
-	hashsize =
-	    (mallocsize -
+	hashsize = (mallocsize -
 	     sizeof(struct unionfs_dir_state)) / sizeof(struct list_head);
 
 	rdstate = kmalloc(mallocsize, GFP_KERNEL);
d2194 1
a2194 1
@@@@ -175,8 +168,8 @@@@ void free_rdstate(struct unionfs_dir_sta
d2205 1
a2205 1
@@@@ -203,29 +196,33 @@@@ struct filldir_node *find_filldir_node(s
d2218 2
a2219 7
-		if (cursor->namelen == namelen && cursor->hash == hash
-		    && !strncmp(cursor->name, name, namelen)) {
-			/* a duplicate exists, and hence no need to create entry to the list */
+		if (cursor->namelen == namelen && cursor->hash == hash &&
+		    !strncmp(cursor->name, name, namelen)) {
+			/* a duplicate exists, and hence no need to create
+			 * entry to the list */
d2221 1
a2221 1
-			/* if the duplicate is in this branch, then the file system is corrupted. */
d2223 3
a2225 2
-				printk(KERN_DEBUG
-				       "Possible I/O error unionfs_filldir: a file is duplicated in the same branch %d: %s\n",
d2227 1
a2227 8
+
+			/* if the duplicate is in this branch, then the file
+			 * system is corrupted. */
+			if (cursor->bindex == rdstate->bindex) {
+				printk(KERN_DEBUG "Possible I/O error "
+					"unionfs_filldir: a file is duplicated "
+					"in the same branch %d: %s\n",
+					rdstate->bindex, cursor->name);
d2231 1
a2231 21
 	}
 
-	if (!found) {
+	if (!found)
 		cursor = NULL;
-	}
+
 	return cursor;
 }
 
@@@@ -237,9 +234,6 @@@@ inline struct filldir_node *alloc_filldi
 	newnode =
 	    (struct filldir_node *)kmem_cache_alloc(unionfs_filldir_cachep,
 						    SLAB_KERNEL);
-	if (!newnode)
-		goto out;
-
 out:
 	return newnode;
 }
@@@@ -256,8 +250,8 @@@@ int add_filldir_node(struct unionfs_dir_
d2242 1
a2242 13
@@@@ -271,9 +265,9 @@@@ int add_filldir_node(struct unionfs_dir_
 	new->bindex = bindex;
 	new->whiteout = whiteout;
 
-	if (namelen < DNAME_INLINE_LEN_MIN) {
+	if (namelen < DNAME_INLINE_LEN_MIN)
 		new->name = new->iname;
-	} else {
+	else {
 		new->name = kmalloc(namelen + 1, GFP_KERNEL);
 		if (!new->name) {
 			kmem_cache_free(unionfs_filldir_cachep, new);
@@@@ -285,7 +279,7 @@@@ int add_filldir_node(struct unionfs_dir_
@


1.1.2.10
log
@Ever more changes!
@
text
@d1524 1
a1524 1
+++ b/fs/unionfs/inode.c	Sun Dec 03 03:24:57 2006 -0500
d1759 1
a1759 1
+			printk(KERN_ERR "mkdir: error creating "
d1900 1
a1900 1
+++ b/fs/unionfs/lookup.c	Sun Dec 03 03:28:56 2006 -0500
d2099 1
a2101 1
+	struct unionfs_dentry_info *info = UNIONFS_D(dentry);
d2106 3
a2108 1
-		    kmem_cache_alloc(unionfs_dentry_cachep, SLAB_ATOMIC);
d2110 1
a2110 6
+	if (!info) {
+		dentry->d_fsdata = kmem_cache_alloc(unionfs_dentry_cachep,
+						SLAB_ATOMIC);
+		info = UNIONFS_D(dentry);
+
+		if (!info)
d2115 1
a2115 1
+		init_MUTEX_LOCKED(&info->sem);
d2117 1
a2117 1
+		info->lower_paths = NULL;
d2127 3
a2129 1
+		oldsize = sizeof(struct path) * info->bcount;
d2656 1
a2656 1
+++ b/fs/unionfs/rdstate.c	Sun Dec 03 03:25:35 2006 -0500
d2798 1
a2798 1
@@@@ -203,45 +196,40 @@@@ struct filldir_node *find_filldir_node(s
d2845 4
a2848 8
 inline struct filldir_node *alloc_filldir_node(const char *name, int namelen,
 					       unsigned int hash, int bindex)
 {
-	struct filldir_node *newnode;
-
-	newnode =
-	    (struct filldir_node *)kmem_cache_alloc(unionfs_filldir_cachep,
-						    SLAB_KERNEL);
d2852 2
a2853 3
-out:
-	return newnode;
+	return kmem_cache_alloc(unionfs_filldir_cachep, SLAB_KERNEL);
d2855 1
a2855 3
 
 int add_filldir_node(struct unionfs_dir_state *rdstate, const char *name,
@@@@ -256,8 +244,8 @@@@ int add_filldir_node(struct unionfs_dir_
d2866 1
a2866 1
@@@@ -271,9 +259,9 @@@@ int add_filldir_node(struct unionfs_dir_
d2878 1
a2878 1
@@@@ -285,7 +273,7 @@@@ int add_filldir_node(struct unionfs_dir_
d2889 1
a2889 1
+++ b/fs/unionfs/rename.c	Sun Dec 03 03:26:00 2006 -0500
d2901 1
a2901 55
@@@@ -52,9 +52,8 @@@@ static int do_rename(struct inode *old_d
 		goto out;
 	}
 
-	hidden_wh_dentry =
-	    lookup_one_len(wh_name, hidden_new_dentry->d_parent,
-			   new_dentry->d_name.len + UNIONFS_WHLEN);
+	hidden_wh_dentry = lookup_one_len(wh_name, hidden_new_dentry->d_parent,
+				new_dentry->d_name.len + UNIONFS_WHLEN);
 	if (IS_ERR(hidden_wh_dentry)) {
 		err = PTR_ERR(hidden_wh_dentry);
 		goto out;
@@@@ -72,10 +71,10 @@@@ static int do_rename(struct inode *old_d
 		}
 
 		hidden_wh_dir_dentry = lock_parent(hidden_wh_dentry);
-		if (!(err = is_robranch_super(old_dentry->d_sb, bindex))) {
+		if (!(err = is_robranch_super(old_dentry->d_sb, bindex)))
 			err = vfs_unlink(hidden_wh_dir_dentry->d_inode,
 					       hidden_wh_dentry);
-		}
+
 		dput(hidden_wh_dentry);
 		unlock_dir(hidden_wh_dir_dentry);
 		if (err)
@@@@ -93,9 +92,8 @@@@ static int do_rename(struct inode *old_d
 	if (err)
 		goto out_unlock;
 
-	/* ready to whiteout for old_dentry.
-	   caller will create the actual whiteout,
-	   and must dput(*wh_old) */
+	/* ready to whiteout for old_dentry. caller will create the actual
+	 * whiteout, and must dput(*wh_old) */
 	if (wh_old) {
 		char *whname;
 		whname = alloc_whname(old_dentry->d_name.name,
@@@@ -165,13 +163,11 @@@@ static int do_unionfs_rename(struct inod
 	err = do_rename(old_dir, old_dentry, new_dir, new_dentry, old_bstart,
 			&wh_old);
 	if (err) {
-		if (!IS_COPYUP_ERR(err)) {
-			goto out;
-		}
+		if (!IS_COPYUP_ERR(err))
+			goto out;
 		do_copyup = old_bstart - 1;
-	} else {
+	} else
 		revert = 1;
-	}
 
 	/* Unlink all instances of destination that exist to the left of
 	 * bstart of source. On error, revert back, goto out.
@@@@ -180,17 +176,14 @@@@ static int do_unionfs_rename(struct inod
a2905 1
-		if (!unlink_dentry) {
d2907 1
a2907 1
+		if (!unlink_dentry)
d2909 2
a2910 14
-		}
 
 		unlink_dir_dentry = lock_parent(unlink_dentry);
-		if (!(err = is_robranch_super(old_dir->i_sb, bindex))) {
-			err =
-			    vfs_unlink(unlink_dir_dentry->d_inode,
+		if (!(err = is_robranch_super(old_dir->i_sb, bindex)))
+			err = vfs_unlink(unlink_dir_dentry->d_inode,
 				       unlink_dentry);
-		}
 
 		fsstack_copy_attr_times(new_dentry->d_parent->d_inode,
 				     unlink_dir_dentry->d_inode);
@@@@ -202,7 +195,7 @@@@ static int do_unionfs_rename(struct inod
d2919 1
a2919 60
@@@@ -215,16 +208,14 @@@@ static int do_unionfs_rename(struct inod
 	if (do_copyup != -1) {
 		for (bindex = do_copyup; bindex >= 0; bindex--) {
 			/* copyup the file into some left directory, so that you can rename it */
-			err =
-			    copyup_dentry(old_dentry->d_parent->d_inode,
-					  old_dentry, old_bstart, bindex, NULL,
-					  old_dentry->d_inode->i_size);
+			err = copyup_dentry(old_dentry->d_parent->d_inode,
+					    old_dentry, old_bstart, bindex, NULL,
+					    old_dentry->d_inode->i_size);
 			if (!err) {
 				dput(wh_old);
 				bwh_old = bindex;
-				err =
-				    do_rename(old_dir, old_dentry, new_dir,
-					      new_dentry, bindex, &wh_old);
+				err = do_rename(old_dir, old_dentry, new_dir,
+						new_dentry, bindex, &wh_old);
 				break;
 			}
 		}
@@@@ -243,8 +234,7 @@@@ static int do_unionfs_rename(struct inod
 	 */
 	if ((old_bstart != old_bend) || (do_copyup != -1)) {
 		struct dentry *hidden_parent;
-		BUG_ON(!wh_old || IS_ERR(wh_old) || wh_old->d_inode
-		       || bwh_old < 0);
+		BUG_ON(!wh_old || wh_old->d_inode || bwh_old < 0);
 		hidden_parent = lock_parent(wh_old);
 		local_err = vfs_create(hidden_parent->d_inode, wh_old, S_IRUGO,
 				       NULL);
@@@@ -253,7 +243,8 @@@@ static int do_unionfs_rename(struct inod
 			set_dbopaque(old_dentry, bwh_old);
 		else {
 			/* We can't fix anything now, so we cop-out and use -EIO. */
-			printk("<0>We can't create a whiteout for the source in rename!\n");
+			printk(KERN_ERR "We can't create a whiteout for the "
+					"source in rename!\n");
 			err = -EIO;
 		}
 	}
@@@@ -266,38 +257,37 @@@@ revert:
 	/* Do revert here. */
 	local_err = unionfs_refresh_hidden_dentry(new_dentry, old_bstart);
 	if (local_err) {
-		printk(KERN_WARNING
-		       "Revert failed in rename: the new refresh failed.\n");
+		printk(KERN_WARNING "Revert failed in rename: the new refresh "
+				"failed.\n");
 		eio = -EIO;
 	}
 
 	local_err = unionfs_refresh_hidden_dentry(old_dentry, old_bstart);
 	if (local_err) {
-		printk(KERN_WARNING
-		       "Revert failed in rename: the old refresh failed.\n");
+		printk(KERN_WARNING "Revert failed in rename: the old refresh "
+				"failed.\n");
 		eio = -EIO;
d2925 4
a2928 6
-		printk(KERN_WARNING
-		       "Revert failed in rename: the object disappeared from under us!\n");
+	if (!unionfs_lower_dentry_idx(new_dentry, bindex) ||
+	    !unionfs_lower_dentry_idx(new_dentry, bindex)->d_inode) {
+		printk(KERN_WARNING "Revert failed in rename: the object "
+				"disappeared from under us!\n");
d2935 4
a2938 6
-		printk(KERN_WARNING
-		       "Revert failed in rename: the object was created underneath us!\n");
+	if (unionfs_lower_dentry_idx(old_dentry, bindex) &&
+	    unionfs_lower_dentry_idx(old_dentry, bindex)->d_inode) {
+		printk(KERN_WARNING "Revert failed in rename: the object was "
+				"created underneath us!\n");
d2940 1
a2940 42
 		goto revert_out;
 	}
 
-	local_err =
-	    do_rename(new_dir, new_dentry, old_dir, old_dentry, old_bstart,
-		      NULL);
+	local_err = do_rename(new_dir, new_dentry, old_dir, old_dentry, old_bstart,
+					NULL);
 
 	/* If we can't fix it, then we cop-out with -EIO. */
 	if (local_err) {
@@@@ -317,29 +307,6 @@@@ revert_out:
 		err = eio;
 	return err;
 }
-
-/*
- * Unfortunately, we cannot simply call things like dbstart() in different
- * places of the rename code because we move things around. So, we use this
- * structure to pass the necessary information around to all the places that
- * need it.
- */
-struct rename_info {
-	int do_copyup;
-	int do_whiteout;
-	int rename_ok;
-
-	int old_bstart;
-	int old_bend;
-	int new_bstart;
-	int new_bend;
-
-	int isdir;		/* Is the source a directory? */
-	int clobber;		/* Are we clobbering the destination? */
-
-	int bwh_old;		/* where we create the whiteout */
-	struct dentry *wh_old;	/* lookup and set by do_rename() */
-};
 
 static struct dentry *lookup_whiteout(struct dentry *dentry)
 {
@@@@ -357,11 +324,10 @@@@ static struct dentry *lookup_whiteout(st
d2948 2
a2949 29
-		wh_dentry =
-		    lookup_one_len(whname, hidden_parent,
+		wh_dentry = lookup_one_len(whname, hidden_parent,
 				   dentry->d_name.len + UNIONFS_WHLEN);
 		if (IS_ERR(wh_dentry))
 			continue;
@@@@ -434,9 +400,8 @@@@ int unionfs_rename(struct inode *old_dir
 	else if (new_dentry->d_inode) {
 		if (S_ISDIR(old_dentry->d_inode->i_mode) !=
 		    S_ISDIR(new_dentry->d_inode->i_mode)) {
-			err =
-			    S_ISDIR(old_dentry->d_inode->
-				    i_mode) ? -ENOTDIR : -EISDIR;
+			err = S_ISDIR(old_dentry->d_inode->i_mode) ?
+					-ENOTDIR : -EISDIR;
 			goto out;
 		}
 
@@@@ -461,16 +426,14 @@@@ int unionfs_rename(struct inode *old_dir
 	err = do_unionfs_rename(old_dir, old_dentry, new_dir, new_dentry);
 
 out:
-
-	if (err) {
+	if (err)
 		/* clear the new_dentry stuff created */
 		d_drop(new_dentry);
-	} else {
+	else
a2953 1
-	}
d2955 1
a2957 1
 	unlock_dentry(old_dentry);
d2960 1
a2960 1
+++ b/fs/unionfs/subr.c	Sun Dec 03 03:22:06 2006 -0500
d2970 1
a2970 44
@@@@ -55,16 +55,14 @@@@ int create_whiteout(struct dentry *dentr
 			hidden_dentry = create_parents(dentry->d_inode,
 						       dentry, bindex);
 			if (!hidden_dentry || IS_ERR(hidden_dentry)) {
-				printk(KERN_DEBUG
-				       "create_parents failed for bindex = %d\n",
-				       bindex);
+				printk(KERN_DEBUG "create_parents failed for "
+						"bindex = %d\n", bindex);
 				continue;
 			}
 		}
 
-		hidden_wh_dentry =
-		    lookup_one_len(name, hidden_dentry->d_parent,
-				   dentry->d_name.len + UNIONFS_WHLEN);
+		hidden_wh_dentry = lookup_one_len(name, hidden_dentry->d_parent,
+					dentry->d_name.len + UNIONFS_WHLEN);
 		if (IS_ERR(hidden_wh_dentry))
 			continue;
 
@@@@ -78,8 +76,7 @@@@ int create_whiteout(struct dentry *dentr
 
 		hidden_dir_dentry = lock_parent(hidden_wh_dentry);
 		if (!(err = is_robranch_super(dentry->d_sb, bindex))) {
-			err =
-			    vfs_create(hidden_dir_dentry->d_inode,
+			err = vfs_create(hidden_dir_dentry->d_inode,
 				       hidden_wh_dentry,
 				       ~current->fs->umask & S_IRWXUGO, NULL);
 
@@@@ -87,10 +84,7 @@@@ int create_whiteout(struct dentry *dentr
 		unlock_dir(hidden_dir_dentry);
 		dput(hidden_wh_dentry);
 
-		if (!err)
-			break;
-
-		if (!IS_COPYUP_ERR(err))
+		if (!err || !IS_COPYUP_ERR(err))
 			break;
 	}
 
@@@@ -114,31 +108,28 @@@@ int unionfs_refresh_hidden_dentry(struct
d2979 1
a2979 8
 
-	hidden_dentry =
-	    lookup_one_len(dentry->d_name.name, hidden_parent,
-			   dentry->d_name.len);
+	hidden_dentry = lookup_one_len(dentry->d_name.name, hidden_parent,
+				dentry->d_name.len);
 	if (IS_ERR(hidden_dentry)) {
 		err = PTR_ERR(hidden_dentry);
d3005 1
a3005 1
@@@@ -152,10 +143,10 @@@@ int make_dir_opaque(struct dentry *dentr
d3012 2
a3013 7
-	BUG_ON(!S_ISDIR(dentry->d_inode->i_mode)
-	       || !S_ISDIR(hidden_dir->i_mode));
+	BUG_ON(!S_ISDIR(dentry->d_inode->i_mode) ||
+	       !S_ISDIR(hidden_dir->i_mode));
 
 	mutex_lock(&hidden_dir->i_mutex);
 	diropq = lookup_one_len(UNIONFS_DIR_OPAQUE, hidden_dentry,
d3016 1
a3016 1
+++ b/fs/unionfs/super.c	Sun Dec 03 03:24:38 2006 -0500
d3058 1
a3058 1
@@@@ -96,25 +97,20 @@@@ static void unionfs_put_super(struct sup
d3067 4
a3070 5
 	bstart = sbstart(sb);
 	bend = sbend(sb);
-#if 0
-	/* this shouldn't be needed */
-	for (bindex = bstart; bindex <= bend; bindex++)
d3072 2
a3073 1
-#endif
d3087 1
a3087 1
@@@@ -127,7 +123,7 @@@@ static int unionfs_statfs(struct dentry 
d3096 1
a3096 1
@@@@ -161,9 +157,9 @@@@ static void unionfs_clear_inode(struct i
d3109 1
a3109 1
@@@@ -173,44 +169,45 @@@@ static void unionfs_clear_inode(struct i
a3154 2
-}
-
d3156 2
a3157 3
+}
+
+/* unionfs inode cache constructor */
d3170 1
a3170 1
@@@@ -219,7 +216,7 @@@@ int init_inode_cache(void)
d3179 1
a3179 1
@@@@ -240,17 +237,17 @@@@ static int unionfs_write_inode(struct in
d3204 1
a3204 23
@@@@ -258,10 +255,6 @@@@ static int unionfs_write_inode(struct in
 /*
  * Used only in nfs, to kill any pending RPC tasks, so that subsequent
  * code can actually succeed and won't leave tasks that need handling.
- *
- * PS. I wonder if this is somehow useful to undo damage that was
- * left in the kernel after a user level file server (such as amd)
- * dies.
  */
 static void unionfs_umount_begin(struct vfsmount *mnt, int flags)
 {
@@@@ -270,8 +263,8 @@@@ static void unionfs_umount_begin(struct 
 	int bindex, bstart, bend;
 
 	if (!(flags & MNT_FORCE))
-		/* we are not being MNT_FORCEd, therefore we should emulate old
-		 * behaviour
+		/* we are not being MNT_FORCEd, therefore we should emulate
+		 * old behaviour
 		 */
 		return;
 
@@@@ -280,8 +273,8 @@@@ static void unionfs_umount_begin(struct 
d3215 1
a3215 1
@@@@ -311,8 +304,8 @@@@ static int unionfs_show_options(struct s
d3514 2
a3515 10
+++ b/fs/unionfs/unlink.c	Sun Dec 03 03:31:47 2006 -0500
@@@@ -18,6 +18,7 @@@@
 
 #include "union.h"
 
+/* unlink a file by creating a whiteout */
 static int unionfs_unlink_whiteout(struct inode *dir, struct dentry *dentry)
 {
 	struct dentry *hidden_dentry;
@@@@ -30,7 +31,7 @@@@ static int unionfs_unlink_whiteout(struc
d3524 1
a3524 6
@@@@ -93,19 +94,17 @@@@ static int unionfs_rmdir_first(struct in
 
 	/* Here we need to remove whiteout entries. */
 	err = delete_whiteouts(dentry, dbstart(dentry), namelist);
-	if (err) {
+	if (err)
d3526 1
a3526 1
-	}
a3532 51
 	/* avoid destroying the hidden inode if the file is in use */
 	dget(hidden_dentry);
-	if (!(err = is_robranch(dentry))) {
+	if (!(err = is_robranch(dentry)))
 		err = vfs_rmdir(hidden_dir_dentry->d_inode, hidden_dentry);
-	}
 	dput(hidden_dentry);
 
 	fsstack_copy_attr_times(dir, hidden_dir_dentry->d_inode);
@@@@ -113,9 +112,8 @@@@ static int unionfs_rmdir_first(struct in
 	dentry->d_inode->i_nlink = unionfs_get_nlinks(dentry->d_inode);
 
 out:
-	if (hidden_dir_dentry) {
+	if (hidden_dir_dentry)
 		unlock_dir(hidden_dir_dentry);
-	}
 	return err;
 }
 
@@@@ -128,27 +126,14 @@@@ int unionfs_rmdir(struct inode *dir, str
 
 	/* check if this unionfs directory is empty or not */
 	err = check_empty(dentry, &namelist);
-	if (err) {
-#if 0
-		/* vfs_rmdir(our caller) unhashed the dentry.  This will recover
-		 * the Unionfs inode number for the directory itself, but the
-		 * children are already lost.  It seems that tmpfs manages its
-		 * way around this by upping the refcount on everything.
-		 *
-		 * Even if we do this, we still lose the inode numbers of the
-		 * children.  The best way to fix this is to fix the VFS (or
-		 * use persistent inode maps). */
-		if (d_unhashed(dentry))
-			d_rehash(dentry);
-#endif
+	if (err)
 		goto out;
-	}
 
 	err = unionfs_rmdir_first(dir, dentry, namelist);
 	/* create whiteout */
-	if (!err) {
+	if (!err)
 		err = create_whiteout(dentry, dbstart(dentry));
-	} else {
+	else {
 		int new_err;
 
 		if (dbstart(dentry) == 0)
@


1.1.2.11
log
@Collapsed macro patch into unionfs proper
@
text
@@


