@@ -656,13 +656,12 @@ static int __rpc_rmpipe(struct inode *dir, struct dentry *dentry)
656
656
}
657
657
658
658
static struct dentry * __rpc_lookup_create_exclusive (struct dentry * parent ,
659
- struct qstr * name )
659
+ const char * name )
660
660
{
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 );
664
663
if (!dentry ) {
665
- dentry = d_alloc (parent , name );
664
+ dentry = d_alloc (parent , & q );
666
665
if (!dentry )
667
666
return ERR_PTR (- ENOMEM );
668
667
}
@@ -689,8 +688,7 @@ static void __rpc_depopulate(struct dentry *parent,
689
688
for (i = start ; i < eof ; i ++ ) {
690
689
name .name = files [i ].name ;
691
690
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 );
694
692
695
693
if (dentry == NULL )
696
694
continue ;
@@ -732,12 +730,7 @@ static int rpc_populate(struct dentry *parent,
732
730
733
731
mutex_lock (& dir -> i_mutex );
734
732
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 );
741
734
err = PTR_ERR (dentry );
742
735
if (IS_ERR (dentry ))
743
736
goto out_bad ;
@@ -774,13 +767,11 @@ static struct dentry *rpc_mkdir_populate(struct dentry *parent,
774
767
int (* populate )(struct dentry * , void * ), void * args_populate )
775
768
{
776
769
struct dentry * dentry ;
777
- struct qstr q = QSTR_INIT (name , strlen (name ));
778
770
struct inode * dir = parent -> d_inode ;
779
771
int error ;
780
772
781
- q .hash = full_name_hash (q .name , q .len );
782
773
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 );
784
775
if (IS_ERR (dentry ))
785
776
goto out ;
786
777
error = __rpc_mkdir (dir , dentry , mode , NULL , private );
@@ -843,20 +834,15 @@ struct dentry *rpc_mkpipe_dentry(struct dentry *parent, const char *name,
843
834
struct dentry * dentry ;
844
835
struct inode * dir = parent -> d_inode ;
845
836
umode_t umode = S_IFIFO | S_IRUSR | S_IWUSR ;
846
- struct qstr q ;
847
837
int err ;
848
838
849
839
if (pipe -> ops -> upcall == NULL )
850
840
umode &= ~S_IRUGO ;
851
841
if (pipe -> ops -> downcall == NULL )
852
842
umode &= ~S_IWUGO ;
853
843
854
- q .name = name ;
855
- q .len = strlen (name );
856
- q .hash = full_name_hash (q .name , q .len ),
857
-
858
844
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 );
860
846
if (IS_ERR (dentry ))
861
847
goto out ;
862
848
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,
1063
1049
const unsigned char * dir_name )
1064
1050
{
1065
1051
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 );
1069
1053
}
1070
1054
EXPORT_SYMBOL_GPL (rpc_d_lookup_sb );
1071
1055
0 commit comments