summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.h
diff options
context:
space:
mode:
authorJack Qiu <jack.qiu@huawei.com>2020-06-18 12:37:10 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2020-06-18 12:35:38 -0700
commitda52f8ade40b032eb8111a0fd514c8ac5f8f0f1b (patch)
tree26735801a071d7434e511a417cc7a8b132c2fd5f /fs/f2fs/segment.h
parentdb5ae363292705d52c5b653d5079a07a6417ef4c (diff)
downloadlinux-stable-da52f8ade40b032eb8111a0fd514c8ac5f8f0f1b.tar.gz
linux-stable-da52f8ade40b032eb8111a0fd514c8ac5f8f0f1b.tar.bz2
linux-stable-da52f8ade40b032eb8111a0fd514c8ac5f8f0f1b.zip
f2fs: get the right gc victim section when section has several segments
Assume each section has 4 segment: .___________________________. |_Segment0_|_..._|_Segment3_| . . . . .__________. |_section0_| Segment 0~2 has 0 valid block, segment 3 has 512 valid blocks. It will fail if we want to gc section0 in this scenes, because all 4 segments in section0 is not dirty. So we should use dirty section bitmap instead of dirty segment bitmap to get right victim section. Signed-off-by: Jack Qiu <jack.qiu@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.h')
-rw-r--r--fs/f2fs/segment.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index cba16cca5189..f261e3e6a69b 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -166,8 +166,11 @@ enum {
struct victim_sel_policy {
int alloc_mode; /* LFS or SSR */
int gc_mode; /* GC_CB or GC_GREEDY */
- unsigned long *dirty_segmap; /* dirty segment bitmap */
- unsigned int max_search; /* maximum # of segments to search */
+ unsigned long *dirty_bitmap; /* dirty segment/section bitmap */
+ unsigned int max_search; /*
+ * maximum # of segments/sections
+ * to search
+ */
unsigned int offset; /* last scanned bitmap offset */
unsigned int ofs_unit; /* bitmap search unit */
unsigned int min_cost; /* minimum cost */
@@ -266,6 +269,7 @@ enum dirty_type {
struct dirty_seglist_info {
const struct victim_selection *v_ops; /* victim selction operation */
unsigned long *dirty_segmap[NR_DIRTY_TYPE];
+ unsigned long *dirty_secmap;
struct mutex seglist_lock; /* lock for segment bitmaps */
int nr_dirty[NR_DIRTY_TYPE]; /* # of dirty segments */
unsigned long *victim_secmap; /* background GC victims */