Lines Matching defs:curseg

2562 	struct curseg_info *curseg = CURSEG_I(sbi, type);
2566 return curseg->next_blkoff;
2624 struct curseg_info *curseg = CURSEG_I(sbi, type);
2626 struct f2fs_summary_block *src = curseg->sum_blk;
2632 mutex_lock(&curseg->curseg_mutex);
2634 down_read(&curseg->journal_rwsem);
2635 memcpy(&dst->journal, curseg->journal, SUM_JOURNAL_SIZE);
2636 up_read(&curseg->journal_rwsem);
2641 mutex_unlock(&curseg->curseg_mutex);
2648 struct curseg_info *curseg, int type)
2650 unsigned int segno = curseg->segno + 1;
2754 struct curseg_info *curseg = CURSEG_I(sbi, type);
2756 unsigned short seg_type = curseg->seg_type;
2759 if (curseg->next_segno == NULL_SEGNO)
2762 curseg->inited = true;
2763 curseg->segno = curseg->next_segno;
2764 curseg->zone = GET_ZONE_FROM_SEG(sbi, curseg->segno);
2765 curseg->next_blkoff = 0;
2766 curseg->next_segno = NULL_SEGNO;
2768 sum_footer = &(curseg->sum_blk->footer);
2777 __set_sit_entry_type(sbi, seg_type, curseg->segno, modified);
2782 struct curseg_info *curseg = CURSEG_I(sbi, type);
2783 unsigned short seg_type = curseg->seg_type;
2790 return curseg->segno;
2793 if (!curseg->inited)
2809 return curseg->segno;
2818 struct curseg_info *curseg = CURSEG_I(sbi, type);
2819 unsigned int segno = curseg->segno;
2823 if (curseg->inited)
2824 write_sum_page(sbi, curseg->sum_blk, GET_SUM_BLOCK(sbi, segno));
2830 curseg->segno = NULL_SEGNO;
2834 curseg->next_segno = segno;
2836 curseg->alloc_type = LFS;
2838 curseg->fragment_remained_chunk =
2877 struct curseg_info *curseg = CURSEG_I(sbi, type);
2878 unsigned int new_segno = curseg->next_segno;
2882 write_sum_page(sbi, curseg->sum_blk, GET_SUM_BLOCK(sbi, curseg->segno));
2892 curseg->alloc_type = SSR;
2893 curseg->next_blkoff = __next_free_blkoff(sbi, curseg->segno, 0);
2898 memset(curseg->sum_blk, 0, SUM_ENTRY_SIZE);
2902 memcpy(curseg->sum_blk, sum_node, SUM_ENTRY_SIZE);
2914 struct curseg_info *curseg = CURSEG_I(sbi, type);
2917 curseg->seg_type = target_type;
2920 struct seg_entry *se = get_seg_entry(sbi, curseg->next_segno);
2922 curseg->seg_type = se->type;
2926 curseg->seg_type = CURSEG_COLD_DATA;
2929 stat_inc_seg_type(sbi, curseg);
2935 struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_ALL_DATA_ATGC);
2943 mutex_lock(&curseg->curseg_mutex);
2950 mutex_unlock(&curseg->curseg_mutex);
2962 struct curseg_info *curseg = CURSEG_I(sbi, type);
2964 mutex_lock(&curseg->curseg_mutex);
2965 if (!curseg->inited)
2968 if (get_valid_blocks(sbi, curseg->segno, false)) {
2969 write_sum_page(sbi, curseg->sum_blk,
2970 GET_SUM_BLOCK(sbi, curseg->segno));
2973 __set_test_and_free(sbi, curseg->segno, true);
2977 mutex_unlock(&curseg->curseg_mutex);
2990 struct curseg_info *curseg = CURSEG_I(sbi, type);
2992 mutex_lock(&curseg->curseg_mutex);
2993 if (!curseg->inited)
2995 if (get_valid_blocks(sbi, curseg->segno, false))
2999 __set_test_and_inuse(sbi, curseg->segno);
3002 mutex_unlock(&curseg->curseg_mutex);
3016 struct curseg_info *curseg = CURSEG_I(sbi, type);
3018 unsigned short seg_type = curseg->seg_type;
3026 curseg->next_segno = segno;
3053 curseg->next_segno = segno;
3062 curseg->next_segno = segno;
3071 struct curseg_info *curseg = CURSEG_I(sbi, type);
3074 curseg->seg_type == CURSEG_WARM_NODE)
3076 if (curseg->alloc_type == LFS &&
3077 is_next_segment_free(sbi, curseg, type) &&
3088 struct curseg_info *curseg = CURSEG_I(sbi, type);
3093 mutex_lock(&curseg->curseg_mutex);
3105 stat_inc_seg_type(sbi, curseg);
3111 if (segno != curseg->segno)
3112 f2fs_notice(sbi, "For resize: curseg of type %d: %u ==> %u",
3113 type, segno, curseg->segno);
3115 mutex_unlock(&curseg->curseg_mutex);
3123 struct curseg_info *curseg = CURSEG_I(sbi, type);
3127 if (type == CURSEG_COLD_DATA_PINNED && !curseg->inited)
3130 if (!force && curseg->inited &&
3131 !curseg->next_blkoff &&
3132 !get_valid_blocks(sbi, curseg->segno, new_sec) &&
3133 !get_ckpt_valid_blocks(sbi, curseg->segno, new_sec))
3137 old_segno = curseg->segno;
3141 stat_inc_seg_type(sbi, curseg);
3486 static void reset_curseg_fields(struct curseg_info *curseg)
3488 curseg->inited = false;
3489 curseg->segno = NULL_SEGNO;
3490 curseg->next_segno = 0;
3499 struct curseg_info *curseg = CURSEG_I(sbi, type);
3508 mutex_lock(&curseg->curseg_mutex);
3511 if (curseg->segno == NULL_SEGNO) {
3522 *new_blkaddr = NEXT_FREE_BLKADDR(sbi, curseg);
3524 f2fs_bug_on(sbi, curseg->next_blkoff >= BLKS_PER_SEG(sbi));
3528 curseg->sum_blk->entries[curseg->next_blkoff] = *sum;
3529 if (curseg->alloc_type == SSR) {
3530 curseg->next_blkoff = f2fs_find_next_ssr_block(sbi, curseg);
3532 curseg->next_blkoff++;
3534 f2fs_randomize_chunk(sbi, curseg);
3536 if (curseg->next_blkoff >= f2fs_usable_blks_in_seg(sbi, curseg->segno))
3538 stat_inc_block_count(sbi, curseg);
3561 !((curseg->segno + 1) % sbi->segs_per_sec)) {
3562 reset_curseg_fields(curseg);
3574 stat_inc_seg_type(sbi, curseg);
3590 if (IS_DATASEG(curseg->seg_type))
3595 if (page && IS_NODESEG(curseg->seg_type)) {
3596 fill_node_footer_blkaddr(page, NEXT_FREE_BLKADDR(sbi, curseg));
3612 mutex_unlock(&curseg->curseg_mutex);
3618 mutex_unlock(&curseg->curseg_mutex);
3805 struct curseg_info *curseg;
3837 curseg = CURSEG_I(sbi, type);
3839 mutex_lock(&curseg->curseg_mutex);
3842 old_cursegno = curseg->segno;
3843 old_blkoff = curseg->next_blkoff;
3844 old_alloc_type = curseg->alloc_type;
3847 if (segno != curseg->segno) {
3848 curseg->next_segno = segno;
3853 curseg->next_blkoff = GET_BLKOFF_FROM_SEG0(sbi, new_blkaddr);
3854 curseg->sum_blk->entries[curseg->next_blkoff] = *sum;
3874 if (old_cursegno != curseg->segno) {
3875 curseg->next_segno = old_cursegno;
3879 curseg->next_blkoff = old_blkoff;
3880 curseg->alloc_type = old_alloc_type;
3885 mutex_unlock(&curseg->curseg_mutex);
4025 struct curseg_info *curseg;
4074 /* set uncompleted segment to curseg */
4075 curseg = CURSEG_I(sbi, type);
4076 mutex_lock(&curseg->curseg_mutex);
4079 down_write(&curseg->journal_rwsem);
4080 memcpy(curseg->journal, &sum->journal, SUM_JOURNAL_SIZE);
4081 up_write(&curseg->journal_rwsem);
4083 memcpy(curseg->sum_blk->entries, sum->entries, SUM_ENTRY_SIZE);
4084 memcpy(&curseg->sum_blk->footer, &sum->footer, SUM_FOOTER_SIZE);
4085 curseg->next_segno = segno;
4087 curseg->alloc_type = ckpt->alloc_type[type];
4088 curseg->next_blkoff = blk_off;
4089 mutex_unlock(&curseg->curseg_mutex);
4331 struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_COLD_DATA);
4332 struct f2fs_journal *journal = curseg->journal;
4335 down_write(&curseg->journal_rwsem);
4347 up_write(&curseg->journal_rwsem);
4358 struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_COLD_DATA);
4359 struct f2fs_journal *journal = curseg->journal;
4403 down_write(&curseg->journal_rwsem);
4450 up_write(&curseg->journal_rwsem);
4650 struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_COLD_DATA);
4651 struct f2fs_journal *journal = curseg->journal;
4715 down_read(&curseg->journal_rwsem);
4768 up_read(&curseg->journal_rwsem);
4918 * In LFS/SSR curseg, .next_blkoff should point to an unused blkaddr;
4919 * In LFS curseg, all blkaddr after .next_blkoff should be unused.
4922 struct curseg_info *curseg = CURSEG_I(sbi, i);
4923 struct seg_entry *se = get_seg_entry(sbi, curseg->segno);
4924 unsigned int blkofs = curseg->next_blkoff;
4930 sanity_check_seg_type(sbi, curseg->seg_type);
4932 if (curseg->alloc_type != LFS && curseg->alloc_type != SSR) {
4935 curseg->alloc_type);
4943 if (curseg->alloc_type == SSR)
4952 i, curseg->segno, curseg->alloc_type,
4953 curseg->next_blkoff, blkofs);
5094 /* report zone for the sector the curseg points to */
5122 f2fs_notice(sbi, "Unaligned curseg[%d] with write pointer: "
5123 "curseg[0x%x,0x%x] wp[0x%x,0x%x]", type, cs->segno,
5132 f2fs_notice(sbi, "Assign new section to curseg[%d]: "
5138 /* check consistency of the zone curseg pointed to */
5165 "New zone for curseg[%d] is not yet discarded. "
5166 "Reset the zone: curseg[0x%x,0x%x]",