Skip to content

Commit

Permalink
nfsd: replace call_rcu by kfree_rcu for simple kmem_cache_free callback
Browse files Browse the repository at this point in the history
Since SLOB was removed and since
commit 6c6c47b ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.

The changes were made using Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Acked-by: Paul E. McKenney <paulmck@kernel.org>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
  • Loading branch information
Julia Lawall authored and Chuck Lever committed Nov 19, 2024
1 parent a32442f commit ed9887b
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,21 +572,14 @@ opaque_hashval(const void *ptr, int nbytes)
return x;
}

static void nfsd4_free_file_rcu(struct rcu_head *rcu)
{
struct nfs4_file *fp = container_of(rcu, struct nfs4_file, fi_rcu);

kmem_cache_free(file_slab, fp);
}

void
put_nfs4_file(struct nfs4_file *fi)
{
if (refcount_dec_and_test(&fi->fi_ref)) {
nfsd4_file_hash_remove(fi);
WARN_ON_ONCE(!list_empty(&fi->fi_clnt_odstate));
WARN_ON_ONCE(!list_empty(&fi->fi_delegations));
call_rcu(&fi->fi_rcu, nfsd4_free_file_rcu);
kfree_rcu(fi, fi_rcu);
}
}

Expand Down

0 comments on commit ed9887b

Please sign in to comment.