commit 663874c2246704c728c1e46703a4b17131cbbb8b
Author: Erez_Zadok <[EMAIL PROTECTED]>
Date:   Mon May 28 20:49:51 2007 -0400

    cleanup: rewrite unionfs_partial_lookup more cleanly
    
    Signed-off-by: Erez Zadok <[EMAIL PROTECTED]>

diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index 7cc37e7..e6827fa 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -359,32 +359,37 @@ 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.
+ *
+ * Returns: 0 (ok), or -ERRNO if an error occurred.
+ */
 int unionfs_partial_lookup(struct dentry *dentry)
 {
        struct dentry *tmp;
        struct nameidata nd = { .flags = 0 };
+       int err = -ENOSYS;
 
        tmp = unionfs_lookup_backend(dentry, &nd, INTERPOSE_PARTIAL);
-       if (!tmp) {
-               int err = 0;
-               if (UNIONFS_D(dentry) && !UNIONFS_D(dentry)->odf.dentry) {
-                       tmp = unionfs_lower_dentry_idx(dentry, 0);
-                       if (dentry->d_inode || (tmp && tmp->d_inode)) {
-                               err = odf_lookup(dentry->d_parent, dentry, 0);
-                               if (err)
-                                       return  err;
-                               BUG_ON(!UNIONFS_D(dentry)->odf.dentry);
-                       }
-
+       if (IS_ERR(tmp)) {
+               err = PTR_ERR(tmp);
+               goto out;
+       }
+       err = 0;
+       if (UNIONFS_D(dentry) && !UNIONFS_D(dentry)->odf.dentry) {
+               tmp = unionfs_lower_dentry_idx(dentry, 0);
+               if (dentry->d_inode || (tmp && tmp->d_inode)) {
+                       err = odf_lookup(dentry->d_parent, dentry, 0);
+                       if (err)
+                               goto out;
+                       BUG_ON(!UNIONFS_D(dentry)->odf.dentry);
                }
-               return 0;
        }
-       if (IS_ERR(tmp))
-               return PTR_ERR(tmp);
+
        /* need to change the interface */
        BUG_ON(tmp != dentry);
-       return -ENOSYS;
+out:
+       return err;
 }
 
 /* The dentry cache is just so we have properly sized dentries. */
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to