commit 51434fe2c5f541f9cc4a66fbe7e0489bfa5aa6e0
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Sat Apr 21 11:58:59 2007 -0400

    Commenting the code.
    
    Audited entire code for documentation.  Added comments at top of functions
    where it felt necessary (i.e., function's name and size don't make it clear
    what it may be doing precisely).  Reformatted some long comments.  Fixed a
    few comment typos and spelling errors.
    
    Conflicts:
    
        fs/unionfs/lookup.c
        fs/unionfs/rename.c
        fs/unionfs/subr.c

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 
9b125dc92c01896e5a9140ba712bf1e3d8b0f47a..d3fbca53ba8e82863e26868679b81ccb2785da70
 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -303,6 +303,7 @@ out:
        return err;
 }
 
+/* perform a delayed copyup of a read-write file on a read-only branch */
 static int do_delayed_copyup(struct file *file, struct dentry *dentry)
 {
        int bindex, bstart, bend, err = 0;
@@ -374,9 +375,9 @@ int unionfs_file_revalidate(struct file 
 
        /*
         * There are two cases we are interested in.  The first is if the
-        * generation is lower than the super-block.  The second is if someone
-        * has copied up this file from underneath us, we also need to refresh
-        * things.
+        * generation is lower than the super-block.  The second is if
+        * someone has copied up this file from underneath us, we also need
+        * to refresh things.
         */
        if (!d_deleted(dentry) &&
            (sbgen > fgen || dbstart(dentry) != fbstart(file))) {
diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c
index 
c2d6a3603a3d589e3e2b54f1de17c06b47a6c457..dd8d7e4a9b39bdbf386a2053cdc462bcecf4c6e7
 100644
--- a/fs/unionfs/copyup.c
+++ b/fs/unionfs/copyup.c
@@ -18,6 +18,12 @@
 
 #include "union.h"
 
+/*
+ * For detailed explanation of copyup see:
+ * Documentation/filesystems/unionfs/concepts.txt
+ */
+
+/* forward definitions */
 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,
@@ -26,11 +32,6 @@ static struct dentry *create_parents_nam
                                           struct dentry *dentry,
                                           const char *name, int bindex);
 
-/*
- * For detailed explanation of copyup see:
- * Documentation/filesystems/unionfs/concepts.txt
- */
-
 #ifdef CONFIG_UNION_FS_XATTR
 /* copyup all extended attrs for a given dentry */
 static int copyup_xattrs(struct dentry *old_hidden_dentry,
@@ -489,9 +490,9 @@ out:
 }
 
 /*
- * This function creates a copy of a file represented by 'file' which currently
- * resides in branch 'bstart' to branch 'new_bindex.'  The copy will be named
- * "name".
+ * This function creates a copy of a file represented by 'file' which
+ * currently resides in branch 'bstart' to branch 'new_bindex.'  The copy
+ * will be named "name".
  */
 int copyup_named_file(struct inode *dir, struct file *file, char *name,
                      int bstart, int new_bindex, loff_t len)
@@ -511,8 +512,8 @@ int copyup_named_file(struct inode *dir,
 }
 
 /*
- * This function creates a copy of a file represented by 'file' which currently
- * resides in branch 'bstart' to branch 'new_bindex'.
+ * This function creates a copy of a file represented by 'file' which
+ * currently resides in branch 'bstart' to branch 'new_bindex'.
  */
 int copyup_file(struct inode *dir, struct file *file, int bstart,
                int new_bindex, loff_t len)
@@ -541,6 +542,7 @@ struct dentry *create_parents(struct ino
        return create_parents_named(dir, dentry, dentry->d_name.name, bindex);
 }
 
+/* purge a dentry's lower-branch states (dput/mntput, etc.) */
 static void __cleanup_dentry(struct dentry * dentry, int bindex,
                             int old_bstart, int old_bend)
 {
diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c
index 
acd158ed2cd0b6cd1079ecf3a4b66995f511f29a..7eac1605878420e098172a2fefca8fbf6d531b7d
 100644
--- a/fs/unionfs/dentry.c
+++ b/fs/unionfs/dentry.c
@@ -18,7 +18,6 @@
 
 #include "union.h"
 
-
 /*
  * Revalidate a single dentry.
  * Assume that dentry's info node is locked.
@@ -60,8 +59,8 @@ static int __unionfs_d_revalidate_one(st
        sbgen = atomic_read(&UNIONFS_SB(dentry->d_sb)->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.
+        * revalidation to be done, because this file does not exist within
+        * the namespace, and Unionfs operates on the namespace, not data.
         */
        if (sbgen != dgen) {
                struct dentry *result;
diff --git a/fs/unionfs/file.c b/fs/unionfs/file.c
index 
6a016cdaba7ec646602974c1b21c8eaf5d7d7f86..4da58e1a62effab68a0027566c85c0772dd50c4f
 100644
--- a/fs/unionfs/file.c
+++ b/fs/unionfs/file.c
@@ -77,6 +77,7 @@ out:
        return err;
 }
 
+/* helper function to unionfs_write */
 static ssize_t __unionfs_write(struct file * file, const char __user * buf,
                               size_t count, loff_t * ppos)
 {
diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index 
ae62b6ea594dcc31bdb3db3cd27279cf0def2ec2..6d04fc9069b514498333a021a7f12fa1b03448b7
 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -325,7 +325,7 @@ out:
        return ERR_PTR(err);
 }
 
-/* This is a utility function that fills in a unionfs dentry.*/
+/* This is a utility function that fills in a unionfs dentry */
 int unionfs_partial_lookup(struct dentry *dentry)
 {
        struct dentry *tmp;
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index 
98fb9ad2fc1d2d5d575b6a3c9548cc93687d7d07..72d42d138a1f001a2124b54e59d0106c028220cf
 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -20,7 +20,12 @@ #include "union.h"
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 
-/* sb we pass is unionfs's super_block */
+/*
+ * Connect a unionfs inode dentry/inode with several lower ones.  This is
+ * the classic stackable file system "vnode interposition" action.
+ *
+ * @sb: unionfs's super_block
+ */
 int unionfs_interpose(struct dentry *dentry, struct super_block *sb, int flag)
 {
        struct inode *hidden_inode;
@@ -171,6 +176,7 @@ out:
        return err;
 }
 
+/* like interpose above, but for an already existing dentry */
 void unionfs_reinterpose(struct dentry *dentry)
 {
        struct dentry *hidden_dentry;
diff --git a/fs/unionfs/rename.c b/fs/unionfs/rename.c
index 
965d730f8e44fe70c51ef12f171d3caee0105031..92ffe1140d1efaeef4c187da58b5b32093e56dcf
 100644
--- a/fs/unionfs/rename.c
+++ b/fs/unionfs/rename.c
@@ -127,6 +127,11 @@ out_nofix:
        return err;
 }
 
+/*
+ * Main rename code.  This is sufficienly complex, that it's documented in
+ * Docmentation/filesystems/unionfs/rename.txt.  This routine calls
+ * do_rename() above to perform some of the work.
+ */
 static int do_unionfs_rename(struct inode *old_dir,
                             struct dentry *old_dentry,
                             struct inode *new_dir,
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index 
9f82314d45fdc73cc85df62a68ba18d5a0e0c8d9..6eeedfd5f5a3f8de689b7299f329e5318c2946f6
 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -66,13 +66,15 @@ static void unionfs_put_inode(struct ino
 {
        /*
         * This is really funky stuff:
+        *
         * Basically, if i_count == 1, iput will then decrement it and this
-        * inode will be destroyed.  It is currently holding a reference to the
-        * hidden inode.  Therefore, it needs to release that reference by
-        * calling iput on the hidden inode.  iput() _will_ do it for us (by
-        * calling our clear_inode), but _only_ if i_nlink == 0.  The problem
-        * is, NFS keeps i_nlink == 1 for silly_rename'd files.  So we must for
-        * our i_nlink to 0 here to trick iput() into calling our clear_inode.
+        * inode will be destroyed.  It is currently holding a reference to
+        * the hidden inode.  Therefore, it needs to release that reference
+        * by calling iput on the hidden inode.  iput() _will_ do it for us
+        * (by calling our clear_inode), but _only_ if i_nlink == 0.  The
+        * problem is, NFS keeps i_nlink == 1 for silly_rename'd files.  So
+        * we must force our i_nlink to 0 here to trick iput() into calling
+        * our clear_inode.
         */
 
        if (atomic_read(&inode->i_count) == 1)
@@ -880,6 +882,7 @@ int unionfs_init_inode_cache(void)
        return err;
 }
 
+/* unionfs inode cache destructor */
 void unionfs_destroy_inode_cache(void)
 {
        if (unionfs_inode_cachep)
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to