rpc_pipe: convert back to simple_dir_inode_operations
[deliverable/linux.git] / net / sunrpc / rpc_pipe.c
index 4679df5a6d50f00efaac83cefbad73c43f0890e8..017aedc8a7a1e9fe6d5e012342754e25c8a74260 100644 (file)
@@ -656,21 +656,17 @@ static int __rpc_rmpipe(struct inode *dir, struct dentry *dentry)
 }
 
 static struct dentry *__rpc_lookup_create_exclusive(struct dentry *parent,
-                                         struct qstr *name)
+                                         const char *name)
 {
-       struct dentry *dentry;
-
-       dentry = d_lookup(parent, name);
+       struct qstr q = QSTR_INIT(name, strlen(name));
+       struct dentry *dentry = d_hash_and_lookup(parent, &q);
        if (!dentry) {
-               dentry = d_alloc(parent, name);
+               dentry = d_alloc(parent, &q);
                if (!dentry)
                        return ERR_PTR(-ENOMEM);
        }
-       if (dentry->d_inode == NULL) {
-               if (!dentry->d_op)
-                       d_set_d_op(dentry, &rpc_dentry_operations);
+       if (dentry->d_inode == NULL)
                return dentry;
-       }
        dput(dentry);
        return ERR_PTR(-EEXIST);
 }
@@ -690,8 +686,7 @@ static void __rpc_depopulate(struct dentry *parent,
        for (i = start; i < eof; i++) {
                name.name = files[i].name;
                name.len = strlen(files[i].name);
-               name.hash = full_name_hash(name.name, name.len);
-               dentry = d_lookup(parent, &name);
+               dentry = d_hash_and_lookup(parent, &name);
 
                if (dentry == NULL)
                        continue;
@@ -733,12 +728,7 @@ static int rpc_populate(struct dentry *parent,
 
        mutex_lock(&dir->i_mutex);
        for (i = start; i < eof; i++) {
-               struct qstr q;
-
-               q.name = files[i].name;
-               q.len = strlen(files[i].name);
-               q.hash = full_name_hash(q.name, q.len);
-               dentry = __rpc_lookup_create_exclusive(parent, &q);
+               dentry = __rpc_lookup_create_exclusive(parent, files[i].name);
                err = PTR_ERR(dentry);
                if (IS_ERR(dentry))
                        goto out_bad;
@@ -771,7 +761,7 @@ out_bad:
 }
 
 static struct dentry *rpc_mkdir_populate(struct dentry *parent,
-               struct qstr *name, umode_t mode, void *private,
+               const char *name, umode_t mode, void *private,
                int (*populate)(struct dentry *, void *), void *args_populate)
 {
        struct dentry *dentry;
@@ -842,7 +832,6 @@ struct dentry *rpc_mkpipe_dentry(struct dentry *parent, const char *name,
        struct dentry *dentry;
        struct inode *dir = parent->d_inode;
        umode_t umode = S_IFIFO | S_IRUSR | S_IWUSR;
-       struct qstr q;
        int err;
 
        if (pipe->ops->upcall == NULL)
@@ -850,12 +839,8 @@ struct dentry *rpc_mkpipe_dentry(struct dentry *parent, const char *name,
        if (pipe->ops->downcall == NULL)
                umode &= ~S_IWUGO;
 
-       q.name = name;
-       q.len = strlen(name);
-       q.hash = full_name_hash(q.name, q.len),
-
        mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
-       dentry = __rpc_lookup_create_exclusive(parent, &q);
+       dentry = __rpc_lookup_create_exclusive(parent, name);
        if (IS_ERR(dentry))
                goto out;
        err = __rpc_mkpipe_dentry(dir, dentry, umode, &rpc_pipe_fops,
@@ -926,8 +911,8 @@ static void rpc_clntdir_depopulate(struct dentry *dentry)
 
 /**
  * rpc_create_client_dir - Create a new rpc_client directory in rpc_pipefs
- * @dentry: dentry from the rpc_pipefs root to the new directory
- * @name: &struct qstr for the name
+ * @dentry: the parent of new directory
+ * @name: the name of new directory
  * @rpc_client: rpc client to associate with this directory
  *
  * This creates a directory at the given @path associated with
@@ -936,7 +921,7 @@ static void rpc_clntdir_depopulate(struct dentry *dentry)
  * later be created using rpc_mkpipe().
  */
 struct dentry *rpc_create_client_dir(struct dentry *dentry,
-                                  struct qstr *name,
+                                  const char *name,
                                   struct rpc_clnt *rpc_client)
 {
        return rpc_mkdir_populate(dentry, name, S_IRUGO | S_IXUGO, NULL,
@@ -982,7 +967,7 @@ static void rpc_cachedir_depopulate(struct dentry *dentry)
        rpc_depopulate(dentry, cache_pipefs_files, 0, 3);
 }
 
-struct dentry *rpc_create_cache_dir(struct dentry *parent, struct qstr *name,
+struct dentry *rpc_create_cache_dir(struct dentry *parent, const char *name,
                                    umode_t umode, struct cache_detail *cd)
 {
        return rpc_mkdir_populate(parent, name, umode, NULL,
@@ -1062,9 +1047,7 @@ struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
                               const unsigned char *dir_name)
 {
        struct qstr dir = QSTR_INIT(dir_name, strlen(dir_name));
-
-       dir.hash = full_name_hash(dir.name, dir.len);
-       return d_lookup(sb->s_root, &dir);
+       return d_hash_and_lookup(sb->s_root, &dir);
 }
 EXPORT_SYMBOL_GPL(rpc_d_lookup_sb);
 
@@ -1117,6 +1100,7 @@ rpc_fill_super(struct super_block *sb, void *data, int silent)
        sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
        sb->s_magic = RPCAUTH_GSSMAGIC;
        sb->s_op = &s_ops;
+       sb->s_d_op = &rpc_dentry_operations;
        sb->s_time_gran = 1;
 
        inode = rpc_get_inode(sb, S_IFDIR | S_IRUGO | S_IXUGO);
This page took 0.042963 seconds and 5 git commands to generate.