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


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

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

1.1.2.2
date	2006.10.29.06.07.55;	author jsipek;	state dead;
branches;
next	;


desc
@@


1.1
log
@file fsstack-structs-unionfs-deep was initially added on branch LKML-branch.
@
text
@@


1.1.2.1
log
@Replace most wrapper macros with calls to __fsstack_*
@
text
@a0 939
diff -r 1a552cb81b79 fs/unionfs/commonfops.c
--- a/fs/unionfs/commonfops.c	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/commonfops.c	Wed Oct 25 03:54:32 2006 -0400
@@@@ -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 = __fsstack_lower_dentry(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 = __fsstack_lower_dentry(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);
@@@@ -82,9 +82,9 @@@@ static void cleanup_file(struct file *fi
 	bstart = fbstart(file);
 	bend = fbend(file);
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		if (ftohf_index(file, bindex)) {
+		if (__fsstack_lower_file(file, bindex)) {
 			branchput(dentry->d_sb, bindex);
-			fput(ftohf_index(file, bindex));
+			fput(__fsstack_lower_file(file, bindex));
 		}
 	}
 
@@@@ -105,21 +105,21 @@@@ 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 = __fsstack_lower_dentry(dentry, bindex);
 		if (!hidden_dentry)
 			continue;
 
 		dget(hidden_dentry);
-		mntget(dtohm_index(dentry, bindex));
+		mntget(__fsstack_lower_mnt(dentry, bindex));
 		branchget(sb, bindex);
 
 		hidden_file = dentry_open(hidden_dentry,
-				dtohm_index(dentry, bindex), file->f_flags);
+				__fsstack_lower_mnt(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);
+			__fsstack_set_lower_file(file, bindex, hidden_file);
 	}
 out:
 	return err;
@@@@ -154,10 +154,10 @@@@ static int open_highest_file(struct file
 	}
 
 	dget(hidden_dentry);
-	mntget(dtohm_index(dentry, bstart));
+	mntget(__fsstack_lower_mnt(dentry, bstart));
 	branchget(sb, bstart);
 	hidden_file = dentry_open(hidden_dentry,
-			dtohm_index(dentry, bstart), file->f_flags);
+			__fsstack_lower_mnt(dentry, bstart), file->f_flags);
 	if (IS_ERR(hidden_file)) {
 		err = PTR_ERR(hidden_file);
 		goto out;
@@@@ -196,10 +196,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 (__fsstack_lower_file(file, bindex)) {
 				branchput(dentry->d_sb, bindex);
-				fput(ftohf_index(file, bindex));
-				set_ftohf_index(file, bindex, NULL);
+				fput(__fsstack_lower_file(file, bindex));
+				__fsstack_set_lower_file(file, bindex, NULL);
 			}
 		}
 		fbend(file) = bend;
@@@@ -293,19 +293,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 = __fsstack_lower_dentry(file->f_dentry, bindex);
 		if (!hidden_dentry)
 			continue;
 
 		dget(hidden_dentry);
-		mntget(dtohm_index(file->f_dentry, bindex));
+		mntget(__fsstack_lower_mnt(file->f_dentry, bindex));
 		hidden_file = dentry_open(hidden_dentry,
-					dtohm_index(file->f_dentry, bindex),
+					__fsstack_lower_mnt(file->f_dentry, bindex),
 					file->f_flags);
 		if (IS_ERR(hidden_file))
 			return PTR_ERR(hidden_file);
 
-		set_ftohf_index(file, bindex, hidden_file);
+		__fsstack_set_lower_file(file, bindex, hidden_file);
 
 		/* The branchget goes after the open, because otherwise
 		 * we would miss the reference on release. */
@@@@ -355,9 +355,9 @@@@ 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(__fsstack_lower_mnt(file->f_dentry, bstart));
 	hidden_file = dentry_open(hidden_dentry,
-				  dtohm_index(file->f_dentry, bstart),
+				  __fsstack_lower_mnt(file->f_dentry, bstart),
 				  hidden_flags);
 	if (IS_ERR(hidden_file))
 		return PTR_ERR(hidden_file);
@@@@ -412,7 +412,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 = __fsstack_lower_file(file, bindex);
 			if (!hidden_file)
 				continue;
 
@@@@ -446,7 +446,7 @@@@ int unionfs_file_release(struct inode *i
 	bend = fbend(file);
 
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_file = ftohf_index(file, bindex);
+		hidden_file = __fsstack_lower_file(file, bindex);
 
 		if (hidden_file) {
 			fput(hidden_file);
@@@@ -548,7 +548,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 = __fsstack_lower_file(file, bindex);
 
 		if (hidden_file && hidden_file->f_op
 		    && hidden_file->f_op->flush) {
@@@@ -558,8 +558,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(__fsstack_lower_dentry(file->f_dentry, bindex));
+				__fsstack_set_lower_dentry(file->f_dentry, bindex, NULL);
 			}
 		}
 
diff -r 1a552cb81b79 fs/unionfs/copyup.c
--- a/fs/unionfs/copyup.c	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/copyup.c	Wed Oct 25 03:54:32 2006 -0400
@@@@ -198,10 +198,10 @@@@ static inline int __copyup_reg_data(stru
 	int err = 0;
 
 	/* open old file */
-	mntget(dtohm_index(dentry, old_bindex));
+	mntget(__fsstack_lower_mnt(dentry, old_bindex));
 	branchget(sb, old_bindex);
 	input_file = dentry_open(old_hidden_dentry,
-			dtohm_index(dentry, old_bindex), O_RDONLY | O_LARGEFILE);
+			__fsstack_lower_mnt(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(__fsstack_lower_mnt(dentry, new_bindex));
 	branchget(sb, new_bindex);
 	output_file = dentry_open(new_hidden_dentry,
-			dtohm_index(dentry, new_bindex), O_WRONLY | O_LARGEFILE);
+			__fsstack_lower_mnt(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);
+	__fsstack_set_lower_dentry(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 = __fsstack_lower_dentry(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);
+		__fsstack_set_lower_file(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);
+		__fsstack_set_lower_file(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 (!__fsstack_lower_dentry(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 (!__fsstack_lower_dentry(dentry, i)->d_inode) {
+			dput(__fsstack_lower_dentry(dentry, i));
+			__fsstack_set_lower_dentry(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,
+	__fsstack_set_lower_inode(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);
+	__fsstack_set_lower_dentry(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 = __fsstack_lower_dentry(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 = __fsstack_lower_dentry(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(__fsstack_lower_dentry(dentry, bindex));
+			__fsstack_set_lower_dentry(dentry, bindex, hidden_dentry);
 
 			__cleanup_dentry(dentry, bindex, old_bstart, old_bend);
 			break;
diff -r 1a552cb81b79 fs/unionfs/dentry.c
--- a/fs/unionfs/dentry.c	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/dentry.c	Wed Oct 25 03:54:32 2006 -0400
@@@@ -98,7 +98,7 @@@@ restart:
 			struct dentry *hidden_dentry;
 			for (bindex = bstart; bindex <= bend; bindex++) {
 				hidden_dentry =
-				    dtohd_index_nocheck(dentry, bindex);
+				    __fsstack_lower_dentry(dentry, bindex);
 				if (!hidden_dentry)
 					continue;
 				dput(hidden_dentry);
@@@@ -117,7 +117,7 @@@@ restart:
 				struct inode *hidden_inode;
 				for (bindex = bstart; bindex <= bend; bindex++) {
 					hidden_inode =
-					    itohi_index(dentry->d_inode,
+					    __fsstack_lower_inode(dentry->d_inode,
 							bindex);
 					if (!hidden_inode)
 						continue;
@@@@ -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 = __fsstack_lower_dentry(dentry, bindex);
 		if (!hidden_dentry || !hidden_dentry->d_op
 		    || !hidden_dentry->d_op->d_revalidate)
 			continue;
@@@@ -216,11 +216,11 @@@@ 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(__fsstack_lower_dentry(dentry, bindex));
+		mntput(__fsstack_lower_mnt(dentry, bindex));
+
+		__fsstack_set_lower_dentry(dentry, bindex, NULL);
+		__fsstack_set_lower_mnt(dentry, bindex, NULL);
 	}
 	/* free private data (unionfs_dentry_info) here */
 	kfree(dtohp_ptr(dentry));
diff -r 1a552cb81b79 fs/unionfs/dirfops.c
--- a/fs/unionfs/dirfops.c	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/dirfops.c	Wed Oct 25 03:54:32 2006 -0400
@@@@ -117,7 +117,7 @@@@ static int unionfs_readdir(struct file *
 	bend = fbend(file);
 
 	while (uds->uds_bindex <= bend) {
-		hidden_file = ftohf_index(file, uds->uds_bindex);
+		hidden_file = __fsstack_lower_file(file, uds->uds_bindex);
 		if (!hidden_file) {
 			uds->uds_bindex++;
 			uds->uds_dirpos = 0;
diff -r 1a552cb81b79 fs/unionfs/fanout.h
--- a/fs/unionfs/fanout.h	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/fanout.h	Wed Oct 25 03:55:23 2006 -0400
@@@@ -47,26 +47,17 @@@@ static inline struct unionfs_inode_info 
 /* File to hidden file. */
 /* FIXME: temporary */
 #define ftohf(f)		__fsstack_lower_file((f), fbstart(f))
-#define ftohf_index(f,i)	__fsstack_lower_file((f), (i))
 #define set_ftohf(f,lf)		__fsstack_set_lower_file((f), fbstart(f), (lf))
-#define set_ftohf_index(f,idx,lf) \
-				__fsstack_set_lower_file((f), (idx), (lf))
 
 /* Inode to hidden inode. */
 /* FIXME: temporary */
 #define itohi(i)		__fsstack_lower_inode((i), ibstart(i))
-#define itohi_index(i, idx)	__fsstack_lower_inode((i), (idx))
 #define set_itohi(i, li)	__fsstack_set_lower_inode((i), ibstart(i), (li))
-#define set_itohi_index(i, idx, li) \
-				__fsstack_set_lower_inode((i), (idx), (li))
 
 /* Superblock to hidden superblock. */
 /* FIXME: temporary */
 #define stohs(s)		__fsstack_lower_sb((sb), sbstart(sb))
-#define stohs_index(s,idx)	__fsstack_lower_sb((sb), (idx))
 #define set_stohs(s, ls)	__fsstack_set_lower_sb((sb), sbstart(sb), (ls))
-#define set_stohs_index(s, idx, ls) \
-				__fsstack_set_lower_sb((sb), (idx), (ls))
 
 /* Branch count macros. */
 static inline int branch_count(struct super_block *o, int index)
@@@@ -106,17 +97,9 @@@@ static inline struct unionfs_dentry_info
 
 /* FIXME: temporary */
 #define dtohd(d)		__fsstack_lower_dentry((d), dbstart(d))
-#define dtohd_index(d,idx)	__fsstack_lower_dentry((d), (idx))
-#define dtohd_index_nocheck(dent, index) dtohd_index(dent, index)
-#define set_dtohd_index(d, idx, ld) \
-				__fsstack_set_lower_dentry((d), (idx), (ld))
-#define set_dtohd_index_nocheck(dent, index, val) set_dtohd_index(dent, index, val)
 
 /* FIXME: temporary */
 #define dtohm(d)		__fsstack_lower_mnt((d), dbstart(d))
-#define dtohm_index(d,idx)	__fsstack_lower_mnt((d), (idx))
-#define set_dtohm_index(d,idx,lm) \
-				__fsstack_set_lower_mnt((d), (idx), (lm))
 
 /* FIXME: temporary */
 #define dtohp_ptr(dent) (dtopd(dent)->udi_path)
diff -r 1a552cb81b79 fs/unionfs/inode.c
--- a/fs/unionfs/inode.c	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/inode.c	Wed Oct 25 03:54:32 2006 -0400
@@@@ -133,7 +133,7 @@@@ static int unionfs_create(struct inode *
 			dput(dtohd(dentry));
 
 			/* Trade one reference to another. */
-			set_dtohd_index(dentry, bstart, whiteout_dentry);
+			__fsstack_set_lower_dentry(dentry, bstart, whiteout_dentry);
 			whiteout_dentry = NULL;
 
 			err = unionfs_interpose(dentry, parent->i_sb, 0);
@@@@ -142,7 +142,7 @@@@ static int unionfs_create(struct inode *
 	}
 
 	for (bindex = bstart; bindex >= 0; bindex--) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = __fsstack_lower_dentry(dentry, bindex);
 		if (!hidden_dentry) {
 			/* if hidden_dentry is NULL, create the entire
 			 * dentry directory structure in branch 'bindex'.
@@@@ -399,7 +399,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 = __fsstack_lower_dentry(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
@@@@ -519,7 +519,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 = __fsstack_lower_dentry(dentry, bindex);
 		if (!hidden_dentry) {
 			hidden_dentry = create_parents(parent, dentry, bindex);
 			if (!hidden_dentry || IS_ERR(hidden_dentry)) {
@@@@ -546,9 +546,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 (__fsstack_lower_dentry(dentry, i)) {
+				dput(__fsstack_lower_dentry(dentry, i));
+				__fsstack_set_lower_dentry(dentry, i, NULL);
 			}
 		}
 		set_dbend(dentry, bindex);
@@@@ -643,7 +643,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 = __fsstack_lower_dentry(dentry, bindex);
 		if (!hidden_dentry) {
 			hidden_dentry = create_parents(dir, dentry, bindex);
 			if (IS_ERR(hidden_dentry)) {
@@@@ -818,7 +818,7 @@@@ static int unionfs_permission(struct ino
 	bend = ibend(inode);
 
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_inode = itohi_index(inode, bindex);
+		hidden_inode = __fsstack_lower_inode(inode, bindex);
 		if (!hidden_inode)
 			continue;
 
@@@@ -866,7 +866,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 = __fsstack_lower_dentry(dentry, bindex);
 		if (!hidden_dentry)
 			continue;
 		BUG_ON(hidden_dentry->d_inode == NULL);
diff -r 1a552cb81b79 fs/unionfs/main.c
--- a/fs/unionfs/main.c	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/main.c	Wed Oct 25 03:54:32 2006 -0400
@@@@ -42,8 +42,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 (__fsstack_lower_dentry(dentry, bindex) &&
+		    __fsstack_lower_dentry(dentry, bindex)->d_inode) {
 			is_negative_dentry = 0;
 			break;
 		}
@@@@ -88,9 +88,9 @@@@ int unionfs_interpose(struct dentry *den
 	}
 
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = __fsstack_lower_dentry(dentry, bindex);
 		if (!hidden_dentry) {
-			set_itohi_index(inode, bindex, NULL);
+			__fsstack_set_lower_inode(inode, bindex, NULL);
 			continue;
 		}
 
@@@@ -98,7 +98,7 @@@@ int unionfs_interpose(struct dentry *den
 		if (!hidden_dentry->d_inode)
 			continue;
 
-		set_itohi_index(inode, bindex, igrab(hidden_dentry->d_inode));
+		__fsstack_set_lower_inode(inode, bindex, igrab(hidden_dentry->d_inode));
 	}
 
 	ibstart(inode) = dbstart(dentry);
@@@@ -167,15 +167,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 = __fsstack_lower_dentry(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 (__fsstack_lower_inode(inode, bindex))
+			continue;
+		__fsstack_set_lower_inode(inode, bindex, igrab(hidden_dentry->d_inode));
 	}
 	ibstart(inode) = dbstart(dentry);
 	ibend(inode) = dbend(dentry);
@@@@ -534,11 +534,11 @@@@ static int unionfs_read_super(struct sup
 
 		d = hidden_root_info->udi_path[bindex].dentry;
 
-		set_stohs_index(sb, bindex, d->d_sb);
+		__fsstack_set_lower_sb(sb, bindex, d->d_sb);
 	}
 
 	/* Unionfs: Max Bytes is the maximum bytes from highest priority branch */
-	sb->s_maxbytes = stohs_index(sb, 0)->s_maxbytes;
+	sb->s_maxbytes = __fsstack_lower_sb(sb, 0)->s_maxbytes;
 
 	sb->s_op = &unionfs_sops;
 
@@@@ -566,8 +566,8 @@@@ static int unionfs_read_super(struct sup
 		d = hidden_root_info->udi_path[bindex].dentry;
 		m = hidden_root_info->udi_path[bindex].mnt;
 
-		set_dtohd_index(sb->s_root, bindex, d);
-		set_dtohm_index(sb->s_root, bindex, m);
+		__fsstack_set_lower_dentry(sb->s_root, bindex, d);
+		__fsstack_set_lower_mnt(sb->s_root, bindex, m);
 	}
 	set_dbstart(sb->s_root, bstart);
 	set_dbend(sb->s_root, bend);
diff -r 1a552cb81b79 fs/unionfs/rdstate.c
--- a/fs/unionfs/rdstate.c	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/rdstate.c	Wed Oct 25 03:54:32 2006 -0400
@@@@ -67,7 +67,7 @@@@ static int guesstimate_hash_size(struct 
 		return itopd(inode)->uii_hashsize;
 
 	for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {
-		if (!(hidden_inode = itohi_index(inode, bindex)))
+		if (!(hidden_inode = __fsstack_lower_inode(inode, bindex)))
 			continue;
 
 		if (hidden_inode->i_size == DENTPAGE) {
diff -r 1a552cb81b79 fs/unionfs/subr.c
--- a/fs/unionfs/subr.c	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/subr.c	Wed Oct 25 03:54:32 2006 -0400
@@@@ -44,7 +44,7 @@@@ int create_whiteout(struct dentry *dentr
 	}
 
 	for (bindex = start; bindex >= 0; bindex--) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = __fsstack_lower_dentry(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 = __fsstack_lower_dentry(dentry->d_parent, bindex);
 	unlock_dentry(dentry->d_parent);
 
 	BUG_ON(!S_ISDIR(hidden_parent->d_inode->i_mode));
@@@@ -127,18 +127,18 @@@@ 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);
+	if (__fsstack_lower_dentry(dentry, bindex))
+		dput(__fsstack_lower_dentry(dentry, bindex));
+	if (__fsstack_lower_inode(dentry->d_inode, bindex)) {
+		iput(__fsstack_lower_inode(dentry->d_inode, bindex));
+		__fsstack_set_lower_inode(dentry->d_inode, bindex, NULL);
 	}
 	if (!hidden_dentry->d_inode) {
 		dput(hidden_dentry);
-		set_dtohd_index(dentry, bindex, NULL);
+		__fsstack_set_lower_dentry(dentry, bindex, NULL);
 	} else {
-		set_dtohd_index(dentry, bindex, hidden_dentry);
-		set_itohi_index(dentry->d_inode, bindex,
+		__fsstack_set_lower_dentry(dentry, bindex, hidden_dentry);
+		__fsstack_set_lower_inode(dentry->d_inode, bindex,
 				igrab(hidden_dentry->d_inode));
 	}
 
@@@@ -152,7 +152,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 = __fsstack_lower_dentry(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 1a552cb81b79 fs/unionfs/super.c
--- a/fs/unionfs/super.c	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/super.c	Wed Oct 25 03:54:32 2006 -0400
@@@@ -127,7 +127,7 @@@@ static int unionfs_statfs(struct dentry 
 
 	sb = dentry->d_sb;
 
-	hidden_sb = stohs_index(sb, sbstart(sb));
+	hidden_sb = __fsstack_lower_sb(sb, sbstart(sb));
 	err = vfs_statfs(hidden_sb->s_root, buf);
 
 	buf->f_type = UNIONFS_SUPER_MAGIC;
@@@@ -173,7 +173,7 @@@@ 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 = __fsstack_lower_inode(inode, bindex);
 			if (!hidden_inode)
 				continue;
 			iput(hidden_inode);
@@@@ -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 = __fsstack_lower_mnt(sb->s_root, bindex);
+		hidden_sb = __fsstack_lower_sb(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(__fsstack_lower_dentry(sb->s_root, bindex),
+			   __fsstack_lower_mnt(sb->s_root, bindex), tmp_page,
 			   PAGE_SIZE);
 		perms = branchperms(sb, bindex);
 
diff -r 1a552cb81b79 fs/unionfs/union.h
--- a/fs/unionfs/union.h	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/union.h	Wed Oct 25 03:54:32 2006 -0400
@@@@ -354,7 +354,7 @@@@ static inline int unionfs_get_nlinks(str
 		return itohi(inode)->i_nlink;
 
 	for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {
-		hidden_inode = itohi_index(inode, bindex);
+		hidden_inode = __fsstack_lower_inode(inode, bindex);
 		if (!hidden_inode || !S_ISDIR(hidden_inode->i_mode))
 			continue;
 		BUG_ON(hidden_inode->i_nlink < 0);
@@@@ -434,7 +434,7 @@@@ static inline int __is_robranch_index(st
 	perms = stopd(dentry->d_sb)->usi_data[index].branchperms;
 
 	if ((!(perms & MAY_WRITE))
-	    || (IS_RDONLY(dtohd_index(dentry, index)->d_inode)))
+	    || (IS_RDONLY(__fsstack_lower_dentry(dentry, index)->d_inode)))
 		err = -EROFS;
 
 	return err;
diff -r 1a552cb81b79 fs/unionfs/branchman.c
--- a/fs/unionfs/branchman.c	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/branchman.c	Wed Oct 25 03:54:32 2006 -0400
@@@@ -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 = __fsstack_lower_dentry(dentry, bindex);
 		if (!hidden_dentry)
 			continue;
 		if (hidden_dentry->d_inode)
diff -r 1a552cb81b79 fs/unionfs/dirhelper.c
--- a/fs/unionfs/dirhelper.c	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/dirhelper.c	Wed Oct 25 03:54:32 2006 -0400
@@@@ -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 = __fsstack_lower_dentry(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));
@@@@ -101,7 +101,7 @@@@ int delete_whiteouts(struct dentry *dent
 	if (err)
 		goto out;
 
-	hidden_dir_dentry = dtohd_index(dentry, bindex);
+	hidden_dir_dentry = __fsstack_lower_dentry(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));
@@@@ -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 = __fsstack_lower_dentry(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(__fsstack_lower_mnt(dentry, bindex));
 		branchget(sb, bindex);
 		hidden_file =
-		    dentry_open(hidden_dentry, dtohm_index(dentry, bindex),
+		    dentry_open(hidden_dentry, __fsstack_lower_mnt(dentry, bindex),
 				O_RDONLY);
 		if (IS_ERR(hidden_file)) {
 			err = PTR_ERR(hidden_file);
diff -r 1a552cb81b79 fs/unionfs/lookup.c
--- a/fs/unionfs/lookup.c	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/lookup.c	Wed Oct 25 03:54:32 2006 -0400
@@@@ -93,12 +93,12 @@@@ struct dentry *unionfs_lookup_backend(st
 	}
 
 	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_dentry = dtohd_index(dentry, bindex);
+		hidden_dentry = __fsstack_lower_dentry(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 = __fsstack_lower_dentry(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 = __fsstack_lower_dentry(dentry, bindex);
 		/* FIXME: fix following line for mount point crossing */
-		nd->mnt = dtohm_index(parent_dentry, bindex);
+		nd->mnt = __fsstack_lower_mnt(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(__fsstack_lower_mnt(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);
+		__fsstack_set_lower_dentry(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)));
+		__fsstack_set_lower_mnt(dentry, bindex, mntget(__fsstack_lower_mnt(parent_dentry, bindex)));
 		set_dbend(dentry, bindex);
 
 		/* update parent directory's atime with the bindex */
@@@@ -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 = __fsstack_lower_mnt(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(__fsstack_lower_mnt(dentry, bindex));
+	}
+	__fsstack_set_lower_dentry(dentry, first_dentry_offset, first_hidden_dentry);
+	__fsstack_set_lower_mnt(dentry, first_dentry_offset, first_hidden_mnt);
 	set_dbstart(dentry, first_dentry_offset);
 	set_dbend(dentry, first_dentry_offset);
 
@@@@ -302,8 +302,8 @@@@ out_free:
 	if (bstart >= 0) {
 		bend = dbend(dentry);
 		for (bindex = bstart; bindex <= bend; bindex++) {
-			dput(dtohd_index(dentry, bindex));
-			mntput(dtohm_index(dentry, bindex));
+			dput(__fsstack_lower_dentry(dentry, bindex));
+			mntput(__fsstack_lower_mnt(dentry, bindex));
 		}
 	}
 	kfree(dtohp_ptr(dentry));
@@@@ -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 = __fsstack_lower_dentry(dentry, bindex);
 	hidden_inode = hidden_dentry->d_inode;
 
 	BUG_ON(!S_ISDIR(hidden_inode->i_mode));
@@@@ -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 = __fsstack_lower_dentry(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);
-	}
-}
-
+		__fsstack_set_lower_dentry(dentry, bindex, NULL);
+	}
+}
+
diff -r 1a552cb81b79 fs/unionfs/rename.c
--- a/fs/unionfs/rename.c	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/rename.c	Wed Oct 25 03:54:32 2006 -0400
@@@@ -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 = __fsstack_lower_dentry(new_dentry, bindex);
+	hidden_old_dentry = __fsstack_lower_dentry(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 = __fsstack_lower_dentry(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);
+				__fsstack_set_lower_dentry(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 (!__fsstack_lower_dentry(new_dentry, bindex)
+	    || !__fsstack_lower_dentry(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 (__fsstack_lower_dentry(old_dentry, bindex)
+	    && __fsstack_lower_dentry(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 = __fsstack_lower_dentry(parent, bindex);
 		if (!hidden_parent)
 			continue;
 		wh_dentry =
diff -r 1a552cb81b79 fs/unionfs/unlink.c
--- a/fs/unionfs/unlink.c	Wed Oct 25 03:00:41 2006 -0400
+++ b/fs/unionfs/unlink.c	Wed Oct 25 03:54:32 2006 -0400
@@@@ -30,7 +30,7 @@@@ static int unionfs_unlink_whiteout(struc
 
 	bindex = dbstart(dentry);
 
-	hidden_dentry = dtohd_index(dentry, bindex);
+	hidden_dentry = __fsstack_lower_dentry(dentry, bindex);
 	if (!hidden_dentry)
 		goto out;
 
@


1.1.2.2
log
@Collapse several unionfs patches into one
@
text
@@


