@@ -656,13 +656,12 @@ static int __rpc_rmpipe(struct inode *dir, struct dentry *dentry)
656656}
657657
658658static struct dentry * __rpc_lookup_create_exclusive (struct dentry * parent ,
659- struct qstr * name )
659+ const char * name )
660660{
661- struct dentry * dentry ;
662-
663- dentry = d_lookup (parent , name );
661+ struct qstr q = QSTR_INIT (name , strlen (name ));
662+ struct dentry * dentry = d_hash_and_lookup (parent , & q );
664663 if (!dentry ) {
665- dentry = d_alloc (parent , name );
664+ dentry = d_alloc (parent , & q );
666665 if (!dentry )
667666 return ERR_PTR (- ENOMEM );
668667 }
@@ -689,8 +688,7 @@ static void __rpc_depopulate(struct dentry *parent,
689688 for (i = start ; i < eof ; i ++ ) {
690689 name .name = files [i ].name ;
691690 name .len = strlen (files [i ].name );
692- name .hash = full_name_hash (name .name , name .len );
693- dentry = d_lookup (parent , & name );
691+ dentry = d_hash_and_lookup (parent , & name );
694692
695693 if (dentry == NULL )
696694 continue ;
@@ -732,12 +730,7 @@ static int rpc_populate(struct dentry *parent,
732730
733731 mutex_lock (& dir -> i_mutex );
734732 for (i = start ; i < eof ; i ++ ) {
735- struct qstr q ;
736-
737- q .name = files [i ].name ;
738- q .len = strlen (files [i ].name );
739- q .hash = full_name_hash (q .name , q .len );
740- dentry = __rpc_lookup_create_exclusive (parent , & q );
733+ dentry = __rpc_lookup_create_exclusive (parent , files [i ].name );
741734 err = PTR_ERR (dentry );
742735 if (IS_ERR (dentry ))
743736 goto out_bad ;
@@ -774,13 +767,11 @@ static struct dentry *rpc_mkdir_populate(struct dentry *parent,
774767 int (* populate )(struct dentry * , void * ), void * args_populate )
775768{
776769 struct dentry * dentry ;
777- struct qstr q = QSTR_INIT (name , strlen (name ));
778770 struct inode * dir = parent -> d_inode ;
779771 int error ;
780772
781- q .hash = full_name_hash (q .name , q .len );
782773 mutex_lock_nested (& dir -> i_mutex , I_MUTEX_PARENT );
783- dentry = __rpc_lookup_create_exclusive (parent , & q );
774+ dentry = __rpc_lookup_create_exclusive (parent , name );
784775 if (IS_ERR (dentry ))
785776 goto out ;
786777 error = __rpc_mkdir (dir , dentry , mode , NULL , private );
@@ -843,20 +834,15 @@ struct dentry *rpc_mkpipe_dentry(struct dentry *parent, const char *name,
843834 struct dentry * dentry ;
844835 struct inode * dir = parent -> d_inode ;
845836 umode_t umode = S_IFIFO | S_IRUSR | S_IWUSR ;
846- struct qstr q ;
847837 int err ;
848838
849839 if (pipe -> ops -> upcall == NULL )
850840 umode &= ~S_IRUGO ;
851841 if (pipe -> ops -> downcall == NULL )
852842 umode &= ~S_IWUGO ;
853843
854- q .name = name ;
855- q .len = strlen (name );
856- q .hash = full_name_hash (q .name , q .len ),
857-
858844 mutex_lock_nested (& dir -> i_mutex , I_MUTEX_PARENT );
859- dentry = __rpc_lookup_create_exclusive (parent , & q );
845+ dentry = __rpc_lookup_create_exclusive (parent , name );
860846 if (IS_ERR (dentry ))
861847 goto out ;
862848 err = __rpc_mkpipe_dentry (dir , dentry , umode , & rpc_pipe_fops ,
@@ -1063,9 +1049,7 @@ struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
10631049 const unsigned char * dir_name )
10641050{
10651051 struct qstr dir = QSTR_INIT (dir_name , strlen (dir_name ));
1066-
1067- dir .hash = full_name_hash (dir .name , dir .len );
1068- return d_lookup (sb -> s_root , & dir );
1052+ return d_hash_and_lookup (sb -> s_root , & dir );
10691053}
10701054EXPORT_SYMBOL_GPL (rpc_d_lookup_sb );
10711055
0 commit comments