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


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

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

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

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

1.1.2.4
date	2007.01.28.19.24.33;	author jsipek;	state dead;
branches;
next	;


desc
@@


1.1
log
@file bunk-fixes was initially added on branch LKML-branch.
@
text
@@


1.1.2.1
log
@A. Bunk's patch, more akpm comments, new copyright
@
text
@a0 453
fs/unionfs/: possible cleanups

From: Adrian Bunk <bunk@@stusta.de>

This patch contains the following possible cleanups:
- every function should #include the headers containing the prototypes
  of it's global functions
- static functions in C files shouldn't be marked "inline", gcc should 
  know best when to inline them
- make needlessly global code static
- #if 0 the following unused global function:
  - stale_inode.c: is_stale_inode()

Signed-off-by: Adrian Bunk <bunk@@stusta.de>

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 6685bf7..76b2ed9 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@@@ -292,7 +292,7 @@@@ out:
 }
 
 /* unionfs_open helper function: open a directory */
-static inline int __open_dir(struct inode *inode, struct file *file)
+static int __open_dir(struct inode *inode, struct file *file)
 {
 	struct dentry *hidden_dentry;
 	struct file *hidden_file;
@@@@ -326,7 +326,7 @@@@ static inline int __open_dir(struct inode *inode, struct file *file)
 }
 
 /* unionfs_open helper function: open a file */
-static inline int __open_file(struct inode *inode, struct file *file)
+static int __open_file(struct inode *inode, struct file *file)
 {
 	struct dentry *hidden_dentry;
 	struct file *hidden_file;
@@@@ -493,7 +493,7 @@@@ int unionfs_file_release(struct inode *inode, struct file *file)
 }
 
 /* pass the ioctl to the lower fs */
-static inline long do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+static long do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
 	struct file *hidden_file;
 	int err;
diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c
index 1d59ff3..15296d4 100644
--- a/fs/unionfs/copyup.c
+++ b/fs/unionfs/copyup.c
@@@@ -18,6 +18,14 @@@@
 
 #include "union.h"
 
+static 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);
+static struct dentry *create_parents_named(struct inode *dir,
+					   struct dentry *dentry,
+					   const char *name, int bindex);
+
 #ifdef CONFIG_UNION_FS_XATTR
 /* copyup all extended attrs for a given dentry */
 static int copyup_xattrs(struct dentry *old_hidden_dentry,
@@@@ -129,10 +137,10 @@@@ int copyup_dentry(struct inode *dir, struct dentry *dentry,
  * if the object being copied up is a regular file, the file is only created,
  * the contents have to be copied up separately
  */
-static inline int __copyup_ndentry(struct dentry *old_hidden_dentry,
-				   struct dentry *new_hidden_dentry,
-				   struct dentry *new_hidden_parent_dentry,
-				   char *symbuf)
+static int __copyup_ndentry(struct dentry *old_hidden_dentry,
+			    struct dentry *new_hidden_dentry,
+			    struct dentry *new_hidden_parent_dentry,
+			    char *symbuf)
 {
 	int err = 0;
 	umode_t old_mode = old_hidden_dentry->d_inode->i_mode;
@@@@ -179,13 +187,10 @@@@ static inline int __copyup_ndentry(struct dentry *old_hidden_dentry,
 	return err;
 }
 
-static inline int __copyup_reg_data(struct dentry *dentry,
-				    struct dentry *new_hidden_dentry,
-				    int new_bindex,
-				    struct dentry *old_hidden_dentry,
-				    int old_bindex,
-				    struct file **copyup_file,
-				    loff_t len)
+static int __copyup_reg_data(struct dentry *dentry,
+			     struct dentry *new_hidden_dentry, int new_bindex,
+			     struct dentry *old_hidden_dentry, int old_bindex,
+			     struct file **copyup_file, loff_t len)
 {
 	struct super_block *sb = dentry->d_sb;
 	struct file *input_file;
@@@@ -300,11 +305,9 @@@@ out:
 /* 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,
-			   struct dentry *new_hidden_dentry,
-			   int new_bindex)
+static void __clear(struct dentry *dentry, struct dentry *old_hidden_dentry,
+		    int old_bstart, int old_bend,
+		    struct dentry *new_hidden_dentry, int new_bindex)
 {
 	/* get rid of the hidden dentry and all its traces */
 	unionfs_set_lower_dentry_idx(dentry, new_bindex, NULL);
@@@@ -316,9 +319,10 @@@@ static inline void __clear(struct dentry *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)
+static 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)
 {
 	struct dentry *new_hidden_dentry;
 	struct dentry *old_hidden_dentry = NULL;
@@@@ -510,8 +514,8 @@@@ struct dentry *create_parents(struct inode *dir, struct dentry *dentry,
 	return create_parents_named(dir, dentry, dentry->d_name.name, bindex);
 }
 
-static inline void __cleanup_dentry(struct dentry * dentry, int bindex,
-					int old_bstart, int old_bend)
+static void __cleanup_dentry(struct dentry * dentry, int bindex,
+			     int old_bstart, int old_bend)
 {
 	int loop_start;
 	int loop_end;
@@@@ -557,8 +561,8 @@@@ static inline void __cleanup_dentry(struct dentry * dentry, int bindex,
 }
 
 /* set lower inode ptr and update bstart & bend if necessary */
-static inline void __set_inode(struct dentry * upper, struct dentry * lower,
-				int bindex)
+static void __set_inode(struct dentry * upper, struct dentry * lower,
+			int bindex)
 {
 	unionfs_set_lower_inode_idx(upper->d_inode, bindex,
 			igrab(lower->d_inode));
@@@@ -570,8 +574,8 @@@@ static inline void __set_inode(struct dentry * upper, struct dentry * lower,
 }
 
 /* set lower dentry ptr and update bstart & bend if necessary */
-static inline void __set_dentry(struct dentry * upper, struct dentry * lower,
-				int bindex)
+static void __set_dentry(struct dentry * upper, struct dentry * lower,
+			 int bindex)
 {
 	unionfs_set_lower_dentry_idx(upper, bindex, lower);
 	if (likely(dbstart(upper) > bindex))
@@@@ -583,8 +587,9 @@@@ static inline void __set_dentry(struct dentry * upper, struct dentry * lower,
 /* This function replicates the directory structure upto given dentry
  * in the bindex branch.
  */
-struct dentry *create_parents_named(struct inode *dir, struct dentry *dentry,
-				    const char *name, int bindex)
+static struct dentry *create_parents_named(struct inode *dir,
+					   struct dentry *dentry,
+					   const char *name, int bindex)
 {
 	int err;
 	struct dentry *child_dentry;
diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c
index 740c000..04afcb6 100644
--- a/fs/unionfs/dentry.c
+++ b/fs/unionfs/dentry.c
@@@@ -18,12 +18,6 @@@@
 
 #include "union.h"
 
-/* declarations added for "sparse" */
-extern int unionfs_d_revalidate_wrap(struct dentry *dentry,
-				     struct nameidata *nd);
-extern void unionfs_d_release(struct dentry *dentry);
-extern void unionfs_d_iput(struct dentry *dentry, struct inode *inode);
-
 /*
  * returns 1 if valid, 0 otherwise.
  */
@@@@ -180,7 +174,8 @@@@ out:
 	return valid;
 }
 
-int unionfs_d_revalidate_wrap(struct dentry *dentry, struct nameidata *nd)
+static int unionfs_d_revalidate_wrap(struct dentry *dentry,
+				     struct nameidata *nd)
 {
 	int err;
 
@@@@ -191,7 +186,7 @@@@ int unionfs_d_revalidate_wrap(struct dentry *dentry, struct nameidata *nd)
 	return err;
 }
 
-void unionfs_d_release(struct dentry *dentry)
+static void unionfs_d_release(struct dentry *dentry)
 {
 	int bindex, bstart, bend;
 
diff --git a/fs/unionfs/file.c b/fs/unionfs/file.c
index 9d05806..b023b60 100644
--- a/fs/unionfs/file.c
+++ b/fs/unionfs/file.c
@@@@ -18,11 +18,6 @@@@
 
 #include "union.h"
 
-/* declarations for sparse */
-extern ssize_t unionfs_read(struct file *, char __user *, size_t, loff_t *);
-extern ssize_t unionfs_write(struct file *, const char __user *, size_t,
-			     loff_t *);
-
 /*******************
  * File Operations *
  *******************/
@@@@ -56,8 +51,8 @@@@ out:
 	return err;
 }
 
-ssize_t unionfs_read(struct file * file, char __user * buf, size_t count,
-		     loff_t * ppos)
+static ssize_t unionfs_read(struct file * file, char __user * buf,
+			    size_t count, loff_t * ppos)
 {
 	struct file *hidden_file;
 	loff_t pos = *ppos;
@@@@ -78,8 +73,8 @@@@ out:
 	return err;
 }
 
-ssize_t __unionfs_write(struct file * file, const char __user * buf,
-			size_t count, loff_t * ppos)
+static ssize_t __unionfs_write(struct file * file, const char __user * buf,
+			       size_t count, loff_t * ppos)
 {
 	int err = -EINVAL;
 	struct file *hidden_file = NULL;
@@@@ -123,8 +118,8 @@@@ out:
 	return err;
 }
 
-ssize_t unionfs_write(struct file * file, const char __user * buf, size_t count,
-		      loff_t * ppos)
+static ssize_t unionfs_write(struct file * file, const char __user * buf,
+			     size_t count, loff_t * ppos)
 {
 	int err = 0;
 
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index 36f2660..07044ac 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@@@ -18,14 +18,6 @@@@
 
 #include "union.h"
 
-/* declarations added for "sparse" */
-extern struct dentry *unionfs_lookup(struct inode *, struct dentry *,
-				     struct nameidata *);
-extern int unionfs_readlink(struct dentry *dentry, char __user * buf,
-			    int bufsiz);
-extern void unionfs_put_link(struct dentry *dentry, struct nameidata *nd,
-			     void *cookie);
-
 static int unionfs_create(struct inode *parent, struct dentry *dentry,
 			  int mode, struct nameidata *nd)
 {
@@@@ -195,8 +187,9 @@@@ out:
 	return err;
 }
 
-struct dentry *unionfs_lookup(struct inode *parent, struct dentry *dentry,
-			      struct nameidata *nd)
+static struct dentry *unionfs_lookup(struct inode *parent,
+				     struct dentry *dentry,
+				     struct nameidata *nd)
 {
 	struct nameidata lowernd; /* TODO: be gentler to the stack */
 
@@@@ -688,7 +681,8 @@@@ out:
 	return err;
 }
 
-int unionfs_readlink(struct dentry *dentry, char __user * buf, int bufsiz)
+static int unionfs_readlink(struct dentry *dentry, char __user * buf,
+			    int bufsiz)
 {
 	int err;
 	struct dentry *hidden_dentry;
@@@@ -743,7 +737,8 @@@@ out:
 	return ERR_PTR(err);
 }
 
-void unionfs_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)
+static void unionfs_put_link(struct dentry *dentry, struct nameidata *nd,
+			     void *cookie)
 {
 	kfree(nd_get_link(nd));
 }
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index 9cab716..3783f07 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@@@ -188,7 +188,7 @@@@ void unionfs_reinterpose(struct dentry *dentry)
  * 2) it exists
  * 3) is a directory
  */
-int check_branch(struct nameidata *nd)
+static int check_branch(struct nameidata *nd)
 {
 	if (!strcmp(nd->dentry->d_sb->s_type->name, "unionfs"))
 		return -EINVAL;
@@@@ -200,7 +200,7 @@@@ int check_branch(struct nameidata *nd)
 }
 
 /* checks if two hidden_dentries have overlapping branches */
-int is_branch_overlap(struct dentry *dent1, struct dentry *dent2)
+static int is_branch_overlap(struct dentry *dent1, struct dentry *dent2)
 {
 	struct dentry *dent = NULL;
 
diff --git a/fs/unionfs/rdstate.c b/fs/unionfs/rdstate.c
index a970346..68a76e5 100644
--- a/fs/unionfs/rdstate.c
+++ b/fs/unionfs/rdstate.c
@@@@ -232,7 +232,7 @@@@ struct filldir_node *find_filldir_node(struct unionfs_dir_state *rdstate,
 	return cursor;
 }
 
-inline struct filldir_node *alloc_filldir_node(const char *name, int namelen,
+static struct filldir_node *alloc_filldir_node(const char *name, int namelen,
 					       unsigned int hash, int bindex)
 {
 	return kmem_cache_alloc(unionfs_filldir_cachep, GFP_KERNEL);
diff --git a/fs/unionfs/sioq.c b/fs/unionfs/sioq.c
index 444a3e5..1c71185 100644
--- a/fs/unionfs/sioq.c
+++ b/fs/unionfs/sioq.c
@@@@ -24,7 +24,7 @@@@
  * whiteouts).
  */
 
-struct workqueue_struct *sioq;
+static struct workqueue_struct *sioq;
 
 int __init init_sioq(void)
 {
diff --git a/fs/unionfs/sioq.h b/fs/unionfs/sioq.h
index 5a93414..20e3b0c 100644
--- a/fs/unionfs/sioq.h
+++ b/fs/unionfs/sioq.h
@@@@ -61,7 +61,6 @@@@ struct sioq_args {
 	};
 };
 
-extern struct workqueue_struct *sioq;
 extern int __init init_sioq(void);
 extern __exit void stop_sioq(void);
 extern void run_sioq(work_func_t func, struct sioq_args *args);
diff --git a/fs/unionfs/stale_inode.c b/fs/unionfs/stale_inode.c
index bce938d..5fbaa30 100644
--- a/fs/unionfs/stale_inode.c
+++ b/fs/unionfs/stale_inode.c
@@@@ -13,10 +13,9 @@@@
 #include <linux/stat.h>
 #include <linux/sched.h>
 
-static struct address_space_operations unionfs_stale_aops;
+#include "union.h"
 
-/* declarations for "sparse */
-extern struct inode_operations stale_inode_ops;
+static struct address_space_operations unionfs_stale_aops;
 
 /*
  * The follow_link operation is special: it must behave as a no-op
@@@@ -51,7 +50,7 @@@@ static struct file_operations stale_file_ops = {
 	.lock		= ESTALE_ERROR,
 };
 
-struct inode_operations stale_inode_ops = {
+static struct inode_operations stale_inode_ops = {
 	.create		= ESTALE_ERROR,
 	.lookup		= ESTALE_ERROR,
 	.link		= ESTALE_ERROR,
@@@@ -99,6 +98,7 @@@@ void make_stale_inode(struct inode *inode)
  * those created by make_stale_inode() above.
  */
 
+#if 0
 /**
  * is_stale_inode - is an inode errored
  * @@inode: inode to test
@@@@ -109,4 +109,5 @@@@ int is_stale_inode(struct inode *inode)
 {
 	return (inode->i_op == &stale_inode_ops);
 }
+#endif  /*  0  */
 
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index f08eb75..d524f10 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@@@ -241,11 +241,6 @@@@ void update_bstart(struct dentry *dentry);
 /* replicates the directory structure upto given dentry in given branch */
 extern struct dentry *create_parents(struct inode *dir, struct dentry *dentry,
 				     int bindex);
-struct dentry *create_parents_named(struct inode *dir, struct dentry *dentry,
-				    const char *name, int bindex);
-
-/* check if two branches overlap */
-extern int is_branch_overlap(struct dentry *dent1, struct dentry *dent2);
 
 /* partial lookup */
 extern int unionfs_partial_lookup(struct dentry *dentry);
@@@@ -265,10 +260,6 @@@@ extern int copyup_named_file(struct inode *dir, struct file *file,
 /* copies a dentry from dbstart to newbindex branch */
 extern int copyup_dentry(struct inode *dir, struct dentry *dentry, int bstart,
 			 int new_bindex, struct file **copyup_file, loff_t len);
-extern 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);
 
 extern int remove_whiteouts(struct dentry *dentry, struct dentry *hidden_dentry,
 			    int bindex);
@@@@ -325,9 +316,6 @@@@ int unionfs_ioctl_incgen(struct file *file, unsigned int cmd,
 int unionfs_ioctl_queryfile(struct file *file, unsigned int cmd,
 			    unsigned long arg);
 
-/* Verify that a branch is valid. */
-int check_branch(struct nameidata *nd);
-
 #ifdef CONFIG_UNION_FS_XATTR
 /* Extended attribute functions. */
 extern void *unionfs_xattr_alloc(size_t size, size_t limit);
@@@@ -395,7 +383,6 @@@@ static inline int unionfs_get_nlinks(struct inode *inode)
 }
 
 struct dentry *unionfs_lookup_backend(struct dentry *dentry, struct nameidata *nd, int lookupmode);
-int is_stale_inode(struct inode *inode);
 void make_stale_inode(struct inode *inode);
 
 #define IS_SET(sb, check_flag) ((check_flag) & MOUNT_FLAG(sb))
@


1.1.2.2
log
@Added my signed-off-by to Adrian's patch
@
text
@a14 1
Signed-off-by: Josef 'Jeff' Sipek <jsipek@@cs.sunysb.edu>
@


1.1.2.3
log
@Removed stale_inode.c & associated patches

stale_inode.c seemed to be completely superfluous, and needed to be synced
up with current version of bad_inode.c or dropped. Dropping is considerably
cleaner.
@
text
@a14 1
[removed stale inode related fixes as stale_inode.c is gone]
d18 1
a18 1
index 6226a34..1806acf 100644
d49 1
a49 1
index 97ab571..1ef8baf 100644
d175 1
a175 1
index 0b002d1..d7193cc 100644
d211 1
a211 1
index d056e4f..9ce092d 100644
d260 1
a260 1
index 8246d15..1adb83c 100644
d311 1
a311 1
index ae0a148..033eb7c 100644
d333 1
a333 1
index 7f11ae2..16ce1bf 100644
d346 1
a346 1
index a8bc493..3225f5b 100644
d370 40
d411 1
a411 1
index 637f9f0..0c61f80 100644
d452 1
a454 1
 
@


1.1.2.4
log
@Moved akpm & bunk-fixes patches into unionfs dir & changed lookup to be
gentler to the stack by not allocating a new nameidata on the stack
@
text
@@


