From: Yangtao Li <frank.li@vivo.com> To: jaegeuk@kernel.org, chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: Yangtao Li <frank.li@vivo.com> Subject: [PATCH] f2fs: set prefree as free segments after clear prefree segments Date: Thu, 22 Apr 2021 20:59:10 +0800 [thread overview] Message-ID: <20210422125910.127871-1-frank.li@vivo.com> (raw) For now, when do_checkpoint fails, the prefree bitmap is not cleared, but these segments are already in the free state. If these segments are used, the segments in use will be reset to the free state when f2fs_clear_prefree_segments is called next time. So move set_prefree_as_free_segments after clear_prefree_segments. Signed-off-by: Yangtao Li <frank.li@vivo.com> --- fs/f2fs/segment.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index c2866561263e..ea1334e17a0d 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1945,20 +1945,6 @@ void f2fs_release_discard_addrs(struct f2fs_sb_info *sbi) release_discard_addr(entry); } -/* - * Should call f2fs_clear_prefree_segments after checkpoint is done. - */ -static void set_prefree_as_free_segments(struct f2fs_sb_info *sbi) -{ - struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); - unsigned int segno; - - mutex_lock(&dirty_i->seglist_lock); - for_each_set_bit(segno, dirty_i->dirty_segmap[PRE], MAIN_SEGS(sbi)) - __set_test_and_free(sbi, segno, false); - mutex_unlock(&dirty_i->seglist_lock); -} - void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi, struct cp_control *cpc) { @@ -1993,6 +1979,7 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi, for (i = start; i < end; i++) { if (test_and_clear_bit(i, prefree_map)) dirty_i->nr_dirty[PRE]--; + __set_test_and_free(sbi, i, false); } if (!f2fs_realtime_discard_enable(sbi)) @@ -4188,8 +4175,6 @@ void f2fs_flush_sit_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc) cpc->trim_start = trim_start; } up_write(&sit_i->sentry_lock); - - set_prefree_as_free_segments(sbi); } static int build_sit_info(struct f2fs_sb_info *sbi) -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Yangtao Li <frank.li@vivo.com> To: jaegeuk@kernel.org, chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: Yangtao Li <frank.li@vivo.com> Subject: [f2fs-dev] [PATCH] f2fs: set prefree as free segments after clear prefree segments Date: Thu, 22 Apr 2021 20:59:10 +0800 [thread overview] Message-ID: <20210422125910.127871-1-frank.li@vivo.com> (raw) For now, when do_checkpoint fails, the prefree bitmap is not cleared, but these segments are already in the free state. If these segments are used, the segments in use will be reset to the free state when f2fs_clear_prefree_segments is called next time. So move set_prefree_as_free_segments after clear_prefree_segments. Signed-off-by: Yangtao Li <frank.li@vivo.com> --- fs/f2fs/segment.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index c2866561263e..ea1334e17a0d 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1945,20 +1945,6 @@ void f2fs_release_discard_addrs(struct f2fs_sb_info *sbi) release_discard_addr(entry); } -/* - * Should call f2fs_clear_prefree_segments after checkpoint is done. - */ -static void set_prefree_as_free_segments(struct f2fs_sb_info *sbi) -{ - struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); - unsigned int segno; - - mutex_lock(&dirty_i->seglist_lock); - for_each_set_bit(segno, dirty_i->dirty_segmap[PRE], MAIN_SEGS(sbi)) - __set_test_and_free(sbi, segno, false); - mutex_unlock(&dirty_i->seglist_lock); -} - void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi, struct cp_control *cpc) { @@ -1993,6 +1979,7 @@ void f2fs_clear_prefree_segments(struct f2fs_sb_info *sbi, for (i = start; i < end; i++) { if (test_and_clear_bit(i, prefree_map)) dirty_i->nr_dirty[PRE]--; + __set_test_and_free(sbi, i, false); } if (!f2fs_realtime_discard_enable(sbi)) @@ -4188,8 +4175,6 @@ void f2fs_flush_sit_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc) cpc->trim_start = trim_start; } up_write(&sit_i->sentry_lock); - - set_prefree_as_free_segments(sbi); } static int build_sit_info(struct f2fs_sb_info *sbi) -- 2.25.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next reply other threads:[~2021-04-22 13:08 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-22 12:59 Yangtao Li [this message] 2021-04-22 12:59 ` [f2fs-dev] [PATCH] f2fs: set prefree as free segments after clear prefree segments Yangtao Li 2021-04-23 1:30 ` Chao Yu 2021-04-23 2:40 ` 李扬韬 2021-04-23 3:37 ` Chao Yu 2021-04-23 9:02 ` 李扬韬
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210422125910.127871-1-frank.li@vivo.com \ --to=frank.li@vivo.com \ --cc=chao@kernel.org \ --cc=jaegeuk@kernel.org \ --cc=linux-f2fs-devel@lists.sourceforge.net \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.