Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fecbe957 authored by Rik van Riel's avatar Rik van Riel Committed by Greg Kroah-Hartman
Browse files

silence nfscache allocation warnings with kvzalloc



commit 8c38b705b4f4ca4e7f9cc116141bc38391917c30 upstream.

silence nfscache allocation warnings with kvzalloc

Currently nfsd_reply_cache_init attempts hash table allocation through
kmalloc, and manually falls back to vzalloc if that fails. This makes
the code a little larger than needed, and creates a significant amount
of serial console spam if you have enough systems.

Switching to kvzalloc gets rid of the allocation warnings, and makes
the code a little cleaner too as a side effect.

Freeing of nn->drc_hashtbl is already done using kvfree currently.

Signed-off-by: default avatarRik van Riel <riel@surriel.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
Cc: Krzysztof Olędzki <ole@ans.pl>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5546e398
Loading
Loading
Loading
Loading
+4 −8
Original line number Original line Diff line number Diff line
@@ -173,14 +173,10 @@ int nfsd_reply_cache_init(struct nfsd_net *nn)
	if (status)
	if (status)
		goto out_nomem;
		goto out_nomem;


	nn->drc_hashtbl = kcalloc(hashsize,
	nn->drc_hashtbl = kvzalloc(array_size(hashsize,
				sizeof(*nn->drc_hashtbl), GFP_KERNEL);
				sizeof(*nn->drc_hashtbl)), GFP_KERNEL);
	if (!nn->drc_hashtbl) {
		nn->drc_hashtbl = vzalloc(array_size(hashsize,
						 sizeof(*nn->drc_hashtbl)));
	if (!nn->drc_hashtbl)
	if (!nn->drc_hashtbl)
		goto out_shrinker;
		goto out_shrinker;
	}


	for (i = 0; i < hashsize; i++) {
	for (i = 0; i < hashsize; i++) {
		INIT_LIST_HEAD(&nn->drc_hashtbl[i].lru_head);
		INIT_LIST_HEAD(&nn->drc_hashtbl[i].lru_head);