@@ -389,38 +389,6 @@ void dlm_put_rsb(struct dlm_rsb *r)
389
389
put_rsb (r );
390
390
}
391
391
392
- static int pre_rsb_struct (struct dlm_ls * ls )
393
- {
394
- struct dlm_rsb * r1 , * r2 ;
395
- int count = 0 ;
396
-
397
- spin_lock_bh (& ls -> ls_new_rsb_spin );
398
- if (ls -> ls_new_rsb_count > dlm_config .ci_new_rsb_count / 2 ) {
399
- spin_unlock_bh (& ls -> ls_new_rsb_spin );
400
- return 0 ;
401
- }
402
- spin_unlock_bh (& ls -> ls_new_rsb_spin );
403
-
404
- r1 = dlm_allocate_rsb (ls );
405
- r2 = dlm_allocate_rsb (ls );
406
-
407
- spin_lock_bh (& ls -> ls_new_rsb_spin );
408
- if (r1 ) {
409
- list_add (& r1 -> res_hashchain , & ls -> ls_new_rsb );
410
- ls -> ls_new_rsb_count ++ ;
411
- }
412
- if (r2 ) {
413
- list_add (& r2 -> res_hashchain , & ls -> ls_new_rsb );
414
- ls -> ls_new_rsb_count ++ ;
415
- }
416
- count = ls -> ls_new_rsb_count ;
417
- spin_unlock_bh (& ls -> ls_new_rsb_spin );
418
-
419
- if (!count )
420
- return - ENOMEM ;
421
- return 0 ;
422
- }
423
-
424
392
/* connected with timer_delete_sync() in dlm_ls_stop() to stop
425
393
* new timers when recovery is triggered and don't run them
426
394
* again until a dlm_timer_resume() tries it again.
@@ -652,22 +620,10 @@ static int get_rsb_struct(struct dlm_ls *ls, const void *name, int len,
652
620
struct dlm_rsb * * r_ret )
653
621
{
654
622
struct dlm_rsb * r ;
655
- int count ;
656
623
657
- spin_lock_bh (& ls -> ls_new_rsb_spin );
658
- if (list_empty (& ls -> ls_new_rsb )) {
659
- count = ls -> ls_new_rsb_count ;
660
- spin_unlock_bh (& ls -> ls_new_rsb_spin );
661
- log_debug (ls , "find_rsb retry %d %d %s" ,
662
- count , dlm_config .ci_new_rsb_count ,
663
- (const char * )name );
664
- return - EAGAIN ;
665
- }
666
-
667
- r = list_first_entry (& ls -> ls_new_rsb , struct dlm_rsb , res_hashchain );
668
- list_del (& r -> res_hashchain );
669
- ls -> ls_new_rsb_count -- ;
670
- spin_unlock_bh (& ls -> ls_new_rsb_spin );
624
+ r = dlm_allocate_rsb (ls );
625
+ if (!r )
626
+ return - ENOMEM ;
671
627
672
628
r -> res_ls = ls ;
673
629
r -> res_length = len ;
@@ -792,13 +748,6 @@ static int find_rsb_dir(struct dlm_ls *ls, const void *name, int len,
792
748
}
793
749
794
750
retry :
795
- if (create ) {
796
- error = pre_rsb_struct (ls );
797
- if (error < 0 )
798
- goto out ;
799
- }
800
-
801
- retry_lookup :
802
751
803
752
/* check if the rsb is in keep state under read lock - likely path */
804
753
read_lock_bh (& ls -> ls_rsbtbl_lock );
@@ -832,7 +781,7 @@ static int find_rsb_dir(struct dlm_ls *ls, const void *name, int len,
832
781
if (!error ) {
833
782
if (!rsb_flag (r , RSB_TOSS )) {
834
783
write_unlock_bh (& ls -> ls_rsbtbl_lock );
835
- goto retry_lookup ;
784
+ goto retry ;
836
785
}
837
786
} else {
838
787
write_unlock_bh (& ls -> ls_rsbtbl_lock );
@@ -898,9 +847,7 @@ static int find_rsb_dir(struct dlm_ls *ls, const void *name, int len,
898
847
goto out ;
899
848
900
849
error = get_rsb_struct (ls , name , len , & r );
901
- if (error == - EAGAIN )
902
- goto retry ;
903
- if (error )
850
+ if (WARN_ON_ONCE (error ))
904
851
goto out ;
905
852
906
853
r -> res_hash = hash ;
@@ -952,7 +899,7 @@ static int find_rsb_dir(struct dlm_ls *ls, const void *name, int len,
952
899
*/
953
900
write_unlock_bh (& ls -> ls_rsbtbl_lock );
954
901
dlm_free_rsb (r );
955
- goto retry_lookup ;
902
+ goto retry ;
956
903
} else if (!error ) {
957
904
list_add (& r -> res_rsbs_list , & ls -> ls_keep );
958
905
}
@@ -976,11 +923,6 @@ static int find_rsb_nodir(struct dlm_ls *ls, const void *name, int len,
976
923
int error ;
977
924
978
925
retry :
979
- error = pre_rsb_struct (ls );
980
- if (error < 0 )
981
- goto out ;
982
-
983
- retry_lookup :
984
926
985
927
/* check if the rsb is in keep state under read lock - likely path */
986
928
read_lock_bh (& ls -> ls_rsbtbl_lock );
@@ -1015,7 +957,7 @@ static int find_rsb_nodir(struct dlm_ls *ls, const void *name, int len,
1015
957
if (!error ) {
1016
958
if (!rsb_flag (r , RSB_TOSS )) {
1017
959
write_unlock_bh (& ls -> ls_rsbtbl_lock );
1018
- goto retry_lookup ;
960
+ goto retry ;
1019
961
}
1020
962
} else {
1021
963
write_unlock_bh (& ls -> ls_rsbtbl_lock );
@@ -1070,10 +1012,7 @@ static int find_rsb_nodir(struct dlm_ls *ls, const void *name, int len,
1070
1012
*/
1071
1013
1072
1014
error = get_rsb_struct (ls , name , len , & r );
1073
- if (error == - EAGAIN ) {
1074
- goto retry ;
1075
- }
1076
- if (error )
1015
+ if (WARN_ON_ONCE (error ))
1077
1016
goto out ;
1078
1017
1079
1018
r -> res_hash = hash ;
@@ -1090,7 +1029,7 @@ static int find_rsb_nodir(struct dlm_ls *ls, const void *name, int len,
1090
1029
*/
1091
1030
write_unlock_bh (& ls -> ls_rsbtbl_lock );
1092
1031
dlm_free_rsb (r );
1093
- goto retry_lookup ;
1032
+ goto retry ;
1094
1033
} else if (!error ) {
1095
1034
list_add (& r -> res_rsbs_list , & ls -> ls_keep );
1096
1035
}
@@ -1304,11 +1243,6 @@ int dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, const char *name,
1304
1243
}
1305
1244
1306
1245
retry :
1307
- error = pre_rsb_struct (ls );
1308
- if (error < 0 )
1309
- return error ;
1310
-
1311
- retry_lookup :
1312
1246
1313
1247
/* check if the rsb is in keep state under read lock - likely path */
1314
1248
read_lock_bh (& ls -> ls_rsbtbl_lock );
@@ -1354,7 +1288,7 @@ int dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, const char *name,
1354
1288
/* something as changed, very unlikely but
1355
1289
* try again
1356
1290
*/
1357
- goto retry_lookup ;
1291
+ goto retry ;
1358
1292
}
1359
1293
} else {
1360
1294
write_unlock_bh (& ls -> ls_rsbtbl_lock );
@@ -1376,9 +1310,7 @@ int dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, const char *name,
1376
1310
1377
1311
not_found :
1378
1312
error = get_rsb_struct (ls , name , len , & r );
1379
- if (error == - EAGAIN )
1380
- goto retry ;
1381
- if (error )
1313
+ if (WARN_ON_ONCE (error ))
1382
1314
goto out ;
1383
1315
1384
1316
r -> res_hash = hash ;
@@ -1395,7 +1327,7 @@ int dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, const char *name,
1395
1327
*/
1396
1328
write_unlock_bh (& ls -> ls_rsbtbl_lock );
1397
1329
dlm_free_rsb (r );
1398
- goto retry_lookup ;
1330
+ goto retry ;
1399
1331
} else if (error ) {
1400
1332
write_unlock_bh (& ls -> ls_rsbtbl_lock );
1401
1333
/* should never happen */
0 commit comments