The patch titled

     namei cleanup

has been added to the -mm tree.  Its filename is

     namei-cleanup.patch

Patches currently in -mm which might be from [EMAIL PROTECTED] are

proc-link-count-fix.patch
remove-ia_attr_flags.patch
namei-cleanup.patch
use-get_fs_struct-in-proc.patch
fix-enum-pid_directory_inos-in-proc-basec.patch
remove-duplicated-code-from-proc-and-ptrace.patch
remove-duplicated-sys_open32-code-from-64bit-archs.patch
cifs_create-fix.patch
deprecate-openfoo-3.patch
pivot_root-circular-reference-fix-3.patch
fuse-maintainers-kconfig-and-makefile-changes.patch
fuse-core.patch
fuse-device-functions.patch
fuse-device-functions-document-mount-options.patch
fuse-device-functions-document-mount-options-documentation-update.patch
fuse-device-functions-request-counter-overflow-fix.patch
fuse-device-functions-module-alias.patch
fuse-read-only-operations.patch
fuse-read-only-operations-follow_link-fix.patch
fuse-read-write-operations.patch
fuse-file-operations.patch
fuse-mount-options.patch
fuse-extended-attribute-operations.patch
fuse-add-padding.patch
fuse-readpages-operation.patch
fuse-tighten-check-for-processes-allowed-access.patch
fuse-stricter-mount-option-checking.patch
fuse-direct-i-o.patch
fuse-direct-i-o-cleanup.patch
fuse-transfer-readdir-data-through-device.patch
fuse-dont-update-file-times.patch
fuse-add-fsync-operation-for-directories.patch
fuse-dont-allow-restarting-of-system-calls.patch



From: Miklos Szeredi <[EMAIL PROTECTED]>

Extract common code into inline functions to make reading easier.

Signed-off-by: Miklos Szeredi <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Cc: Christoph Hellwig <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 fs/namei.c |   52 ++++++++++++++++++++++++----------------------------
 1 files changed, 24 insertions(+), 28 deletions(-)

diff -puN fs/namei.c~namei-cleanup fs/namei.c
--- 25/fs/namei.c~namei-cleanup Mon Aug 29 14:23:33 2005
+++ 25-akpm/fs/namei.c  Mon Aug 29 14:23:33 2005
@@ -525,6 +525,22 @@ static inline int __do_follow_link(struc
        return error;
 }
 
+static inline void dput_path(struct path *path, struct nameidata *nd)
+{
+       dput(path->dentry);
+       if (path->mnt != nd->mnt)
+               mntput(path->mnt);
+}
+
+static inline void path_to_nameidata(struct path *path, struct nameidata *nd)
+{
+       dput(nd->dentry);
+       if (nd->mnt != path->mnt)
+               mntput(nd->mnt);
+       nd->mnt = path->mnt;
+       nd->dentry = path->dentry;
+}
+
 /*
  * This limits recursive symlink follows to 8, while
  * limiting consecutive symlinks to 40.
@@ -552,9 +568,7 @@ static inline int do_follow_link(struct 
        nd->depth--;
        return err;
 loop:
-       dput(path->dentry);
-       if (path->mnt != nd->mnt)
-               mntput(path->mnt);
+       dput_path(path, nd);
        path_release(nd);
        return err;
 }
@@ -813,13 +827,8 @@ static fastcall int __link_path_walk(con
                        err = -ENOTDIR; 
                        if (!inode->i_op)
                                break;
-               } else {
-                       dput(nd->dentry);
-                       if (nd->mnt != next.mnt)
-                               mntput(nd->mnt);
-                       nd->mnt = next.mnt;
-                       nd->dentry = next.dentry;
-               }
+               } else
+                       path_to_nameidata(&next, nd);
                err = -ENOTDIR; 
                if (!inode->i_op->lookup)
                        break;
@@ -859,13 +868,8 @@ last_component:
                        if (err)
                                goto return_err;
                        inode = nd->dentry->d_inode;
-               } else {
-                       dput(nd->dentry);
-                       if (nd->mnt != next.mnt)
-                               mntput(nd->mnt);
-                       nd->mnt = next.mnt;
-                       nd->dentry = next.dentry;
-               }
+               } else
+                       path_to_nameidata(&next, nd);
                err = -ENOENT;
                if (!inode)
                        break;
@@ -901,9 +905,7 @@ return_reval:
 return_base:
                return 0;
 out_dput:
-               dput(next.dentry);
-               if (nd->mnt != next.mnt)
-                       mntput(next.mnt);
+               dput_path(&next, nd);
                break;
        }
        path_release(nd);
@@ -1505,11 +1507,7 @@ do_last:
        if (path.dentry->d_inode->i_op && 
path.dentry->d_inode->i_op->follow_link)
                goto do_link;
 
-       dput(nd->dentry);
-       nd->dentry = path.dentry;
-       if (nd->mnt != path.mnt)
-               mntput(nd->mnt);
-       nd->mnt = path.mnt;
+       path_to_nameidata(&path, nd);
        error = -EISDIR;
        if (path.dentry->d_inode && S_ISDIR(path.dentry->d_inode->i_mode))
                goto exit;
@@ -1520,9 +1518,7 @@ ok:
        return 0;
 
 exit_dput:
-       dput(path.dentry);
-       if (nd->mnt != path.mnt)
-               mntput(path.mnt);
+       dput_path(&path, nd);
 exit:
        path_release(nd);
        return error;
_
-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to