Skip to contentSkip to conversation

f2fs: use kfree() to free sbi->gc_thread allocated by f2fs_kmalloc

PATCH In review Jack Qiu 2 participants 2 messages Jul 25, 2020 F2FS file system

lore
Share & tools
lore

Jack Qiu

author
#0 lore raw

PATCH 1/1 f2fs: use kfree() to free sbi->gc_thread allocated by f2fs_kmalloc

Use kfree() instead of kvfree() to free sbi->gc_thread allocated by f2fs_kmalloc(). Because the memory is allocated with kmalloc inside f2fs_kmalloc().

---
 fs/f2fs/gc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/gc.c +2 -2
index 5b95d5a146eb..696ceeedc76d 100644
@@ -147,7 +147,7 @@ int f2fs_start_gc_thread(struct f2fs_sb_info *sbi)
 			"f2fs_gc-%u:%u", MAJOR(dev), MINOR(dev));
 	if (IS_ERR(gc_th->f2fs_gc_task)) {
 		err = PTR_ERR(gc_th->f2fs_gc_task);
-		kvfree(gc_th);
+		kfree(gc_th);
 		sbi->gc_thread = NULL;
 	}
 out:
@@ -160,7 +160,7 @@ void f2fs_stop_gc_thread(struct f2fs_sb_info *sbi)
 	if (!gc_th)
 		return;
 	kthread_stop(gc_th->f2fs_gc_task);
-	kvfree(gc_th);
+	kfree(gc_th);
 	sbi->gc_thread = NULL;
 }
 

--
2.17.1

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#1 lore raw

Hello,

Let's check and do conversion for all possible cases rather than do one by one.

Quoted 36 lines · Jack Qiu

Use kfree() instead of kvfree() to free sbi->gc_thread allocated by f2fs_kmalloc(). Because the memory is allocated with kmalloc inside f2fs_kmalloc().

---
  fs/f2fs/gc.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/gc.c +2 -3
index 5b95d5a146eb..696ceeedc76d 100644
@@ -147,7 +147,7 @@ int f2fs_start_gc_thread(struct f2fs_sb_info *sbi)
  			"f2fs_gc-%u:%u", MAJOR(dev), MINOR(dev));
  	if (IS_ERR(gc_th->f2fs_gc_task)) {
  		err = PTR_ERR(gc_th->f2fs_gc_task);
-		kvfree(gc_th);
+		kfree(gc_th);
  		sbi->gc_thread = NULL;
  	}
  out:
@@ -160,7 +160,7 @@ void f2fs_stop_gc_thread(struct f2fs_sb_info *sbi)
  	if (!gc_th)
  		return;
  	kthread_stop(gc_th->f2fs_gc_task);
-	kvfree(gc_th);
+	kfree(gc_th);
  	sbi->gc_thread = NULL;
  }
 
--

2.17.1

Quoted 6 lines

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel