Unionfs: remove unused nameidata parameters
authorErez Zadok <ezk@cs.sunysb.edu>
Wed, 17 Sep 2008 17:52:17 +0000 (13:52 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Fri, 12 Aug 2011 02:38:50 +0000 (22:38 -0400)
In preparation for the VFS removing most/all nameidata from file systems's
view.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/commonfops.c
fs/unionfs/dentry.c
fs/unionfs/inode.c
fs/unionfs/lookup.c
fs/unionfs/rename.c
fs/unionfs/super.c
fs/unionfs/union.h
fs/unionfs/unlink.c
fs/unionfs/xattr.c

index 5938adf9cfa8de46b1217f915715cc948a6fbfa5..ceca1be5131967b71e51e24d24f479c106579fad 100644 (file)
@@ -417,7 +417,7 @@ int unionfs_file_revalidate(struct file *file, struct dentry *parent,
         */
 reval_dentry:
        if (!d_deleted(dentry) &&
-           !__unionfs_d_revalidate(dentry, parent, NULL, willwrite)) {
+           !__unionfs_d_revalidate(dentry, parent, willwrite)) {
                err = -ESTALE;
                goto out;
        }
@@ -561,7 +561,7 @@ int unionfs_open(struct inode *inode, struct file *file)
        }
 
        /* XXX: should I change 'false' below to the 'willwrite' flag? */
-       valid = __unionfs_d_revalidate(dentry, parent, NULL, false);
+       valid = __unionfs_d_revalidate(dentry, parent, false);
        if (unlikely(!valid)) {
                err = -ESTALE;
                goto out_nofree;
index d1e9ee82da696a9d637cad51c5209dc2538797ad..272021f0e19a7554f5d1cd7148c235ffb8ffe35d 100644 (file)
@@ -62,8 +62,7 @@ static inline void __dput_lowers(struct dentry *dentry, int start, int end)
  * Returns true if valid, false otherwise.
  */
 static bool __unionfs_d_revalidate_one(struct dentry *dentry,
-                                      struct dentry *parent,
-                                      struct nameidata *nd)
+                                      struct dentry *parent)
 {
        bool valid = true;      /* default is valid */
        struct dentry *lower_dentry;
@@ -71,12 +70,6 @@ static bool __unionfs_d_revalidate_one(struct dentry *dentry,
        int sbgen, dgen;
        int positive = 0;
        int interpose_flag;
-       struct nameidata lowernd; /* TODO: be gentler to the stack */
-
-       if (nd)
-               memcpy(&lowernd, nd, sizeof(struct nameidata));
-       else
-               memset(&lowernd, 0, sizeof(struct nameidata));
 
        sbgen = atomic_read(&UNIONFS_SB(dentry->d_sb)->generation);
        /* if the dentry is unhashed, do NOT revalidate */
@@ -120,8 +113,7 @@ static bool __unionfs_d_revalidate_one(struct dentry *dentry,
                        goto out;
                }
 
-               result = unionfs_lookup_full(dentry, parent,
-                                            &lowernd, interpose_flag);
+               result = unionfs_lookup_full(dentry, parent, interpose_flag);
                if (result) {
                        if (IS_ERR(result)) {
                                valid = false;
@@ -290,7 +282,7 @@ static inline void purge_inode_data(struct inode *inode)
  * dentry).  Returns true if valid, false otherwise.
  */
 bool __unionfs_d_revalidate(struct dentry *dentry, struct dentry *parent,
-                           struct nameidata *nd, bool willwrite)
+                           bool willwrite)
 {
        bool valid = false;     /* default is invalid */
        int sbgen, dgen;
@@ -318,13 +310,14 @@ bool __unionfs_d_revalidate(struct dentry *dentry, struct dentry *parent,
                if (!willwrite)
                        purge_inode_data(dentry->d_inode);
        }
-       valid = __unionfs_d_revalidate_one(dentry, parent, nd);
+       valid = __unionfs_d_revalidate_one(dentry, parent);
 
 out:
        return valid;
 }
 
-static int unionfs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
+static int unionfs_d_revalidate(struct dentry *dentry,
+                               struct nameidata *nd_unused)
 {
        bool valid = true;
        int err = 1;            /* 1 means valid for the VFS */
@@ -341,11 +334,10 @@ static int unionfs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
                        goto out;
                }
        }
-       valid = __unionfs_d_revalidate(dentry, parent, nd, false);
+       valid = __unionfs_d_revalidate(dentry, parent, false);
        if (likely(valid)) {
                unionfs_postcopyup_setmnt(dentry);
                unionfs_check_dentry(dentry);
-               unionfs_check_nd(nd);
        }
 
 out:
index cfe2088cc099a2f0880ac9f11a62b3ad55608210..0c8b7526df4da92ad7924a4f834ee033c8b3728e 100644 (file)
@@ -97,7 +97,7 @@ out:
 }
 
 static int unionfs_create(struct inode *dir, struct dentry *dentry,
-                         int mode, struct nameidata *nd)
+                         int mode, struct nameidata *nd_unused)
 {
        int err = 0;
        struct dentry *lower_dentry = NULL;
@@ -110,7 +110,7 @@ static int unionfs_create(struct inode *dir, struct dentry *dentry,
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
-       valid = __unionfs_d_revalidate(dentry, parent, nd, false);
+       valid = __unionfs_d_revalidate(dentry, parent, false);
        if (unlikely(!valid)) {
                err = -ESTALE;  /* same as what real_lookup does */
                goto out;
@@ -153,7 +153,6 @@ out:
                unionfs_postcopyup_setmnt(dentry);
                unionfs_check_inode(dir);
                unionfs_check_dentry(dentry);
-               unionfs_check_nd(nd);
        }
        unionfs_unlock_dentry(dentry);
        unionfs_unlock_parent(dentry, parent);
@@ -168,9 +167,8 @@ out:
  */
 static struct dentry *unionfs_lookup(struct inode *dir,
                                     struct dentry *dentry,
-                                    struct nameidata *nd)
+                                    struct nameidata *nd_unused)
 {
-       struct path path_save = {NULL, NULL};
        struct dentry *ret, *parent;
        int err = 0;
        bool valid;
@@ -183,12 +181,6 @@ static struct dentry *unionfs_lookup(struct inode *dir,
                goto out;
        }
 
-       /* save the dentry & vfsmnt from namei */
-       if (nd) {
-               path_save.dentry = nd->path.dentry;
-               path_save.mnt = nd->path.mnt;
-       }
-
        /*
         * unionfs_lookup_full returns a locked dentry upon success,
         * so we'll have to unlock it below.
@@ -201,13 +193,8 @@ static struct dentry *unionfs_lookup(struct inode *dir,
                goto out;
        }
 
-       ret = unionfs_lookup_full(dentry, parent, nd, INTERPOSE_LOOKUP);
+       ret = unionfs_lookup_full(dentry, parent, INTERPOSE_LOOKUP);
 
-       /* restore the dentry & vfsmnt in namei */
-       if (nd) {
-               nd->path.dentry = path_save.dentry;
-               nd->path.mnt = path_save.mnt;
-       }
        if (!IS_ERR(ret)) {
                if (ret)
                        dentry = ret;
@@ -220,10 +207,8 @@ static struct dentry *unionfs_lookup(struct inode *dir,
        }
 
        unionfs_check_inode(dir);
-       if (!IS_ERR(ret)) {
+       if (!IS_ERR(ret))
                unionfs_check_dentry(dentry);
-               unionfs_check_nd(nd);
-       }
        unionfs_check_dentry(parent);
        unionfs_unlock_dentry(dentry); /* locked in new_dentry_private data */
 
@@ -251,14 +236,13 @@ static int unionfs_link(struct dentry *old_dentry, struct inode *dir,
        unionfs_double_lock_parents(old_parent, new_parent);
        unionfs_double_lock_dentry(old_dentry, new_dentry);
 
-       valid = __unionfs_d_revalidate(old_dentry, old_parent, NULL, false);
+       valid = __unionfs_d_revalidate(old_dentry, old_parent, false);
        if (unlikely(!valid)) {
                err = -ESTALE;
                goto out;
        }
        if (new_dentry->d_inode) {
-               valid = __unionfs_d_revalidate(new_dentry, new_parent,
-                                              NULL, false);
+               valid = __unionfs_d_revalidate(new_dentry, new_parent, false);
                if (unlikely(!valid)) {
                        err = -ESTALE;
                        goto out;
@@ -390,7 +374,7 @@ static int unionfs_symlink(struct inode *dir, struct dentry *dentry,
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
-       valid = __unionfs_d_revalidate(dentry, parent, NULL, false);
+       valid = __unionfs_d_revalidate(dentry, parent, false);
        if (unlikely(!valid)) {
                err = -ESTALE;
                goto out;
@@ -458,7 +442,7 @@ static int unionfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
-       valid = __unionfs_d_revalidate(dentry, parent, NULL, false);
+       valid = __unionfs_d_revalidate(dentry, parent, false);
        if (unlikely(!valid)) {
                err = -ESTALE;  /* same as what real_lookup does */
                goto out;
@@ -583,7 +567,7 @@ static int unionfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
-       valid = __unionfs_d_revalidate(dentry, parent, NULL, false);
+       valid = __unionfs_d_revalidate(dentry, parent, false);
        if (unlikely(!valid)) {
                err = -ESTALE;
                goto out;
@@ -671,7 +655,7 @@ static int unionfs_readlink(struct dentry *dentry, char __user *buf,
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
-       if (unlikely(!__unionfs_d_revalidate(dentry, parent, NULL, false))) {
+       if (unlikely(!__unionfs_d_revalidate(dentry, parent, false))) {
                err = -ESTALE;
                goto out;
        }
@@ -732,6 +716,7 @@ out:
        return ERR_PTR(err);
 }
 
+/* this @nd *IS* still used */
 static void unionfs_put_link(struct dentry *dentry, struct nameidata *nd,
                             void *cookie)
 {
@@ -741,7 +726,7 @@ static void unionfs_put_link(struct dentry *dentry, struct nameidata *nd,
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
-       if (unlikely(!__unionfs_d_revalidate(dentry, parent, nd, false)))
+       if (unlikely(!__unionfs_d_revalidate(dentry, parent, false)))
                printk(KERN_ERR
                       "unionfs: put_link failed to revalidate dentry\n");
 
@@ -896,7 +881,7 @@ static int unionfs_setattr(struct dentry *dentry, struct iattr *ia)
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
-       if (unlikely(!__unionfs_d_revalidate(dentry, parent, NULL, false))) {
+       if (unlikely(!__unionfs_d_revalidate(dentry, parent, false))) {
                err = -ESTALE;
                goto out;
        }
index 5bf991aa2d84a44936d840f5bf94263d6ab76431..6877b8ce3b0a46dad6b76f9017f69fe86a1fb79e 100644 (file)
@@ -72,10 +72,9 @@ struct dentry *__lookup_one(struct dentry *base, struct vfsmount *mnt,
 int unionfs_partial_lookup(struct dentry *dentry, struct dentry *parent)
 {
        struct dentry *tmp;
-       struct nameidata nd = { .flags = 0 };
        int err = -ENOSYS;
 
-       tmp = unionfs_lookup_full(dentry, parent, &nd, INTERPOSE_PARTIAL);
+       tmp = unionfs_lookup_full(dentry, parent, INTERPOSE_PARTIAL);
 
        if (!tmp) {
                err = 0;
@@ -288,8 +287,7 @@ void release_lower_nd(struct nameidata *nd, int err)
  * dentry's info, which the caller must unlock.
  */
 struct dentry *unionfs_lookup_full(struct dentry *dentry,
-                                  struct dentry *parent,
-                                  struct nameidata *nd_unused, int lookupmode)
+                                  struct dentry *parent, int lookupmode)
 {
        int err = 0;
        struct dentry *lower_dentry = NULL;
index fa3c98e51dbaeec8136fa56069ab8380fe316064..800d9ee74c41de119a2a3ccdfb28a159268aa9a6 100644 (file)
@@ -396,14 +396,13 @@ int unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,
                unionfs_lock_dentry(new_parent, UNIONFS_DMUTEX_REVAL_CHILD);
        unionfs_double_lock_dentry(old_dentry, new_dentry);
 
-       valid = __unionfs_d_revalidate(old_dentry, old_parent, NULL, false);
+       valid = __unionfs_d_revalidate(old_dentry, old_parent, false);
        if (!valid) {
                err = -ESTALE;
                goto out;
        }
        if (!d_deleted(new_dentry) && new_dentry->d_inode) {
-               valid = __unionfs_d_revalidate(new_dentry, new_parent,
-                                              NULL, false);
+               valid = __unionfs_d_revalidate(new_dentry, new_parent, false);
                if (!valid) {
                        err = -ESTALE;
                        goto out;
index 909159360d675df55c33bb0e62e9af5e9f49295c..8115079ee4978a6824cf21ce7ae584679135d427 100644 (file)
@@ -159,7 +159,7 @@ static int unionfs_statfs(struct dentry *dentry, struct kstatfs *buf)
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
-       valid = __unionfs_d_revalidate(dentry, parent, NULL, false);
+       valid = __unionfs_d_revalidate(dentry, parent, false);
        if (unlikely(!valid)) {
                err = -ESTALE;
                goto out;
index b15be163ffe0adbc5d7bbb6910a2b65106e298f0..d76bd7efa274a1217828b3d37cfcbc465c617e48 100644 (file)
@@ -365,7 +365,6 @@ extern int unionfs_partial_lookup(struct dentry *dentry,
                                  struct dentry *parent);
 extern struct dentry *unionfs_lookup_full(struct dentry *dentry,
                                          struct dentry *parent,
-                                         struct nameidata *nd_unused,
                                          int lookupmode);
 
 /* copies a file from dbstart to newbindex branch */
@@ -429,9 +428,7 @@ extern int unionfs_unlink(struct inode *dir, struct dentry *dentry);
 extern int unionfs_rmdir(struct inode *dir, struct dentry *dentry);
 
 extern bool __unionfs_d_revalidate(struct dentry *dentry,
-                                  struct dentry *parent,
-                                  struct nameidata *nd,
-                                  bool willwrite);
+                                  struct dentry *parent, bool willwrite);
 extern bool is_negative_lower(const struct dentry *dentry);
 extern bool is_newer_lower(const struct dentry *dentry);
 extern void purge_sb_data(struct super_block *sb);
index 679f4ca7cda9eed861c6bbe4119efebccec9fae5..6634c4ba3df5af43be25b3a4d73f087a0633eb3f 100644 (file)
@@ -132,7 +132,7 @@ int unionfs_unlink(struct inode *dir, struct dentry *dentry)
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
-       valid = __unionfs_d_revalidate(dentry, parent, NULL, false);
+       valid = __unionfs_d_revalidate(dentry, parent, false);
        if (unlikely(!valid)) {
                err = -ESTALE;
                goto out;
@@ -214,7 +214,7 @@ int unionfs_rmdir(struct inode *dir, struct dentry *dentry)
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
-       valid = __unionfs_d_revalidate(dentry, parent, NULL, false);
+       valid = __unionfs_d_revalidate(dentry, parent, false);
        if (unlikely(!valid)) {
                err = -ESTALE;
                goto out;
index 6eb9503e8e4347990964857f23a0e731c7062e9e..e2215c15cbd27275a3f8a92c82838397bca7961a 100644 (file)
@@ -51,7 +51,7 @@ ssize_t unionfs_getxattr(struct dentry *dentry, const char *name, void *value,
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
-       valid = __unionfs_d_revalidate(dentry, parent, NULL, false);
+       valid = __unionfs_d_revalidate(dentry, parent, false);
        if (unlikely(!valid)) {
                err = -ESTALE;
                goto out;
@@ -85,7 +85,7 @@ int unionfs_setxattr(struct dentry *dentry, const char *name,
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
-       valid = __unionfs_d_revalidate(dentry, parent, NULL, false);
+       valid = __unionfs_d_revalidate(dentry, parent, false);
        if (unlikely(!valid)) {
                err = -ESTALE;
                goto out;
@@ -119,7 +119,7 @@ int unionfs_removexattr(struct dentry *dentry, const char *name)
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
-       valid = __unionfs_d_revalidate(dentry, parent, NULL, false);
+       valid = __unionfs_d_revalidate(dentry, parent, false);
        if (unlikely(!valid)) {
                err = -ESTALE;
                goto out;
@@ -153,7 +153,7 @@ ssize_t unionfs_listxattr(struct dentry *dentry, char *list, size_t size)
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
-       valid = __unionfs_d_revalidate(dentry, parent, NULL, false);
+       valid = __unionfs_d_revalidate(dentry, parent, false);
        if (unlikely(!valid)) {
                err = -ESTALE;
                goto out;