f2fs: fix heap mode to reset it back
authorYunlong Song <yunlong.song@huawei.com>
Mon, 29 Jan 2018 03:37:45 +0000 (11:37 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Apr 2018 06:56:20 +0000 (08:56 +0200)
commit b94929d975c8423defc9aededb0f499ff936b509 upstream.

Commit 7a20b8a61eff81bdb7097a578752a74860e9d142 ("f2fs: allocate node
and hot data in the beginning of partition") introduces another mount
option, heap, to reset it back. But it does not do anything for heap
mode, so fix it.

Cc: stable@vger.kernel.org
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/f2fs/gc.c
fs/f2fs/segment.c

index bfe6a8ccc3a0207d51e0f11878de931958b699c1..d5021ba69e7a0c78b1d740e04fa13e188cdcf3c7 100644 (file)
@@ -191,8 +191,9 @@ static void select_policy(struct f2fs_sb_info *sbi, int gc_type,
        if (gc_type != FG_GC && p->max_search > sbi->max_victim_search)
                p->max_search = sbi->max_victim_search;
 
-       /* let's select beginning hot/small space first */
-       if (type == CURSEG_HOT_DATA || IS_NODESEG(type))
+       /* let's select beginning hot/small space first in no_heap mode*/
+       if (test_opt(sbi, NOHEAP) &&
+               (type == CURSEG_HOT_DATA || IS_NODESEG(type)))
                p->offset = 0;
        else
                p->offset = SIT_I(sbi)->last_victim[p->gc_mode];
index c695ff462ee6990f1abd4d27458b9ad4bf89c025..271516db89394d44eec5d8987800062e5298acde 100644 (file)
@@ -1992,7 +1992,8 @@ static unsigned int __get_next_segno(struct f2fs_sb_info *sbi, int type)
        if (sbi->segs_per_sec != 1)
                return CURSEG_I(sbi, type)->segno;
 
-       if (type == CURSEG_HOT_DATA || IS_NODESEG(type))
+       if (test_opt(sbi, NOHEAP) &&
+               (type == CURSEG_HOT_DATA || IS_NODESEG(type)))
                return 0;
 
        if (SIT_I(sbi)->last_victim[ALLOC_NEXT])