Commit c4418dac authored by Amitoj Kaur Chawla's avatar Amitoj Kaur Chawla Committed by Greg Kroah-Hartman
Browse files

staging: lustre: osc: Replace kmem_cache_alloc with kmem_cache_zalloc



Use kmem_cache_zalloc instead of manually setting kmem_cache_alloc
with flag GFP_ZERO since kmem_alloc_zalloc sets allocated memory
to zero.

The Coccinelle semantic patch used to make this change is as
follows:
// <smpl>
@@
expression e,f;
@@
- kmem_cache_alloc(e, f |__GFP_ZERO)
+ kmem_cache_zalloc(e, f)
// </smpl>

Signed-off-by: default avatarAmitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1c147c83
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -347,7 +347,7 @@ static struct osc_extent *osc_extent_alloc(struct osc_object *obj)
{
	struct osc_extent *ext;

	ext = kmem_cache_alloc(osc_extent_kmem, GFP_NOFS | __GFP_ZERO);
	ext = kmem_cache_zalloc(osc_extent_kmem, GFP_NOFS);
	if (!ext)
		return NULL;

+2 −2
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ static void *osc_key_init(const struct lu_context *ctx,
{
	struct osc_thread_info *info;

	info = kmem_cache_alloc(osc_thread_kmem, GFP_NOFS | __GFP_ZERO);
	info = kmem_cache_zalloc(osc_thread_kmem, GFP_NOFS);
	if (!info)
		info = ERR_PTR(-ENOMEM);
	return info;
@@ -147,7 +147,7 @@ static void *osc_session_init(const struct lu_context *ctx,
{
	struct osc_session *info;

	info = kmem_cache_alloc(osc_session_kmem, GFP_NOFS | __GFP_ZERO);
	info = kmem_cache_zalloc(osc_session_kmem, GFP_NOFS);
	if (!info)
		info = ERR_PTR(-ENOMEM);
	return info;
+1 −1
Original line number Diff line number Diff line
@@ -803,7 +803,7 @@ int osc_req_init(const struct lu_env *env, struct cl_device *dev,
	struct osc_req *or;
	int result;

	or = kmem_cache_alloc(osc_req_kmem, GFP_NOFS | __GFP_ZERO);
	or = kmem_cache_zalloc(osc_req_kmem, GFP_NOFS);
	if (or) {
		cl_req_slice_add(req, &or->or_cl, dev, &osc_req_ops);
		result = 0;
+1 −1
Original line number Diff line number Diff line
@@ -1567,7 +1567,7 @@ int osc_lock_init(const struct lu_env *env,
	struct osc_lock *clk;
	int result;

	clk = kmem_cache_alloc(osc_lock_kmem, GFP_NOFS | __GFP_ZERO);
	clk = kmem_cache_zalloc(osc_lock_kmem, GFP_NOFS);
	if (clk) {
		__u32 enqflags = lock->cll_descr.cld_enq_flags;

+1 −1
Original line number Diff line number Diff line
@@ -255,7 +255,7 @@ struct lu_object *osc_object_alloc(const struct lu_env *env,
	struct osc_object *osc;
	struct lu_object *obj;

	osc = kmem_cache_alloc(osc_object_kmem, GFP_NOFS | __GFP_ZERO);
	osc = kmem_cache_zalloc(osc_object_kmem, GFP_NOFS);
	if (osc) {
		obj = osc2lu(osc);
		lu_object_init(obj, NULL, dev);
Loading