Commit 59367f36 authored by Yongpeng Yang's avatar Yongpeng Yang Committed by Treehugger Robot
Browse files

UPSTREAM: f2fs: The GC triggered by ioctl also needs to mark the segno as victim



In SSR mode, the segment selected for allocation might be the same as
the target segment of the GC triggered by ioctl, resulting in the GC
moving the CURSEG_I(sbi, type)->segno.
Thread A				Thread B or Thread A
- f2fs_ioc_gc_range
 - __f2fs_ioc_gc_range(.victim_segno=segno#N)
  - f2fs_gc
   - __get_victim
    - f2fs_get_victim
    : segno#N is valid, return segno#N as source segment of GC
					- f2fs_allocate_data_block
						- need_new_seg
						- get_ssr_segment
						- f2fs_get_victim
						: get segno #N as destination segment
						- change_curseg

Fixes: e066b83c ("f2fs: add ioctl to flush data from faster device to cold area")
Change-Id: I715be25c6e8c59469f8ad6e0d8f49c8b8655d5b3
Signed-off-by: default avatarYongpeng Yang <yangyongpeng1@oppo.com>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit e9a844f6)
parent d01006bd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment