]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/ntfs/namei.c
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[karo-tx-linux.git] / fs / ntfs / namei.c
index 9e8a95be7a1e27c2938753e245513c0650e8b7b1..358273e59aded3d416dea0f1e67627731d9d0d8f 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/dcache.h>
 #include <linux/exportfs.h>
 #include <linux/security.h>
+#include <linux/slab.h>
 
 #include "attrib.h"
 #include "debug.h"
@@ -304,8 +305,6 @@ static struct dentry *ntfs_get_parent(struct dentry *child_dent)
        ntfs_attr_search_ctx *ctx;
        ATTR_RECORD *attr;
        FILE_NAME_ATTR *fn;
-       struct inode *parent_vi;
-       struct dentry *parent_dent;
        unsigned long parent_ino;
        int err;
 
@@ -345,24 +344,8 @@ try_next:
        /* Release the search context and the mft record of the child. */
        ntfs_attr_put_search_ctx(ctx);
        unmap_mft_record(ni);
-       /* Get the inode of the parent directory. */
-       parent_vi = ntfs_iget(vi->i_sb, parent_ino);
-       if (IS_ERR(parent_vi) || unlikely(is_bad_inode(parent_vi))) {
-               if (!IS_ERR(parent_vi))
-                       iput(parent_vi);
-               ntfs_error(vi->i_sb, "Failed to get parent directory inode "
-                               "0x%lx of child inode 0x%lx.", parent_ino,
-                               vi->i_ino);
-               return ERR_PTR(-EACCES);
-       }
-       /* Finally get a dentry for the parent directory and return it. */
-       parent_dent = d_alloc_anon(parent_vi);
-       if (unlikely(!parent_dent)) {
-               iput(parent_vi);
-               return ERR_PTR(-ENOMEM);
-       }
-       ntfs_debug("Done for inode 0x%lx.", vi->i_ino);
-       return parent_dent;
+
+       return d_obtain_alias(ntfs_iget(vi->i_sb, parent_ino));
 }
 
 static struct inode *ntfs_nfs_get_inode(struct super_block *sb,