Skip to contentSkip to conversation

f2fs: fix extent cache memory leak

PATCH In review Wanpeng Li 2 participants 3 messages Mar 6, 2015 – Mar 9, 2015

Subsystems (2)
lore
Share & tools
lore

Wanpeng Li

author
#0 lore raw

PATCH 1/2 f2fs: fix extent cache memory leak

extent tree/node slab cache is created during f2fs insmod, how, it isn't destroyed during f2fs rmmod, this patch fix it by destroy extent tree/node slab cache once rmmod f2fs.

---
 fs/f2fs/super.c | 1 +
 1 file changed, 1 insertion(+)
fs/f2fs/super.c +1 -0
index e649f21..0b8a2d8 100644
@@ -1323,6 +1323,7 @@ static void __exit exit_f2fs_fs(void)
 	remove_proc_entry("fs/f2fs", NULL);
 	f2fs_destroy_root_stats();
 	unregister_filesystem(&f2fs_fs_type);
+	destroy_extent_cache();
 	destroy_checkpoint_caches();
 	destroy_segment_manager_caches();
 	destroy_node_manager_caches();
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 2/2 f2fs: reduce searching region of segmap when set free section

In __set_free we will check whether all segment are free in one section when free one segment, in order to set section to free status. But the searching region of segmap is from start segno to last segno of main area, it's not necessary. So let's just only check all segment bitmap of target section.

---
 fs/f2fs/segment.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/segment.h +2 -1
index 7fd3511..85d7fa7 100644
@@ -336,7 +336,8 @@ static inline void __set_free(struct f2fs_sb_info *sbi, unsigned int segno)
 	clear_bit(segno, free_i->free_segmap);
 	free_i->free_segments++;
 
-	next = find_next_bit(free_i->free_segmap, MAIN_SEGS(sbi), start_segno);
+	next = find_next_bit(free_i->free_segmap,
+			start_segno + sbi->segs_per_sec, start_segno);
 	if (next >= start_segno + sbi->segs_per_sec) {
 		clear_bit(secno, free_i->free_secmap);
 		free_i->free_sections++;
Signature · 1 line
1.9.1
Reviewed-by on v1 1/2
#2 lore raw
In reply to Wanpeng Li

Hi Wanpeng,

Quoted 11 lines

-----Original Message-----
From: Wanpeng Li [mailto:[email protected]]
Sent: Friday, March 06, 2015 3:01 PM
To: Jaegeuk Kim
Cc: Changman Lee; Chao Yu; [email protected]; [email protected]; [email protected]; Wanpeng Li
Subject: [PATCH 1/2] f2fs: fix extent cache memory leak

extent tree/node slab cache is created during f2fs insmod, how, it isn't destroyed during f2fs rmmod, this patch fix it by destroy extent tree/node slab cache once rmmod f2fs.

This is my bad, thanks for your catching and fixing.

Quoted 2 lines