summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2018-04-25 17:38:29 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2018-05-31 11:31:49 -0700
commitaf8ff65bb85df39159944811a241f0dd827f0d76 (patch)
tree1dab331cc47c5a0a4386d48cdb63e9776c984478 /fs/f2fs
parenta9af3fdcc4258af406879eca63d82e9d6baa892e (diff)
downloadlinux-af8ff65bb85df39159944811a241f0dd827f0d76.tar.gz
linux-af8ff65bb85df39159944811a241f0dd827f0d76.tar.bz2
linux-af8ff65bb85df39159944811a241f0dd827f0d76.zip
f2fs: introduce release_discard_addr() for cleanup
Introduce release_discard_addr() to include common codes for cleanup. Signed-off-by: Chao Yu <yuchao0@huawei.com> [Fengguang Wu: declare static function, reported by kbuild test robot] Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/segment.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index fec698d17d6a..916b16e768fb 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1581,16 +1581,20 @@ static bool add_discard_addrs(struct f2fs_sb_info *sbi, struct cp_control *cpc,
return false;
}
+static void release_discard_addr(struct discard_entry *entry)
+{
+ list_del(&entry->list);
+ kmem_cache_free(discard_entry_slab, entry);
+}
+
void release_discard_addrs(struct f2fs_sb_info *sbi)
{
struct list_head *head = &(SM_I(sbi)->dcc_info->entry_list);
struct discard_entry *entry, *this;
/* drop caches */
- list_for_each_entry_safe(entry, this, head, list) {
- list_del(&entry->list);
- kmem_cache_free(discard_entry_slab, entry);
- }
+ list_for_each_entry_safe(entry, this, head, list)
+ release_discard_addr(entry);
}
/*
@@ -1690,9 +1694,8 @@ skip:
if (cur_pos < sbi->blocks_per_seg)
goto find_next;
- list_del(&entry->list);
+ release_discard_addr(entry);
dcc->nr_discards -= total_len;
- kmem_cache_free(discard_entry_slab, entry);
}
wake_up_discard_thread(sbi, false);