lkml.org 
[lkml]   [2018]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 4.18 038/131] f2fs: do not set free of current section
    Date
    From: Yunlong Song <yunlong.song@huawei.com>

    [ Upstream commit 3611ce9911267cb93d364bd71ddea6821278d11f ]

    For the case when sbi->segs_per_sec > 1, take section:segment = 5 for
    example, if segment 1 is just used and allocate new segment 2, and the
    blocks of segment 1 is invalidated, at this time, the previous code will
    use __set_test_and_free to free the free_secmap and free_sections++,
    this is not correct since it is still a current section, so fix it.

    Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
    Reviewed-by: Chao Yu <yuchao0@huawei.com>
    Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    ---
    fs/f2fs/segment.h | 3 +++
    1 file changed, 3 insertions(+)

    diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
    index f18fc82fbe99..38c549d77a80 100644
    --- a/fs/f2fs/segment.h
    +++ b/fs/f2fs/segment.h
    @@ -448,6 +448,8 @@ static inline void __set_test_and_free(struct f2fs_sb_info *sbi,
    if (test_and_clear_bit(segno, free_i->free_segmap)) {
    free_i->free_segments++;

    + if (IS_CURSEC(sbi, secno))
    + goto skip_free;
    next = find_next_bit(free_i->free_segmap,
    start_segno + sbi->segs_per_sec, start_segno);
    if (next >= start_segno + sbi->segs_per_sec) {
    @@ -455,6 +457,7 @@ static inline void __set_test_and_free(struct f2fs_sb_info *sbi,
    free_i->free_sections++;
    }
    }
    +skip_free:
    spin_unlock(&free_i->segmap_lock);
    }

    --
    2.17.1
    \
     
     \ /
      Last update: 2018-09-02 15:35    [W:4.206 / U:0.384 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site