Commit c8eb7024 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: clean up kvfree

After commit 0b6d4ca0 ("f2fs: don't return vmalloc() memory from
f2fs_kmalloc()"), f2fs_k{m,z}alloc() will not return vmalloc()'ed
memory, so clean up to use kfree() instead of kvfree() to free
vmalloc()'ed memory.
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 6fcaebac
...@@ -160,7 +160,7 @@ static void *f2fs_acl_to_disk(struct f2fs_sb_info *sbi, ...@@ -160,7 +160,7 @@ static void *f2fs_acl_to_disk(struct f2fs_sb_info *sbi,
return (void *)f2fs_acl; return (void *)f2fs_acl;
fail: fail:
kvfree(f2fs_acl); kfree(f2fs_acl);
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
...@@ -190,7 +190,7 @@ static struct posix_acl *__f2fs_get_acl(struct inode *inode, int type, ...@@ -190,7 +190,7 @@ static struct posix_acl *__f2fs_get_acl(struct inode *inode, int type,
acl = NULL; acl = NULL;
else else
acl = ERR_PTR(retval); acl = ERR_PTR(retval);
kvfree(value); kfree(value);
return acl; return acl;
} }
...@@ -240,7 +240,7 @@ static int __f2fs_set_acl(struct inode *inode, int type, ...@@ -240,7 +240,7 @@ static int __f2fs_set_acl(struct inode *inode, int type,
error = f2fs_setxattr(inode, name_index, "", value, size, ipage, 0); error = f2fs_setxattr(inode, name_index, "", value, size, ipage, 0);
kvfree(value); kfree(value);
if (!error) if (!error)
set_cached_acl(inode, type, acl); set_cached_acl(inode, type, acl);
......
...@@ -3570,7 +3570,7 @@ static void f2fs_dio_end_io(struct bio *bio) ...@@ -3570,7 +3570,7 @@ static void f2fs_dio_end_io(struct bio *bio)
bio->bi_private = dio->orig_private; bio->bi_private = dio->orig_private;
bio->bi_end_io = dio->orig_end_io; bio->bi_end_io = dio->orig_end_io;
kvfree(dio); kfree(dio);
bio_endio(bio); bio_endio(bio);
} }
......
...@@ -574,7 +574,7 @@ void f2fs_destroy_stats(struct f2fs_sb_info *sbi) ...@@ -574,7 +574,7 @@ void f2fs_destroy_stats(struct f2fs_sb_info *sbi)
list_del(&si->stat_list); list_del(&si->stat_list);
mutex_unlock(&f2fs_stat_mutex); mutex_unlock(&f2fs_stat_mutex);
kvfree(si); kfree(si);
} }
void __init f2fs_create_root_stats(void) void __init f2fs_create_root_stats(void)
......
...@@ -3373,7 +3373,7 @@ static int f2fs_ioc_getfslabel(struct file *filp, unsigned long arg) ...@@ -3373,7 +3373,7 @@ static int f2fs_ioc_getfslabel(struct file *filp, unsigned long arg)
min(FSLABEL_MAX, count))) min(FSLABEL_MAX, count)))
err = -EFAULT; err = -EFAULT;
kvfree(vbuf); kfree(vbuf);
return err; return err;
} }
......
...@@ -152,7 +152,7 @@ int f2fs_start_gc_thread(struct f2fs_sb_info *sbi) ...@@ -152,7 +152,7 @@ int f2fs_start_gc_thread(struct f2fs_sb_info *sbi)
"f2fs_gc-%u:%u", MAJOR(dev), MINOR(dev)); "f2fs_gc-%u:%u", MAJOR(dev), MINOR(dev));
if (IS_ERR(gc_th->f2fs_gc_task)) { if (IS_ERR(gc_th->f2fs_gc_task)) {
err = PTR_ERR(gc_th->f2fs_gc_task); err = PTR_ERR(gc_th->f2fs_gc_task);
kvfree(gc_th); kfree(gc_th);
sbi->gc_thread = NULL; sbi->gc_thread = NULL;
} }
out: out:
...@@ -165,7 +165,7 @@ void f2fs_stop_gc_thread(struct f2fs_sb_info *sbi) ...@@ -165,7 +165,7 @@ void f2fs_stop_gc_thread(struct f2fs_sb_info *sbi)
if (!gc_th) if (!gc_th)
return; return;
kthread_stop(gc_th->f2fs_gc_task); kthread_stop(gc_th->f2fs_gc_task);
kvfree(gc_th); kfree(gc_th);
sbi->gc_thread = NULL; sbi->gc_thread = NULL;
} }
......
...@@ -524,7 +524,7 @@ static int f2fs_move_rehashed_dirents(struct inode *dir, struct page *ipage, ...@@ -524,7 +524,7 @@ static int f2fs_move_rehashed_dirents(struct inode *dir, struct page *ipage,
!f2fs_has_inline_xattr(dir)) !f2fs_has_inline_xattr(dir))
F2FS_I(dir)->i_inline_xattr_size = 0; F2FS_I(dir)->i_inline_xattr_size = 0;
kvfree(backup_dentry); kfree(backup_dentry);
return 0; return 0;
recover: recover:
lock_page(ipage); lock_page(ipage);
...@@ -535,7 +535,7 @@ static int f2fs_move_rehashed_dirents(struct inode *dir, struct page *ipage, ...@@ -535,7 +535,7 @@ static int f2fs_move_rehashed_dirents(struct inode *dir, struct page *ipage,
set_page_dirty(ipage); set_page_dirty(ipage);
f2fs_put_page(ipage, 1); f2fs_put_page(ipage, 1);
kvfree(backup_dentry); kfree(backup_dentry);
return err; return err;
} }
......
...@@ -707,7 +707,7 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry, ...@@ -707,7 +707,7 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
f2fs_handle_failed_inode(inode); f2fs_handle_failed_inode(inode);
out_free_encrypted_link: out_free_encrypted_link:
if (disk_link.name != (unsigned char *)symname) if (disk_link.name != (unsigned char *)symname)
kvfree(disk_link.name); kfree(disk_link.name);
return err; return err;
} }
......
...@@ -3257,7 +3257,7 @@ void f2fs_destroy_node_manager(struct f2fs_sb_info *sbi) ...@@ -3257,7 +3257,7 @@ void f2fs_destroy_node_manager(struct f2fs_sb_info *sbi)
kvfree(nm_i->nat_bitmap_mir); kvfree(nm_i->nat_bitmap_mir);
#endif #endif
sbi->nm_info = NULL; sbi->nm_info = NULL;
kvfree(nm_i); kfree(nm_i);
} }
int __init f2fs_create_node_manager_caches(void) int __init f2fs_create_node_manager_caches(void)
......
...@@ -728,7 +728,7 @@ int f2fs_create_flush_cmd_control(struct f2fs_sb_info *sbi) ...@@ -728,7 +728,7 @@ int f2fs_create_flush_cmd_control(struct f2fs_sb_info *sbi)
"f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev)); "f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev));
if (IS_ERR(fcc->f2fs_issue_flush)) { if (IS_ERR(fcc->f2fs_issue_flush)) {
err = PTR_ERR(fcc->f2fs_issue_flush); err = PTR_ERR(fcc->f2fs_issue_flush);
kvfree(fcc); kfree(fcc);
SM_I(sbi)->fcc_info = NULL; SM_I(sbi)->fcc_info = NULL;
return err; return err;
} }
...@@ -747,7 +747,7 @@ void f2fs_destroy_flush_cmd_control(struct f2fs_sb_info *sbi, bool free) ...@@ -747,7 +747,7 @@ void f2fs_destroy_flush_cmd_control(struct f2fs_sb_info *sbi, bool free)
kthread_stop(flush_thread); kthread_stop(flush_thread);
} }
if (free) { if (free) {
kvfree(fcc); kfree(fcc);
SM_I(sbi)->fcc_info = NULL; SM_I(sbi)->fcc_info = NULL;
} }
} }
...@@ -2105,7 +2105,7 @@ static int create_discard_cmd_control(struct f2fs_sb_info *sbi) ...@@ -2105,7 +2105,7 @@ static int create_discard_cmd_control(struct f2fs_sb_info *sbi)
"f2fs_discard-%u:%u", MAJOR(dev), MINOR(dev)); "f2fs_discard-%u:%u", MAJOR(dev), MINOR(dev));
if (IS_ERR(dcc->f2fs_issue_discard)) { if (IS_ERR(dcc->f2fs_issue_discard)) {
err = PTR_ERR(dcc->f2fs_issue_discard); err = PTR_ERR(dcc->f2fs_issue_discard);
kvfree(dcc); kfree(dcc);
SM_I(sbi)->dcc_info = NULL; SM_I(sbi)->dcc_info = NULL;
return err; return err;
} }
...@@ -2129,7 +2129,7 @@ static void destroy_discard_cmd_control(struct f2fs_sb_info *sbi) ...@@ -2129,7 +2129,7 @@ static void destroy_discard_cmd_control(struct f2fs_sb_info *sbi)
if (unlikely(atomic_read(&dcc->discard_cmd_cnt))) if (unlikely(atomic_read(&dcc->discard_cmd_cnt)))
f2fs_issue_discard_timeout(sbi); f2fs_issue_discard_timeout(sbi);
kvfree(dcc); kfree(dcc);
SM_I(sbi)->dcc_info = NULL; SM_I(sbi)->dcc_info = NULL;
} }
...@@ -5151,7 +5151,7 @@ static void destroy_dirty_segmap(struct f2fs_sb_info *sbi) ...@@ -5151,7 +5151,7 @@ static void destroy_dirty_segmap(struct f2fs_sb_info *sbi)
destroy_victim_secmap(sbi); destroy_victim_secmap(sbi);
SM_I(sbi)->dirty_info = NULL; SM_I(sbi)->dirty_info = NULL;
kvfree(dirty_i); kfree(dirty_i);
} }
static void destroy_curseg(struct f2fs_sb_info *sbi) static void destroy_curseg(struct f2fs_sb_info *sbi)
...@@ -5163,10 +5163,10 @@ static void destroy_curseg(struct f2fs_sb_info *sbi) ...@@ -5163,10 +5163,10 @@ static void destroy_curseg(struct f2fs_sb_info *sbi)
return; return;
SM_I(sbi)->curseg_array = NULL; SM_I(sbi)->curseg_array = NULL;
for (i = 0; i < NR_CURSEG_TYPE; i++) { for (i = 0; i < NR_CURSEG_TYPE; i++) {
kvfree(array[i].sum_blk); kfree(array[i].sum_blk);
kvfree(array[i].journal); kfree(array[i].journal);
} }
kvfree(array); kfree(array);
} }
static void destroy_free_segmap(struct f2fs_sb_info *sbi) static void destroy_free_segmap(struct f2fs_sb_info *sbi)
...@@ -5177,7 +5177,7 @@ static void destroy_free_segmap(struct f2fs_sb_info *sbi) ...@@ -5177,7 +5177,7 @@ static void destroy_free_segmap(struct f2fs_sb_info *sbi)
SM_I(sbi)->free_info = NULL; SM_I(sbi)->free_info = NULL;
kvfree(free_i->free_segmap); kvfree(free_i->free_segmap);
kvfree(free_i->free_secmap); kvfree(free_i->free_secmap);
kvfree(free_i); kfree(free_i);
} }
static void destroy_sit_info(struct f2fs_sb_info *sbi) static void destroy_sit_info(struct f2fs_sb_info *sbi)
...@@ -5189,7 +5189,7 @@ static void destroy_sit_info(struct f2fs_sb_info *sbi) ...@@ -5189,7 +5189,7 @@ static void destroy_sit_info(struct f2fs_sb_info *sbi)
if (sit_i->sentries) if (sit_i->sentries)
kvfree(sit_i->bitmap); kvfree(sit_i->bitmap);
kvfree(sit_i->tmp_map); kfree(sit_i->tmp_map);
kvfree(sit_i->sentries); kvfree(sit_i->sentries);
kvfree(sit_i->sec_entries); kvfree(sit_i->sec_entries);
...@@ -5201,7 +5201,7 @@ static void destroy_sit_info(struct f2fs_sb_info *sbi) ...@@ -5201,7 +5201,7 @@ static void destroy_sit_info(struct f2fs_sb_info *sbi)
kvfree(sit_i->sit_bitmap_mir); kvfree(sit_i->sit_bitmap_mir);
kvfree(sit_i->invalid_segmap); kvfree(sit_i->invalid_segmap);
#endif #endif
kvfree(sit_i); kfree(sit_i);
} }
void f2fs_destroy_segment_manager(struct f2fs_sb_info *sbi) void f2fs_destroy_segment_manager(struct f2fs_sb_info *sbi)
...@@ -5217,7 +5217,7 @@ void f2fs_destroy_segment_manager(struct f2fs_sb_info *sbi) ...@@ -5217,7 +5217,7 @@ void f2fs_destroy_segment_manager(struct f2fs_sb_info *sbi)
destroy_free_segmap(sbi); destroy_free_segmap(sbi);
destroy_sit_info(sbi); destroy_sit_info(sbi);
sbi->sm_info = NULL; sbi->sm_info = NULL;
kvfree(sm_info); kfree(sm_info);
} }
int __init f2fs_create_segment_manager_caches(void) int __init f2fs_create_segment_manager_caches(void)
......
...@@ -39,7 +39,7 @@ static void xattr_free(struct f2fs_sb_info *sbi, void *xattr_addr, ...@@ -39,7 +39,7 @@ static void xattr_free(struct f2fs_sb_info *sbi, void *xattr_addr,
if (is_inline) if (is_inline)
kmem_cache_free(sbi->inline_xattr_slab, xattr_addr); kmem_cache_free(sbi->inline_xattr_slab, xattr_addr);
else else
kvfree(xattr_addr); kfree(xattr_addr);
} }
static int f2fs_xattr_generic_get(const struct xattr_handler *handler, static int f2fs_xattr_generic_get(const struct xattr_handler *handler,
...@@ -425,7 +425,7 @@ static int read_all_xattrs(struct inode *inode, struct page *ipage, ...@@ -425,7 +425,7 @@ static int read_all_xattrs(struct inode *inode, struct page *ipage,
*base_addr = txattr_addr; *base_addr = txattr_addr;
return 0; return 0;
fail: fail:
kvfree(txattr_addr); kfree(txattr_addr);
return err; return err;
} }
...@@ -610,7 +610,7 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) ...@@ -610,7 +610,7 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
} }
error = buffer_size - rest; error = buffer_size - rest;
cleanup: cleanup:
kvfree(base_addr); kfree(base_addr);
return error; return error;
} }
...@@ -750,7 +750,7 @@ static int __f2fs_setxattr(struct inode *inode, int index, ...@@ -750,7 +750,7 @@ static int __f2fs_setxattr(struct inode *inode, int index,
if (!error && S_ISDIR(inode->i_mode)) if (!error && S_ISDIR(inode->i_mode))
set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_CP); set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_CP);
exit: exit:
kvfree(base_addr); kfree(base_addr);
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment