Skip to content

Commit 649e58d

Browse files
KunWuChanchucklever
authored andcommitted
nfsd: Simplify the allocation of slab caches in nfsd4_init_slabs
Use the new KMEM_CACHE() macro instead of direct kmem_cache_create to simplify the creation of SLAB caches. Make the code cleaner and more readable. Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 192d80c commit 649e58d

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

fs/nfsd/nfs4state.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4503,32 +4503,25 @@ nfsd4_free_slabs(void)
45034503
int
45044504
nfsd4_init_slabs(void)
45054505
{
4506-
client_slab = kmem_cache_create("nfsd4_clients",
4507-
sizeof(struct nfs4_client), 0, 0, NULL);
4506+
client_slab = KMEM_CACHE(nfs4_client, 0);
45084507
if (client_slab == NULL)
45094508
goto out;
4510-
openowner_slab = kmem_cache_create("nfsd4_openowners",
4511-
sizeof(struct nfs4_openowner), 0, 0, NULL);
4509+
openowner_slab = KMEM_CACHE(nfs4_openowner, 0);
45124510
if (openowner_slab == NULL)
45134511
goto out_free_client_slab;
4514-
lockowner_slab = kmem_cache_create("nfsd4_lockowners",
4515-
sizeof(struct nfs4_lockowner), 0, 0, NULL);
4512+
lockowner_slab = KMEM_CACHE(nfs4_lockowner, 0);
45164513
if (lockowner_slab == NULL)
45174514
goto out_free_openowner_slab;
4518-
file_slab = kmem_cache_create("nfsd4_files",
4519-
sizeof(struct nfs4_file), 0, 0, NULL);
4515+
file_slab = KMEM_CACHE(nfs4_file, 0);
45204516
if (file_slab == NULL)
45214517
goto out_free_lockowner_slab;
4522-
stateid_slab = kmem_cache_create("nfsd4_stateids",
4523-
sizeof(struct nfs4_ol_stateid), 0, 0, NULL);
4518+
stateid_slab = KMEM_CACHE(nfs4_ol_stateid, 0);
45244519
if (stateid_slab == NULL)
45254520
goto out_free_file_slab;
4526-
deleg_slab = kmem_cache_create("nfsd4_delegations",
4527-
sizeof(struct nfs4_delegation), 0, 0, NULL);
4521+
deleg_slab = KMEM_CACHE(nfs4_delegation, 0);
45284522
if (deleg_slab == NULL)
45294523
goto out_free_stateid_slab;
4530-
odstate_slab = kmem_cache_create("nfsd4_odstate",
4531-
sizeof(struct nfs4_clnt_odstate), 0, 0, NULL);
4524+
odstate_slab = KMEM_CACHE(nfs4_clnt_odstate, 0);
45324525
if (odstate_slab == NULL)
45334526
goto out_free_deleg_slab;
45344527
return 0;

0 commit comments

Comments
 (0)