From: Haicheng Li Date: Fri, 18 Oct 2013 09:24:08 +0000 (+0800) Subject: f2fs: no need to check other dirty_segmap when the seg has been found X-Git-Tag: firefly_0821_release~176^2~5000^2~24 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=435f2a1b58ac8f50894f23549c97791085f7cba2;p=firefly-linux-kernel-4.4.55.git f2fs: no need to check other dirty_segmap when the seg has been found Because one dirty seg can only be mapped to one dirty_type. Otherwise, it's a bug. Signed-off-by: Haicheng Li [Jaegeuk Kim: modify a comment related to this patch] Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 862fef3ae253..8ac161965242 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -78,10 +78,14 @@ static void __remove_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno, if (dirty_type == DIRTY) { enum dirty_type t = DIRTY_HOT_DATA; - /* clear all the bitmaps */ - for (; t <= DIRTY_COLD_NODE; t++) - if (test_and_clear_bit(segno, dirty_i->dirty_segmap[t])) + /* clear its dirty bitmap */ + for (; t <= DIRTY_COLD_NODE; t++) { + if (test_and_clear_bit(segno, + dirty_i->dirty_segmap[t])) { dirty_i->nr_dirty[t]--; + break; + } + } if (get_valid_blocks(sbi, segno, sbi->segs_per_sec) == 0) clear_bit(GET_SECNO(sbi, segno),