Lines Matching refs:curseg

2317 	struct curseg_info *curseg = CURSEG_I(sbi, type);  in __add_sum_entry()  local
2318 void *addr = curseg->sum_blk; in __add_sum_entry()
2320 addr += curseg->next_blkoff * sizeof(struct f2fs_summary); in __add_sum_entry()
2383 struct curseg_info *curseg = CURSEG_I(sbi, type); in write_current_sum_page() local
2385 struct f2fs_summary_block *src = curseg->sum_blk; in write_current_sum_page()
2391 mutex_lock(&curseg->curseg_mutex); in write_current_sum_page()
2393 down_read(&curseg->journal_rwsem); in write_current_sum_page()
2394 memcpy(&dst->journal, curseg->journal, SUM_JOURNAL_SIZE); in write_current_sum_page()
2395 up_read(&curseg->journal_rwsem); in write_current_sum_page()
2400 mutex_unlock(&curseg->curseg_mutex); in write_current_sum_page()
2407 struct curseg_info *curseg, int type) in is_next_segment_free() argument
2409 unsigned int segno = curseg->segno + 1; in is_next_segment_free()
2510 struct curseg_info *curseg = CURSEG_I(sbi, type); in reset_curseg() local
2512 unsigned short seg_type = curseg->seg_type; in reset_curseg()
2514 curseg->inited = true; in reset_curseg()
2515 curseg->segno = curseg->next_segno; in reset_curseg()
2516 curseg->zone = GET_ZONE_FROM_SEG(sbi, curseg->segno); in reset_curseg()
2517 curseg->next_blkoff = 0; in reset_curseg()
2518 curseg->next_segno = NULL_SEGNO; in reset_curseg()
2520 sum_footer = &(curseg->sum_blk->footer); in reset_curseg()
2529 __set_sit_entry_type(sbi, seg_type, curseg->segno, modified); in reset_curseg()
2534 struct curseg_info *curseg = CURSEG_I(sbi, type); in __get_next_segno() local
2535 unsigned short seg_type = curseg->seg_type; in __get_next_segno()
2543 return curseg->segno; in __get_next_segno()
2546 if (!curseg->inited) in __get_next_segno()
2563 return curseg->segno; in __get_next_segno()
2572 struct curseg_info *curseg = CURSEG_I(sbi, type); in new_curseg() local
2573 unsigned short seg_type = curseg->seg_type; in new_curseg()
2574 unsigned int segno = curseg->segno; in new_curseg()
2577 if (curseg->inited) in new_curseg()
2578 write_sum_page(sbi, curseg->sum_blk, in new_curseg()
2588 curseg->next_segno = segno; in new_curseg()
2590 curseg->alloc_type = LFS; in new_curseg()
2592 curseg->fragment_remained_chunk = in new_curseg()
2650 struct curseg_info *curseg = CURSEG_I(sbi, type); in change_curseg() local
2651 unsigned int new_segno = curseg->next_segno; in change_curseg()
2656 write_sum_page(sbi, curseg->sum_blk, in change_curseg()
2657 GET_SUM_BLOCK(sbi, curseg->segno)); in change_curseg()
2667 curseg->alloc_type = SSR; in change_curseg()
2668 curseg->next_blkoff = __next_free_blkoff(sbi, curseg->segno, 0); in change_curseg()
2673 memset(curseg->sum_blk, 0, SUM_ENTRY_SIZE); in change_curseg()
2677 memcpy(curseg->sum_blk, sum_node, SUM_ENTRY_SIZE); in change_curseg()
2688 struct curseg_info *curseg = CURSEG_I(sbi, type); in get_atssr_segment() local
2690 curseg->seg_type = target_type; in get_atssr_segment()
2693 struct seg_entry *se = get_seg_entry(sbi, curseg->next_segno); in get_atssr_segment()
2695 curseg->seg_type = se->type; in get_atssr_segment()
2699 curseg->seg_type = CURSEG_COLD_DATA; in get_atssr_segment()
2702 stat_inc_seg_type(sbi, curseg); in get_atssr_segment()
2707 struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_ALL_DATA_ATGC); in __f2fs_init_atgc_curseg() local
2714 mutex_lock(&curseg->curseg_mutex); in __f2fs_init_atgc_curseg()
2720 mutex_unlock(&curseg->curseg_mutex); in __f2fs_init_atgc_curseg()
2732 struct curseg_info *curseg = CURSEG_I(sbi, type); in __f2fs_save_inmem_curseg() local
2734 mutex_lock(&curseg->curseg_mutex); in __f2fs_save_inmem_curseg()
2735 if (!curseg->inited) in __f2fs_save_inmem_curseg()
2738 if (get_valid_blocks(sbi, curseg->segno, false)) { in __f2fs_save_inmem_curseg()
2739 write_sum_page(sbi, curseg->sum_blk, in __f2fs_save_inmem_curseg()
2740 GET_SUM_BLOCK(sbi, curseg->segno)); in __f2fs_save_inmem_curseg()
2743 __set_test_and_free(sbi, curseg->segno, true); in __f2fs_save_inmem_curseg()
2747 mutex_unlock(&curseg->curseg_mutex); in __f2fs_save_inmem_curseg()
2760 struct curseg_info *curseg = CURSEG_I(sbi, type); in __f2fs_restore_inmem_curseg() local
2762 mutex_lock(&curseg->curseg_mutex); in __f2fs_restore_inmem_curseg()
2763 if (!curseg->inited) in __f2fs_restore_inmem_curseg()
2765 if (get_valid_blocks(sbi, curseg->segno, false)) in __f2fs_restore_inmem_curseg()
2769 __set_test_and_inuse(sbi, curseg->segno); in __f2fs_restore_inmem_curseg()
2772 mutex_unlock(&curseg->curseg_mutex); in __f2fs_restore_inmem_curseg()
2786 struct curseg_info *curseg = CURSEG_I(sbi, type); in get_ssr_segment() local
2789 unsigned short seg_type = curseg->seg_type; in get_ssr_segment()
2797 curseg->next_segno = segno; in get_ssr_segment()
2824 curseg->next_segno = segno; in get_ssr_segment()
2833 curseg->next_segno = segno; in get_ssr_segment()
2847 struct curseg_info *curseg = CURSEG_I(sbi, type); in allocate_segment_by_default() local
2852 curseg->seg_type == CURSEG_WARM_NODE) in allocate_segment_by_default()
2854 else if (curseg->alloc_type == LFS && in allocate_segment_by_default()
2855 is_next_segment_free(sbi, curseg, type) && in allocate_segment_by_default()
2864 stat_inc_seg_type(sbi, curseg); in allocate_segment_by_default()
2870 struct curseg_info *curseg = CURSEG_I(sbi, type); in f2fs_allocate_segment_for_resize() local
2874 mutex_lock(&curseg->curseg_mutex); in f2fs_allocate_segment_for_resize()
2886 stat_inc_seg_type(sbi, curseg); in f2fs_allocate_segment_for_resize()
2892 if (segno != curseg->segno) in f2fs_allocate_segment_for_resize()
2894 type, segno, curseg->segno); in f2fs_allocate_segment_for_resize()
2896 mutex_unlock(&curseg->curseg_mutex); in f2fs_allocate_segment_for_resize()
2903 struct curseg_info *curseg = CURSEG_I(sbi, type); in __allocate_new_segment() local
2906 if (!curseg->inited) in __allocate_new_segment()
2909 if (force || curseg->next_blkoff || in __allocate_new_segment()
2910 get_valid_blocks(sbi, curseg->segno, new_sec)) in __allocate_new_segment()
2913 if (!get_ckpt_valid_blocks(sbi, curseg->segno, new_sec)) in __allocate_new_segment()
2916 old_segno = curseg->segno; in __allocate_new_segment()
3114 struct curseg_info *curseg) in __has_curseg_space() argument
3116 return curseg->next_blkoff < f2fs_usable_blks_in_seg(sbi, in __has_curseg_space()
3117 curseg->segno); in __has_curseg_space()
3221 struct curseg_info *curseg = CURSEG_I(sbi, type); in f2fs_allocate_data_block() local
3228 mutex_lock(&curseg->curseg_mutex); in f2fs_allocate_data_block()
3237 *new_blkaddr = NEXT_FREE_BLKADDR(sbi, curseg); in f2fs_allocate_data_block()
3239 f2fs_bug_on(sbi, curseg->next_blkoff >= sbi->blocks_per_seg); in f2fs_allocate_data_block()
3250 __refresh_next_blkoff(sbi, curseg); in f2fs_allocate_data_block()
3252 stat_inc_block_count(sbi, curseg); in f2fs_allocate_data_block()
3270 if (!__has_curseg_space(sbi, curseg)) { in f2fs_allocate_data_block()
3288 fill_node_footer_blkaddr(page, NEXT_FREE_BLKADDR(sbi, curseg)); in f2fs_allocate_data_block()
3307 mutex_unlock(&curseg->curseg_mutex); in f2fs_allocate_data_block()
3492 struct curseg_info *curseg; in f2fs_do_replace_block() local
3524 curseg = CURSEG_I(sbi, type); in f2fs_do_replace_block()
3526 mutex_lock(&curseg->curseg_mutex); in f2fs_do_replace_block()
3529 old_cursegno = curseg->segno; in f2fs_do_replace_block()
3530 old_blkoff = curseg->next_blkoff; in f2fs_do_replace_block()
3531 old_alloc_type = curseg->alloc_type; in f2fs_do_replace_block()
3534 if (segno != curseg->segno) { in f2fs_do_replace_block()
3535 curseg->next_segno = segno; in f2fs_do_replace_block()
3539 curseg->next_blkoff = GET_BLKOFF_FROM_SEG0(sbi, new_blkaddr); in f2fs_do_replace_block()
3562 if (old_cursegno != curseg->segno) { in f2fs_do_replace_block()
3563 curseg->next_segno = old_cursegno; in f2fs_do_replace_block()
3566 curseg->next_blkoff = old_blkoff; in f2fs_do_replace_block()
3567 curseg->alloc_type = old_alloc_type; in f2fs_do_replace_block()
3571 mutex_unlock(&curseg->curseg_mutex); in f2fs_do_replace_block()
3711 struct curseg_info *curseg; in read_normal_summaries() local
3761 curseg = CURSEG_I(sbi, type); in read_normal_summaries()
3762 mutex_lock(&curseg->curseg_mutex); in read_normal_summaries()
3765 down_write(&curseg->journal_rwsem); in read_normal_summaries()
3766 memcpy(curseg->journal, &sum->journal, SUM_JOURNAL_SIZE); in read_normal_summaries()
3767 up_write(&curseg->journal_rwsem); in read_normal_summaries()
3769 memcpy(curseg->sum_blk->entries, sum->entries, SUM_ENTRY_SIZE); in read_normal_summaries()
3770 memcpy(&curseg->sum_blk->footer, &sum->footer, SUM_FOOTER_SIZE); in read_normal_summaries()
3771 curseg->next_segno = segno; in read_normal_summaries()
3773 curseg->alloc_type = ckpt->alloc_type[type]; in read_normal_summaries()
3774 curseg->next_blkoff = blk_off; in read_normal_summaries()
3775 mutex_unlock(&curseg->curseg_mutex); in read_normal_summaries()
4024 struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_COLD_DATA); in remove_sits_in_journal() local
4025 struct f2fs_journal *journal = curseg->journal; in remove_sits_in_journal()
4028 down_write(&curseg->journal_rwsem); in remove_sits_in_journal()
4040 up_write(&curseg->journal_rwsem); in remove_sits_in_journal()
4051 struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_COLD_DATA); in f2fs_flush_sit_entries() local
4052 struct f2fs_journal *journal = curseg->journal; in f2fs_flush_sit_entries()
4096 down_write(&curseg->journal_rwsem); in f2fs_flush_sit_entries()
4143 up_write(&curseg->journal_rwsem); in f2fs_flush_sit_entries()
4348 struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_COLD_DATA); in build_sit_entries() local
4349 struct f2fs_journal *journal = curseg->journal; in build_sit_entries()
4414 down_read(&curseg->journal_rwsem); in build_sit_entries()
4467 up_read(&curseg->journal_rwsem); in build_sit_entries()
4621 struct curseg_info *curseg = CURSEG_I(sbi, i); in sanity_check_curseg() local
4622 struct seg_entry *se = get_seg_entry(sbi, curseg->segno); in sanity_check_curseg()
4623 unsigned int blkofs = curseg->next_blkoff; in sanity_check_curseg()
4629 sanity_check_seg_type(sbi, curseg->seg_type); in sanity_check_curseg()
4631 if (curseg->alloc_type != LFS && curseg->alloc_type != SSR) { in sanity_check_curseg()
4634 curseg->alloc_type); in sanity_check_curseg()
4642 if (curseg->alloc_type == SSR) in sanity_check_curseg()
4651 i, curseg->segno, curseg->alloc_type, in sanity_check_curseg()
4652 curseg->next_blkoff, blkofs); in sanity_check_curseg()