Fix KMC_OFFSLAB type caches

Because spl_slab_size() was always returning -ENOSPC for caches of
type KMC_OFFSLAB the cache could never be created.  Additionally
the slab size is rounded up to a page which is what kv_alloc()
expects.  The kv_alloc() code will minimally allocate a page,
in the KMC_OFFSLAB case this could be reduced.

The basic regression tests kmem:slab_small, kmem:slab_large,
and kmem:slab_align regression were updated to test KMC_OFFSLAB.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ying Zhu <casualfisher@gmail.com>
Closes #266
This commit is contained in:
Brian Behlendorf
2013-07-19 14:39:35 -07:00
parent b9b3715346
commit ceb3872825
2 changed files with 45 additions and 3 deletions
+2 -1
View File
@@ -1368,7 +1368,8 @@ spl_slab_size(spl_kmem_cache_t *skc, uint32_t *objs, uint32_t *size)
if (skc->skc_flags & KMC_OFFSLAB) {
*objs = SPL_KMEM_CACHE_OBJ_PER_SLAB;
*size = sizeof(spl_kmem_slab_t);
*size = P2ROUNDUP(sizeof(spl_kmem_slab_t), PAGE_SIZE);
SRETURN(0);
} else {
sks_size = spl_sks_size(skc);
obj_size = spl_obj_size(skc);