cleanup: rewrite unionfs_partial_lookup more cleanly and add comments
authorErez_Zadok <ezk@cs.sunysb.edu>
Mon, 28 May 2007 23:39:44 +0000 (19:39 -0400)
committerErez_Zadok <ezk@cs.sunysb.edu>
Mon, 23 Jul 2007 00:50:46 +0000 (20:50 -0400)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/lookup.c

index ead0c6ac80636e9574044f43b7b25278df98e57d..5c2334e6e358e53d44d7f960ed2da8bad0b43fec 100644 (file)
@@ -422,20 +422,30 @@ 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)
-               return 0;
-       if (IS_ERR(tmp))
-               return PTR_ERR(tmp);
+       if (!tmp) {
+               err = 0;
+               goto out;
+       }
+       if (IS_ERR(tmp)) {
+               err = PTR_ERR(tmp);
+               goto out;
+       }
        /* 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. */