@@ -2640,16 +2640,14 @@ static int is_next_segment_free(struct f2fs_sb_info *sbi,
2640
2640
* This function should be returned with success, otherwise BUG
2641
2641
*/
2642
2642
static void get_new_segment (struct f2fs_sb_info * sbi ,
2643
- unsigned int * newseg , bool new_sec , int dir )
2643
+ unsigned int * newseg , bool new_sec )
2644
2644
{
2645
2645
struct free_segmap_info * free_i = FREE_I (sbi );
2646
2646
unsigned int segno , secno , zoneno ;
2647
2647
unsigned int total_zones = MAIN_SECS (sbi ) / sbi -> secs_per_zone ;
2648
2648
unsigned int hint = GET_SEC_FROM_SEG (sbi , * newseg );
2649
2649
unsigned int old_zoneno = GET_ZONE_FROM_SEG (sbi , * newseg );
2650
- unsigned int left_start = hint ;
2651
2650
bool init = true;
2652
- int go_left = 0 ;
2653
2651
int i ;
2654
2652
2655
2653
spin_lock (& free_i -> segmap_lock );
@@ -2663,30 +2661,10 @@ static void get_new_segment(struct f2fs_sb_info *sbi,
2663
2661
find_other_zone :
2664
2662
secno = find_next_zero_bit (free_i -> free_secmap , MAIN_SECS (sbi ), hint );
2665
2663
if (secno >= MAIN_SECS (sbi )) {
2666
- if (dir == ALLOC_RIGHT ) {
2667
- secno = find_first_zero_bit (free_i -> free_secmap ,
2664
+ secno = find_first_zero_bit (free_i -> free_secmap ,
2668
2665
MAIN_SECS (sbi ));
2669
- f2fs_bug_on (sbi , secno >= MAIN_SECS (sbi ));
2670
- } else {
2671
- go_left = 1 ;
2672
- left_start = hint - 1 ;
2673
- }
2674
- }
2675
- if (go_left == 0 )
2676
- goto skip_left ;
2677
-
2678
- while (test_bit (left_start , free_i -> free_secmap )) {
2679
- if (left_start > 0 ) {
2680
- left_start -- ;
2681
- continue ;
2682
- }
2683
- left_start = find_first_zero_bit (free_i -> free_secmap ,
2684
- MAIN_SECS (sbi ));
2685
- f2fs_bug_on (sbi , left_start >= MAIN_SECS (sbi ));
2686
- break ;
2666
+ f2fs_bug_on (sbi , secno >= MAIN_SECS (sbi ));
2687
2667
}
2688
- secno = left_start ;
2689
- skip_left :
2690
2668
segno = GET_SEG_FROM_SEC (sbi , secno );
2691
2669
zoneno = GET_ZONE_FROM_SEC (sbi , secno );
2692
2670
@@ -2697,21 +2675,13 @@ static void get_new_segment(struct f2fs_sb_info *sbi,
2697
2675
goto got_it ;
2698
2676
if (zoneno == old_zoneno )
2699
2677
goto got_it ;
2700
- if (dir == ALLOC_LEFT ) {
2701
- if (!go_left && zoneno + 1 >= total_zones )
2702
- goto got_it ;
2703
- if (go_left && zoneno == 0 )
2704
- goto got_it ;
2705
- }
2706
2678
for (i = 0 ; i < NR_CURSEG_TYPE ; i ++ )
2707
2679
if (CURSEG_I (sbi , i )-> zone == zoneno )
2708
2680
break ;
2709
2681
2710
2682
if (i < NR_CURSEG_TYPE ) {
2711
2683
/* zone is in user, try another */
2712
- if (go_left )
2713
- hint = zoneno * sbi -> secs_per_zone - 1 ;
2714
- else if (zoneno + 1 >= total_zones )
2684
+ if (zoneno + 1 >= total_zones )
2715
2685
hint = 0 ;
2716
2686
else
2717
2687
hint = (zoneno + 1 ) * sbi -> secs_per_zone ;
@@ -2769,8 +2739,7 @@ static unsigned int __get_next_segno(struct f2fs_sb_info *sbi, int type)
2769
2739
if (unlikely (is_sbi_flag_set (sbi , SBI_CP_DISABLED )))
2770
2740
return 0 ;
2771
2741
2772
- if (test_opt (sbi , NOHEAP ) &&
2773
- (seg_type == CURSEG_HOT_DATA || IS_NODESEG (seg_type )))
2742
+ if (seg_type == CURSEG_HOT_DATA || IS_NODESEG (seg_type ))
2774
2743
return 0 ;
2775
2744
2776
2745
if (SIT_I (sbi )-> last_victim [ALLOC_NEXT ])
@@ -2790,21 +2759,12 @@ static unsigned int __get_next_segno(struct f2fs_sb_info *sbi, int type)
2790
2759
static void new_curseg (struct f2fs_sb_info * sbi , int type , bool new_sec )
2791
2760
{
2792
2761
struct curseg_info * curseg = CURSEG_I (sbi , type );
2793
- unsigned short seg_type = curseg -> seg_type ;
2794
2762
unsigned int segno = curseg -> segno ;
2795
- int dir = ALLOC_LEFT ;
2796
2763
2797
2764
if (curseg -> inited )
2798
- write_sum_page (sbi , curseg -> sum_blk ,
2799
- GET_SUM_BLOCK (sbi , segno ));
2800
- if (seg_type == CURSEG_WARM_DATA || seg_type == CURSEG_COLD_DATA )
2801
- dir = ALLOC_RIGHT ;
2802
-
2803
- if (test_opt (sbi , NOHEAP ))
2804
- dir = ALLOC_RIGHT ;
2805
-
2765
+ write_sum_page (sbi , curseg -> sum_blk , GET_SUM_BLOCK (sbi , segno ));
2806
2766
segno = __get_next_segno (sbi , type );
2807
- get_new_segment (sbi , & segno , new_sec , dir );
2767
+ get_new_segment (sbi , & segno , new_sec );
2808
2768
curseg -> next_segno = segno ;
2809
2769
reset_curseg (sbi , type , 1 );
2810
2770
curseg -> alloc_type = LFS ;
0 commit comments