Commit d4c75a1b authored by Dave Chinner's avatar Dave Chinner Committed by Chandan Babu R
Browse files

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: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatar"Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>
parent 49292576
Loading
Loading
Loading
Loading

fs/xfs/kmem.h

deleted100644 → 0
+0 −23
Original line number Diff line number Diff line
/* 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__ */
+3 −3
Original line number Diff line number Diff line
@@ -241,7 +241,7 @@ __xfs_free_perag(
	struct xfs_perag *pag = container_of(head, struct xfs_perag, rcu_head);

	ASSERT(!delayed_work_pending(&pag->pag_blockgc_work));
	kmem_free(pag);
	kfree(pag);
}

/*
@@ -353,7 +353,7 @@ xfs_free_unused_perag_range(
			break;
		xfs_buf_hash_destroy(pag);
		xfs_defer_drain_free(&pag->pag_intents_drain);
		kmem_free(pag);
		kfree(pag);
	}
}

@@ -453,7 +453,7 @@ xfs_initialize_perag(
	radix_tree_delete(&mp->m_perag_tree, index);
	spin_unlock(&mp->m_perag_lock);
out_free_pag:
	kmem_free(pag);
	kfree(pag);
out_unwind_new_pags:
	/* unwind any prior newly initialized pags */
	xfs_free_unused_perag_range(mp, first_initialised, agcount);
+4 −4
Original line number Diff line number Diff line
@@ -923,7 +923,7 @@ xfs_attr_shortform_to_leaf(
	}
	error = 0;
out:
	kmem_free(tmpbuffer);
	kfree(tmpbuffer);
	return error;
}

@@ -1124,7 +1124,7 @@ xfs_attr3_leaf_to_shortform(
	error = 0;

out:
	kmem_free(tmpbuffer);
	kfree(tmpbuffer);
	return error;
}

@@ -1570,7 +1570,7 @@ xfs_attr3_leaf_compact(
	 */
	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);
		savehdr = tmphdr; /* struct copy */
		kmem_free(tmp_leaf);
		kfree(tmp_leaf);
	}

	xfs_attr3_leaf_hdr_to_disk(state->args->geo, save_leaf, &savehdr);
+1 −1
Original line number Diff line number Diff line
@@ -451,7 +451,7 @@ xfs_btree_del_cursor(
	ASSERT(cur->bc_btnum != XFS_BTNUM_BMAP || cur->bc_ino.allocated == 0 ||
	       xfs_is_shutdown(cur->bc_mp) || error != 0);
	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)
		xfs_perag_put(cur->bc_ag.pag);
	kmem_cache_free(cur->bc_cache, cur);
+2 −2
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ xfs_btree_commit_afakeroot(

	trace_xfs_btree_commit_afakeroot(cur);

	kmem_free((void *)cur->bc_ops);
	kfree((void *)cur->bc_ops);
	cur->bc_ag.agbp = agbp;
	cur->bc_ops = ops;
	cur->bc_flags &= ~XFS_BTREE_STAGING;
@@ -254,7 +254,7 @@ xfs_btree_commit_ifakeroot(

	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.whichfork = whichfork;
	cur->bc_ops = ops;
Loading