xfs: convert remaining kmem_free() to kfree()

The remaining callers of kmem_free() are freeing heap memory, so
we can convert them directly to kfree() and get rid of kmem_free()
altogether.

This conversion was done with:

$ for f in `git grep -l kmem_free fs/xfs`; do
> sed -i s/kmem_free/kfree/ $f
> done
$

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
This commit is contained in:
Dave Chinner 2024-01-16 09:59:43 +11:00 committed by Chandan Babu R
parent 4929257613
commit d4c75a1b40
41 changed files with 101 additions and 125 deletions

View File

@ -1,23 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
* All Rights Reserved.
*/
#ifndef __XFS_SUPPORT_KMEM_H__
#define __XFS_SUPPORT_KMEM_H__
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/vmalloc.h>
/*
* General memory allocation interfaces
*/
static inline void kmem_free(const void *ptr)
{
kvfree(ptr);
}
#endif /* __XFS_SUPPORT_KMEM_H__ */

View File

@ -241,7 +241,7 @@ __xfs_free_perag(
struct xfs_perag *pag = container_of(head, struct xfs_perag, rcu_head); struct xfs_perag *pag = container_of(head, struct xfs_perag, rcu_head);
ASSERT(!delayed_work_pending(&pag->pag_blockgc_work)); ASSERT(!delayed_work_pending(&pag->pag_blockgc_work));
kmem_free(pag); kfree(pag);
} }
/* /*
@ -353,7 +353,7 @@ xfs_free_unused_perag_range(
break; break;
xfs_buf_hash_destroy(pag); xfs_buf_hash_destroy(pag);
xfs_defer_drain_free(&pag->pag_intents_drain); xfs_defer_drain_free(&pag->pag_intents_drain);
kmem_free(pag); kfree(pag);
} }
} }
@ -453,7 +453,7 @@ out_remove_pag:
radix_tree_delete(&mp->m_perag_tree, index); radix_tree_delete(&mp->m_perag_tree, index);
spin_unlock(&mp->m_perag_lock); spin_unlock(&mp->m_perag_lock);
out_free_pag: out_free_pag:
kmem_free(pag); kfree(pag);
out_unwind_new_pags: out_unwind_new_pags:
/* unwind any prior newly initialized pags */ /* unwind any prior newly initialized pags */
xfs_free_unused_perag_range(mp, first_initialised, agcount); xfs_free_unused_perag_range(mp, first_initialised, agcount);

View File

@ -923,7 +923,7 @@ xfs_attr_shortform_to_leaf(
} }
error = 0; error = 0;
out: out:
kmem_free(tmpbuffer); kfree(tmpbuffer);
return error; return error;
} }
@ -1124,7 +1124,7 @@ xfs_attr3_leaf_to_shortform(
error = 0; error = 0;
out: out:
kmem_free(tmpbuffer); kfree(tmpbuffer);
return error; return error;
} }
@ -1570,7 +1570,7 @@ xfs_attr3_leaf_compact(
*/ */
xfs_trans_log_buf(trans, bp, 0, args->geo->blksize - 1); xfs_trans_log_buf(trans, bp, 0, args->geo->blksize - 1);
kmem_free(tmpbuffer); kfree(tmpbuffer);
} }
/* /*
@ -2290,7 +2290,7 @@ xfs_attr3_leaf_unbalance(
} }
memcpy(save_leaf, tmp_leaf, state->args->geo->blksize); memcpy(save_leaf, tmp_leaf, state->args->geo->blksize);
savehdr = tmphdr; /* struct copy */ savehdr = tmphdr; /* struct copy */
kmem_free(tmp_leaf); kfree(tmp_leaf);
} }
xfs_attr3_leaf_hdr_to_disk(state->args->geo, save_leaf, &savehdr); xfs_attr3_leaf_hdr_to_disk(state->args->geo, save_leaf, &savehdr);

View File

@ -451,7 +451,7 @@ xfs_btree_del_cursor(
ASSERT(cur->bc_btnum != XFS_BTNUM_BMAP || cur->bc_ino.allocated == 0 || ASSERT(cur->bc_btnum != XFS_BTNUM_BMAP || cur->bc_ino.allocated == 0 ||
xfs_is_shutdown(cur->bc_mp) || error != 0); xfs_is_shutdown(cur->bc_mp) || error != 0);
if (unlikely(cur->bc_flags & XFS_BTREE_STAGING)) if (unlikely(cur->bc_flags & XFS_BTREE_STAGING))
kmem_free(cur->bc_ops); kfree(cur->bc_ops);
if (!(cur->bc_flags & XFS_BTREE_LONG_PTRS) && cur->bc_ag.pag) if (!(cur->bc_flags & XFS_BTREE_LONG_PTRS) && cur->bc_ag.pag)
xfs_perag_put(cur->bc_ag.pag); xfs_perag_put(cur->bc_ag.pag);
kmem_cache_free(cur->bc_cache, cur); kmem_cache_free(cur->bc_cache, cur);

View File

@ -171,7 +171,7 @@ xfs_btree_commit_afakeroot(
trace_xfs_btree_commit_afakeroot(cur); trace_xfs_btree_commit_afakeroot(cur);
kmem_free((void *)cur->bc_ops); kfree((void *)cur->bc_ops);
cur->bc_ag.agbp = agbp; cur->bc_ag.agbp = agbp;
cur->bc_ops = ops; cur->bc_ops = ops;
cur->bc_flags &= ~XFS_BTREE_STAGING; cur->bc_flags &= ~XFS_BTREE_STAGING;
@ -254,7 +254,7 @@ xfs_btree_commit_ifakeroot(
trace_xfs_btree_commit_ifakeroot(cur); trace_xfs_btree_commit_ifakeroot(cur);
kmem_free((void *)cur->bc_ops); kfree((void *)cur->bc_ops);
cur->bc_ino.ifake = NULL; cur->bc_ino.ifake = NULL;
cur->bc_ino.whichfork = whichfork; cur->bc_ino.whichfork = whichfork;
cur->bc_ops = ops; cur->bc_ops = ops;

View File

@ -2220,7 +2220,7 @@ xfs_da_grow_inode_int(
out_free_map: out_free_map:
if (mapp != &map) if (mapp != &map)
kmem_free(mapp); kfree(mapp);
return error; return error;
} }
@ -2559,7 +2559,7 @@ xfs_dabuf_map(
*nmaps = nirecs; *nmaps = nirecs;
out_free_irecs: out_free_irecs:
if (irecs != &irec) if (irecs != &irec)
kmem_free(irecs); kfree(irecs);
return error; return error;
invalid_mapping: invalid_mapping:
@ -2615,7 +2615,7 @@ xfs_da_get_buf(
out_free: out_free:
if (mapp != &map) if (mapp != &map)
kmem_free(mapp); kfree(mapp);
return error; return error;
} }
@ -2656,7 +2656,7 @@ xfs_da_read_buf(
*bpp = bp; *bpp = bp;
out_free: out_free:
if (mapp != &map) if (mapp != &map)
kmem_free(mapp); kfree(mapp);
return error; return error;
} }
@ -2687,7 +2687,7 @@ xfs_da_reada_buf(
out_free: out_free:
if (mapp != &map) if (mapp != &map)
kmem_free(mapp); kfree(mapp);
return error; return error;
} }

View File

@ -1038,7 +1038,7 @@ xfs_defer_ops_capture_abort(
for (i = 0; i < dfc->dfc_held.dr_inos; i++) for (i = 0; i < dfc->dfc_held.dr_inos; i++)
xfs_irele(dfc->dfc_held.dr_ip[i]); xfs_irele(dfc->dfc_held.dr_ip[i]);
kmem_free(dfc); kfree(dfc);
} }
/* /*
@ -1114,7 +1114,7 @@ xfs_defer_ops_continue(
list_splice_init(&dfc->dfc_dfops, &tp->t_dfops); list_splice_init(&dfc->dfc_dfops, &tp->t_dfops);
tp->t_flags |= dfc->dfc_tpflags; tp->t_flags |= dfc->dfc_tpflags;
kmem_free(dfc); kfree(dfc);
} }
/* Release the resources captured and continued during recovery. */ /* Release the resources captured and continued during recovery. */

View File

@ -109,8 +109,8 @@ xfs_da_mount(
mp->m_attr_geo = kzalloc(sizeof(struct xfs_da_geometry), mp->m_attr_geo = kzalloc(sizeof(struct xfs_da_geometry),
GFP_KERNEL | __GFP_RETRY_MAYFAIL); GFP_KERNEL | __GFP_RETRY_MAYFAIL);
if (!mp->m_dir_geo || !mp->m_attr_geo) { if (!mp->m_dir_geo || !mp->m_attr_geo) {
kmem_free(mp->m_dir_geo); kfree(mp->m_dir_geo);
kmem_free(mp->m_attr_geo); kfree(mp->m_attr_geo);
return -ENOMEM; return -ENOMEM;
} }
@ -178,8 +178,8 @@ void
xfs_da_unmount( xfs_da_unmount(
struct xfs_mount *mp) struct xfs_mount *mp)
{ {
kmem_free(mp->m_dir_geo); kfree(mp->m_dir_geo);
kmem_free(mp->m_attr_geo); kfree(mp->m_attr_geo);
} }
/* /*
@ -244,7 +244,7 @@ xfs_dir_init(
args->dp = dp; args->dp = dp;
args->trans = tp; args->trans = tp;
error = xfs_dir2_sf_create(args, pdp->i_ino); error = xfs_dir2_sf_create(args, pdp->i_ino);
kmem_free(args); kfree(args);
return error; return error;
} }
@ -313,7 +313,7 @@ xfs_dir_createname(
rval = xfs_dir2_node_addname(args); rval = xfs_dir2_node_addname(args);
out_free: out_free:
kmem_free(args); kfree(args);
return rval; return rval;
} }
@ -419,7 +419,7 @@ out_check_rval:
} }
out_free: out_free:
xfs_iunlock(dp, lock_mode); xfs_iunlock(dp, lock_mode);
kmem_free(args); kfree(args);
return rval; return rval;
} }
@ -477,7 +477,7 @@ xfs_dir_removename(
else else
rval = xfs_dir2_node_removename(args); rval = xfs_dir2_node_removename(args);
out_free: out_free:
kmem_free(args); kfree(args);
return rval; return rval;
} }
@ -538,7 +538,7 @@ xfs_dir_replace(
else else
rval = xfs_dir2_node_replace(args); rval = xfs_dir2_node_replace(args);
out_free: out_free:
kmem_free(args); kfree(args);
return rval; return rval;
} }

View File

@ -1253,7 +1253,7 @@ xfs_dir2_sf_to_block(
sfep = xfs_dir2_sf_nextentry(mp, sfp, sfep); sfep = xfs_dir2_sf_nextentry(mp, sfp, sfep);
} }
/* Done with the temporary buffer */ /* Done with the temporary buffer */
kmem_free(sfp); kfree(sfp);
/* /*
* Sort the leaf entries by hash value. * Sort the leaf entries by hash value.
*/ */
@ -1268,6 +1268,6 @@ xfs_dir2_sf_to_block(
xfs_dir3_data_check(dp, bp); xfs_dir3_data_check(dp, bp);
return 0; return 0;
out_free: out_free:
kmem_free(sfp); kfree(sfp);
return error; return error;
} }

View File

@ -350,7 +350,7 @@ xfs_dir2_block_to_sf(
xfs_dir2_sf_check(args); xfs_dir2_sf_check(args);
out: out:
xfs_trans_log_inode(args->trans, dp, logflags); xfs_trans_log_inode(args->trans, dp, logflags);
kmem_free(sfp); kfree(sfp);
return error; return error;
} }
@ -576,7 +576,7 @@ xfs_dir2_sf_addname_hard(
sfep = xfs_dir2_sf_nextentry(mp, sfp, sfep); sfep = xfs_dir2_sf_nextentry(mp, sfp, sfep);
memcpy(sfep, oldsfep, old_isize - nbytes); memcpy(sfep, oldsfep, old_isize - nbytes);
} }
kmem_free(buf); kfree(buf);
dp->i_disk_size = new_isize; dp->i_disk_size = new_isize;
xfs_dir2_sf_check(args); xfs_dir2_sf_check(args);
} }
@ -1190,7 +1190,7 @@ xfs_dir2_sf_toino4(
/* /*
* Clean up the inode. * Clean up the inode.
*/ */
kmem_free(buf); kfree(buf);
dp->i_disk_size = newsize; dp->i_disk_size = newsize;
xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA); xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA);
} }
@ -1262,7 +1262,7 @@ xfs_dir2_sf_toino8(
/* /*
* Clean up the inode. * Clean up the inode.
*/ */
kmem_free(buf); kfree(buf);
dp->i_disk_size = newsize; dp->i_disk_size = newsize;
xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA); xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA);
} }

View File

@ -747,7 +747,7 @@ xfs_iext_remove_node(
again: again:
ASSERT(node->ptrs[pos]); ASSERT(node->ptrs[pos]);
ASSERT(node->ptrs[pos] == victim); ASSERT(node->ptrs[pos] == victim);
kmem_free(victim); kfree(victim);
nr_entries = xfs_iext_node_nr_entries(node, pos) - 1; nr_entries = xfs_iext_node_nr_entries(node, pos) - 1;
offset = node->keys[0]; offset = node->keys[0];
@ -793,7 +793,7 @@ again:
ASSERT(node == ifp->if_data); ASSERT(node == ifp->if_data);
ifp->if_data = node->ptrs[0]; ifp->if_data = node->ptrs[0];
ifp->if_height--; ifp->if_height--;
kmem_free(node); kfree(node);
} }
} }
@ -867,7 +867,7 @@ xfs_iext_free_last_leaf(
struct xfs_ifork *ifp) struct xfs_ifork *ifp)
{ {
ifp->if_height--; ifp->if_height--;
kmem_free(ifp->if_data); kfree(ifp->if_data);
ifp->if_data = NULL; ifp->if_data = NULL;
} }
@ -1048,7 +1048,7 @@ xfs_iext_destroy_node(
} }
} }
kmem_free(node); kfree(node);
} }
void void

View File

@ -471,7 +471,7 @@ xfs_iroot_realloc(
(int)new_size); (int)new_size);
memcpy(np, op, new_max * (uint)sizeof(xfs_fsblock_t)); memcpy(np, op, new_max * (uint)sizeof(xfs_fsblock_t));
} }
kmem_free(ifp->if_broot); kfree(ifp->if_broot);
ifp->if_broot = new_broot; ifp->if_broot = new_broot;
ifp->if_broot_bytes = (int)new_size; ifp->if_broot_bytes = (int)new_size;
if (ifp->if_broot) if (ifp->if_broot)
@ -525,13 +525,13 @@ xfs_idestroy_fork(
struct xfs_ifork *ifp) struct xfs_ifork *ifp)
{ {
if (ifp->if_broot != NULL) { if (ifp->if_broot != NULL) {
kmem_free(ifp->if_broot); kfree(ifp->if_broot);
ifp->if_broot = NULL; ifp->if_broot = NULL;
} }
switch (ifp->if_format) { switch (ifp->if_format) {
case XFS_DINODE_FMT_LOCAL: case XFS_DINODE_FMT_LOCAL:
kmem_free(ifp->if_data); kfree(ifp->if_data);
ifp->if_data = NULL; ifp->if_data = NULL;
break; break;
case XFS_DINODE_FMT_EXTENTS: case XFS_DINODE_FMT_EXTENTS:

View File

@ -609,6 +609,6 @@ xrep_bmap_cow(
out_bitmap: out_bitmap:
xfsb_bitmap_destroy(&xc->old_cowfork_fsblocks); xfsb_bitmap_destroy(&xc->old_cowfork_fsblocks);
xoff_bitmap_destroy(&xc->bad_fileoffs); xoff_bitmap_destroy(&xc->bad_fileoffs);
kmem_free(xc); kfree(xc);
return error; return error;
} }

View File

@ -386,7 +386,7 @@ xfs_attr_free_item(
xfs_da_state_free(attr->xattri_da_state); xfs_da_state_free(attr->xattri_da_state);
xfs_attri_log_nameval_put(attr->xattri_nameval); xfs_attri_log_nameval_put(attr->xattri_nameval);
if (attr->xattri_da_args->op_flags & XFS_DA_OP_RECOVERY) if (attr->xattri_da_args->op_flags & XFS_DA_OP_RECOVERY)
kmem_free(attr); kfree(attr);
else else
kmem_cache_free(xfs_attr_intent_cache, attr); kmem_cache_free(xfs_attr_intent_cache, attr);
} }

View File

@ -124,7 +124,7 @@ xfs_attr_shortform_list(
XFS_ERRLEVEL_LOW, XFS_ERRLEVEL_LOW,
context->dp->i_mount, sfe, context->dp->i_mount, sfe,
sizeof(*sfe)); sizeof(*sfe));
kmem_free(sbuf); kfree(sbuf);
return -EFSCORRUPTED; return -EFSCORRUPTED;
} }
@ -188,7 +188,7 @@ xfs_attr_shortform_list(
cursor->offset++; cursor->offset++;
} }
out: out:
kmem_free(sbuf); kfree(sbuf);
return error; return error;
} }

View File

@ -204,7 +204,7 @@ xfs_buf_free_maps(
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
if (bp->b_maps != &bp->__b_map) { if (bp->b_maps != &bp->__b_map) {
kmem_free(bp->b_maps); kfree(bp->b_maps);
bp->b_maps = NULL; bp->b_maps = NULL;
} }
} }
@ -289,7 +289,7 @@ xfs_buf_free_pages(
mm_account_reclaimed_pages(bp->b_page_count); mm_account_reclaimed_pages(bp->b_page_count);
if (bp->b_pages != bp->b_page_array) if (bp->b_pages != bp->b_page_array)
kmem_free(bp->b_pages); kfree(bp->b_pages);
bp->b_pages = NULL; bp->b_pages = NULL;
bp->b_flags &= ~_XBF_PAGES; bp->b_flags &= ~_XBF_PAGES;
} }
@ -315,7 +315,7 @@ xfs_buf_free(
if (bp->b_flags & _XBF_PAGES) if (bp->b_flags & _XBF_PAGES)
xfs_buf_free_pages(bp); xfs_buf_free_pages(bp);
else if (bp->b_flags & _XBF_KMEM) else if (bp->b_flags & _XBF_KMEM)
kmem_free(bp->b_addr); kfree(bp->b_addr);
call_rcu(&bp->b_rcu, xfs_buf_free_callback); call_rcu(&bp->b_rcu, xfs_buf_free_callback);
} }
@ -339,7 +339,7 @@ xfs_buf_alloc_kmem(
if (((unsigned long)(bp->b_addr + size - 1) & PAGE_MASK) != if (((unsigned long)(bp->b_addr + size - 1) & PAGE_MASK) !=
((unsigned long)bp->b_addr & PAGE_MASK)) { ((unsigned long)bp->b_addr & PAGE_MASK)) {
/* b_addr spans two pages - use alloc_page instead */ /* b_addr spans two pages - use alloc_page instead */
kmem_free(bp->b_addr); kfree(bp->b_addr);
bp->b_addr = NULL; bp->b_addr = NULL;
return -ENOMEM; return -ENOMEM;
} }
@ -1953,7 +1953,7 @@ xfs_free_buftarg(
if (btp->bt_bdev != btp->bt_mount->m_super->s_bdev) if (btp->bt_bdev != btp->bt_mount->m_super->s_bdev)
bdev_release(btp->bt_bdev_handle); bdev_release(btp->bt_bdev_handle);
kmem_free(btp); kfree(btp);
} }
int int
@ -2045,7 +2045,7 @@ error_pcpu:
error_lru: error_lru:
list_lru_destroy(&btp->bt_lru); list_lru_destroy(&btp->bt_lru);
error_free: error_free:
kmem_free(btp); kfree(btp);
return NULL; return NULL;
} }

View File

@ -814,7 +814,7 @@ xfs_buf_item_free_format(
struct xfs_buf_log_item *bip) struct xfs_buf_log_item *bip)
{ {
if (bip->bli_formats != &bip->__bli_format) { if (bip->bli_formats != &bip->__bli_format) {
kmem_free(bip->bli_formats); kfree(bip->bli_formats);
bip->bli_formats = NULL; bip->bli_formats = NULL;
} }
} }

View File

@ -129,7 +129,7 @@ xlog_put_buffer_cancelled(
if (--bcp->bc_refcount == 0) { if (--bcp->bc_refcount == 0) {
list_del(&bcp->bc_list); list_del(&bcp->bc_list);
kmem_free(bcp); kfree(bcp);
} }
return true; return true;
} }
@ -1062,10 +1062,10 @@ xlog_free_buf_cancel_table(
&log->l_buf_cancel_table[i], &log->l_buf_cancel_table[i],
struct xfs_buf_cancel, bc_list))) { struct xfs_buf_cancel, bc_list))) {
list_del(&bc->bc_list); list_del(&bc->bc_list);
kmem_free(bc); kfree(bc);
} }
} }
kmem_free(log->l_buf_cancel_table); kfree(log->l_buf_cancel_table);
log->l_buf_cancel_table = NULL; log->l_buf_cancel_table = NULL;
} }

View File

@ -79,7 +79,7 @@ xfs_discard_endio_work(
container_of(work, struct xfs_busy_extents, endio_work); container_of(work, struct xfs_busy_extents, endio_work);
xfs_extent_busy_clear(extents->mount, &extents->extent_list, false); xfs_extent_busy_clear(extents->mount, &extents->extent_list, false);
kmem_free(extents->owner); kfree(extents->owner);
} }
/* /*

View File

@ -248,7 +248,7 @@ xfs_errortag_init(
ret = xfs_sysfs_init(&mp->m_errortag_kobj, &xfs_errortag_ktype, ret = xfs_sysfs_init(&mp->m_errortag_kobj, &xfs_errortag_ktype,
&mp->m_kobj, "errortag"); &mp->m_kobj, "errortag");
if (ret) if (ret)
kmem_free(mp->m_errortag); kfree(mp->m_errortag);
return ret; return ret;
} }
@ -257,7 +257,7 @@ xfs_errortag_del(
struct xfs_mount *mp) struct xfs_mount *mp)
{ {
xfs_sysfs_del(&mp->m_errortag_kobj); xfs_sysfs_del(&mp->m_errortag_kobj);
kmem_free(mp->m_errortag); kfree(mp->m_errortag);
} }
static bool static bool

View File

@ -531,7 +531,7 @@ xfs_extent_busy_clear_one(
} }
list_del_init(&busyp->list); list_del_init(&busyp->list);
kmem_free(busyp); kfree(busyp);
} }
static void static void

View File

@ -42,7 +42,7 @@ xfs_efi_item_free(
{ {
kvfree(efip->efi_item.li_lv_shadow); kvfree(efip->efi_item.li_lv_shadow);
if (efip->efi_format.efi_nextents > XFS_EFI_MAX_FAST_EXTENTS) if (efip->efi_format.efi_nextents > XFS_EFI_MAX_FAST_EXTENTS)
kmem_free(efip); kfree(efip);
else else
kmem_cache_free(xfs_efi_cache, efip); kmem_cache_free(xfs_efi_cache, efip);
} }
@ -231,7 +231,7 @@ xfs_efd_item_free(struct xfs_efd_log_item *efdp)
{ {
kvfree(efdp->efd_item.li_lv_shadow); kvfree(efdp->efd_item.li_lv_shadow);
if (efdp->efd_format.efd_nextents > XFS_EFD_MAX_FAST_EXTENTS) if (efdp->efd_format.efd_nextents > XFS_EFD_MAX_FAST_EXTENTS)
kmem_free(efdp); kfree(efdp);
else else
kmem_cache_free(xfs_efd_cache, efdp); kmem_cache_free(xfs_efd_cache, efdp);
} }

View File

@ -44,7 +44,7 @@ xfs_fstrm_free_func(
atomic_dec(&pag->pagf_fstrms); atomic_dec(&pag->pagf_fstrms);
xfs_perag_rele(pag); xfs_perag_rele(pag);
kmem_free(item); kfree(item);
} }
/* /*
@ -326,7 +326,7 @@ xfs_filestream_create_association(
out_free_item: out_free_item:
xfs_perag_rele(item->pag); xfs_perag_rele(item->pag);
kmem_free(item); kfree(item);
out_put_fstrms: out_put_fstrms:
atomic_dec(&args->pag->pagf_fstrms); atomic_dec(&args->pag->pagf_fstrms);
return 0; return 0;

View File

@ -671,7 +671,7 @@ xfs_lookup(
out_free_name: out_free_name:
if (ci_name) if (ci_name)
kmem_free(ci_name->name); kfree(ci_name->name);
out_unlock: out_unlock:
*ipp = NULL; *ipp = NULL;
return error; return error;
@ -2378,7 +2378,7 @@ xfs_ifree(
* already been freed by xfs_attr_inactive. * already been freed by xfs_attr_inactive.
*/ */
if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL) { if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL) {
kmem_free(ip->i_df.if_data); kfree(ip->i_df.if_data);
ip->i_df.if_data = NULL; ip->i_df.if_data = NULL;
ip->i_df.if_bytes = 0; ip->i_df.if_bytes = 0;
} }

View File

@ -554,7 +554,7 @@ out_release:
xfs_buf_relse(bp); xfs_buf_relse(bp);
error: error:
if (need_free) if (need_free)
kmem_free(in_f); kfree(in_f);
return error; return error;
} }

View File

@ -435,7 +435,7 @@ xfs_ioc_attr_list(
copy_to_user(ucursor, &context.cursor, sizeof(context.cursor))) copy_to_user(ucursor, &context.cursor, sizeof(context.cursor)))
error = -EFAULT; error = -EFAULT;
out_free: out_free:
kmem_free(buffer); kfree(buffer);
return error; return error;
} }
@ -1506,7 +1506,7 @@ xfs_ioc_getbmap(
error = 0; error = 0;
out_free_buf: out_free_buf:
kmem_free(buf); kfree(buf);
return error; return error;
} }
@ -1636,7 +1636,7 @@ xfs_ioc_getfsmap(
} }
out_free: out_free:
kmem_free(recs); kfree(recs);
return error; return error;
} }

View File

@ -346,7 +346,7 @@ xfs_vn_ci_lookup(
dname.name = ci_name.name; dname.name = ci_name.name;
dname.len = ci_name.len; dname.len = ci_name.len;
dentry = d_add_ci(dentry, VFS_I(ip), &dname); dentry = d_add_ci(dentry, VFS_I(ip), &dname);
kmem_free(ci_name.name); kfree(ci_name.name);
return dentry; return dentry;
} }

View File

@ -214,7 +214,7 @@ xfs_bulkstat_one(
breq->startino, &bc); breq->startino, &bc);
xfs_trans_cancel(tp); xfs_trans_cancel(tp);
out: out:
kmem_free(bc.buf); kfree(bc.buf);
/* /*
* If we reported one inode to userspace then we abort because we hit * If we reported one inode to userspace then we abort because we hit
@ -309,7 +309,7 @@ xfs_bulkstat(
xfs_bulkstat_iwalk, breq->icount, &bc); xfs_bulkstat_iwalk, breq->icount, &bc);
xfs_trans_cancel(tp); xfs_trans_cancel(tp);
out: out:
kmem_free(bc.buf); kfree(bc.buf);
/* /*
* We found some inodes, so clear the error status and return them. * We found some inodes, so clear the error status and return them.

View File

@ -172,7 +172,7 @@ STATIC void
xfs_iwalk_free( xfs_iwalk_free(
struct xfs_iwalk_ag *iwag) struct xfs_iwalk_ag *iwag)
{ {
kmem_free(iwag->recs); kfree(iwag->recs);
iwag->recs = NULL; iwag->recs = NULL;
} }
@ -627,7 +627,7 @@ xfs_iwalk_ag_work(
xfs_iwalk_free(iwag); xfs_iwalk_free(iwag);
out: out:
xfs_perag_put(iwag->pag); xfs_perag_put(iwag->pag);
kmem_free(iwag); kfree(iwag);
return error; return error;
} }

View File

@ -20,8 +20,6 @@ typedef __u32 xfs_dev_t;
typedef __u32 xfs_nlink_t; typedef __u32 xfs_nlink_t;
#include "xfs_types.h" #include "xfs_types.h"
#include "kmem.h"
#include "mrlock.h" #include "mrlock.h"
#include <linux/semaphore.h> #include <linux/semaphore.h>
@ -30,6 +28,7 @@ typedef __u32 xfs_nlink_t;
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/crc32c.h> #include <linux/crc32c.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mutex.h> #include <linux/mutex.h>

View File

@ -1663,12 +1663,12 @@ out_free_iclog:
for (iclog = log->l_iclog; iclog; iclog = prev_iclog) { for (iclog = log->l_iclog; iclog; iclog = prev_iclog) {
prev_iclog = iclog->ic_next; prev_iclog = iclog->ic_next;
kvfree(iclog->ic_data); kvfree(iclog->ic_data);
kmem_free(iclog); kfree(iclog);
if (prev_iclog == log->l_iclog) if (prev_iclog == log->l_iclog)
break; break;
} }
out_free_log: out_free_log:
kmem_free(log); kfree(log);
out: out:
return ERR_PTR(error); return ERR_PTR(error);
} /* xlog_alloc_log */ } /* xlog_alloc_log */
@ -2120,13 +2120,13 @@ xlog_dealloc_log(
for (i = 0; i < log->l_iclog_bufs; i++) { for (i = 0; i < log->l_iclog_bufs; i++) {
next_iclog = iclog->ic_next; next_iclog = iclog->ic_next;
kvfree(iclog->ic_data); kvfree(iclog->ic_data);
kmem_free(iclog); kfree(iclog);
iclog = next_iclog; iclog = next_iclog;
} }
log->l_mp->m_log = NULL; log->l_mp->m_log = NULL;
destroy_workqueue(log->l_ioend_workqueue); destroy_workqueue(log->l_ioend_workqueue);
kmem_free(log); kfree(log);
} }
/* /*

View File

@ -703,7 +703,7 @@ xlog_cil_free_logvec(
while (!list_empty(lv_chain)) { while (!list_empty(lv_chain)) {
lv = list_first_entry(lv_chain, struct xfs_log_vec, lv_list); lv = list_first_entry(lv_chain, struct xfs_log_vec, lv_list);
list_del_init(&lv->lv_list); list_del_init(&lv->lv_list);
kmem_free(lv); kfree(lv);
} }
} }
@ -753,7 +753,7 @@ xlog_cil_committed(
return; return;
} }
kmem_free(ctx); kfree(ctx);
} }
void void
@ -1339,7 +1339,7 @@ xlog_cil_push_work(
out_skip: out_skip:
up_write(&cil->xc_ctx_lock); up_write(&cil->xc_ctx_lock);
xfs_log_ticket_put(new_ctx->ticket); xfs_log_ticket_put(new_ctx->ticket);
kmem_free(new_ctx); kfree(new_ctx);
return; return;
out_abort_free_ticket: out_abort_free_ticket:
@ -1533,7 +1533,7 @@ xlog_cil_process_intents(
set_bit(XFS_LI_WHITEOUT, &ilip->li_flags); set_bit(XFS_LI_WHITEOUT, &ilip->li_flags);
trace_xfs_cil_whiteout_mark(ilip); trace_xfs_cil_whiteout_mark(ilip);
len += ilip->li_lv->lv_bytes; len += ilip->li_lv->lv_bytes;
kmem_free(ilip->li_lv); kfree(ilip->li_lv);
ilip->li_lv = NULL; ilip->li_lv = NULL;
xfs_trans_del_item(lip); xfs_trans_del_item(lip);
@ -1786,7 +1786,7 @@ xlog_cil_init(
out_destroy_wq: out_destroy_wq:
destroy_workqueue(cil->xc_push_wq); destroy_workqueue(cil->xc_push_wq);
out_destroy_cil: out_destroy_cil:
kmem_free(cil); kfree(cil);
return -ENOMEM; return -ENOMEM;
} }
@ -1799,12 +1799,12 @@ xlog_cil_destroy(
if (cil->xc_ctx) { if (cil->xc_ctx) {
if (cil->xc_ctx->ticket) if (cil->xc_ctx->ticket)
xfs_log_ticket_put(cil->xc_ctx->ticket); xfs_log_ticket_put(cil->xc_ctx->ticket);
kmem_free(cil->xc_ctx); kfree(cil->xc_ctx);
} }
ASSERT(test_bit(XLOG_CIL_EMPTY, &cil->xc_flags)); ASSERT(test_bit(XLOG_CIL_EMPTY, &cil->xc_flags));
free_percpu(cil->xc_pcp); free_percpu(cil->xc_pcp);
destroy_workqueue(cil->xc_push_wq); destroy_workqueue(cil->xc_push_wq);
kmem_free(cil); kfree(cil);
} }

View File

@ -2229,11 +2229,11 @@ xlog_recover_free_trans(
for (i = 0; i < item->ri_cnt; i++) for (i = 0; i < item->ri_cnt; i++)
kvfree(item->ri_buf[i].i_addr); kvfree(item->ri_buf[i].i_addr);
/* Free the item itself */ /* Free the item itself */
kmem_free(item->ri_buf); kfree(item->ri_buf);
kmem_free(item); kfree(item);
} }
/* Free the transaction recover structure */ /* Free the transaction recover structure */
kmem_free(trans); kfree(trans);
} }
/* /*

View File

@ -45,7 +45,7 @@ xfs_uuid_table_free(void)
{ {
if (xfs_uuid_table_size == 0) if (xfs_uuid_table_size == 0)
return; return;
kmem_free(xfs_uuid_table); kfree(xfs_uuid_table);
xfs_uuid_table = NULL; xfs_uuid_table = NULL;
xfs_uuid_table_size = 0; xfs_uuid_table_size = 0;
} }

View File

@ -365,9 +365,9 @@ xfs_mru_cache_create(
exit: exit:
if (err && mru && mru->lists) if (err && mru && mru->lists)
kmem_free(mru->lists); kfree(mru->lists);
if (err && mru) if (err && mru)
kmem_free(mru); kfree(mru);
return err; return err;
} }
@ -407,8 +407,8 @@ xfs_mru_cache_destroy(
xfs_mru_cache_flush(mru); xfs_mru_cache_flush(mru);
kmem_free(mru->lists); kfree(mru->lists);
kmem_free(mru); kfree(mru);
} }
/* /*

View File

@ -701,7 +701,7 @@ out_free_inos:
out_free_lru: out_free_lru:
list_lru_destroy(&qinf->qi_lru); list_lru_destroy(&qinf->qi_lru);
out_free_qinf: out_free_qinf:
kmem_free(qinf); kfree(qinf);
mp->m_quotainfo = NULL; mp->m_quotainfo = NULL;
return error; return error;
} }
@ -725,7 +725,7 @@ xfs_qm_destroy_quotainfo(
xfs_qm_destroy_quotainos(qi); xfs_qm_destroy_quotainos(qi);
mutex_destroy(&qi->qi_tree_lock); mutex_destroy(&qi->qi_tree_lock);
mutex_destroy(&qi->qi_quotaofflock); mutex_destroy(&qi->qi_quotaofflock);
kmem_free(qi); kfree(qi);
mp->m_quotainfo = NULL; mp->m_quotainfo = NULL;
} }
@ -1060,7 +1060,7 @@ xfs_qm_reset_dqcounts_buf(
} while (nmaps > 0); } while (nmaps > 0);
out: out:
kmem_free(map); kfree(map);
return error; return error;
} }

View File

@ -38,7 +38,7 @@ xfs_cui_item_free(
{ {
kvfree(cuip->cui_item.li_lv_shadow); kvfree(cuip->cui_item.li_lv_shadow);
if (cuip->cui_format.cui_nextents > XFS_CUI_MAX_FAST_EXTENTS) if (cuip->cui_format.cui_nextents > XFS_CUI_MAX_FAST_EXTENTS)
kmem_free(cuip); kfree(cuip);
else else
kmem_cache_free(xfs_cui_cache, cuip); kmem_cache_free(xfs_cui_cache, cuip);
} }

View File

@ -38,7 +38,7 @@ xfs_rui_item_free(
{ {
kvfree(ruip->rui_item.li_lv_shadow); kvfree(ruip->rui_item.li_lv_shadow);
if (ruip->rui_format.rui_nextents > XFS_RUI_MAX_FAST_EXTENTS) if (ruip->rui_format.rui_nextents > XFS_RUI_MAX_FAST_EXTENTS)
kmem_free(ruip); kfree(ruip);
else else
kmem_cache_free(xfs_rui_cache, ruip); kmem_cache_free(xfs_rui_cache, ruip);
} }

View File

@ -1050,7 +1050,7 @@ out_free:
/* /*
* Free the fake mp structure. * Free the fake mp structure.
*/ */
kmem_free(nmp); kfree(nmp);
/* /*
* If we had to allocate a new rsum_cache, we either need to free the * If we had to allocate a new rsum_cache, we either need to free the

View File

@ -761,7 +761,7 @@ xfs_mount_free(
debugfs_remove(mp->m_debugfs); debugfs_remove(mp->m_debugfs);
kfree(mp->m_rtname); kfree(mp->m_rtname);
kfree(mp->m_logname); kfree(mp->m_logname);
kmem_free(mp); kfree(mp);
} }
STATIC int STATIC int

View File

@ -922,7 +922,7 @@ xfs_trans_ail_init(
return 0; return 0;
out_free_ailp: out_free_ailp:
kmem_free(ailp); kfree(ailp);
return -ENOMEM; return -ENOMEM;
} }
@ -933,5 +933,5 @@ xfs_trans_ail_destroy(
struct xfs_ail *ailp = mp->m_ail; struct xfs_ail *ailp = mp->m_ail;
kthread_stop(ailp->ail_task); kthread_stop(ailp->ail_task);
kmem_free(ailp); kfree(ailp);
} }