struct slab_sheaf *sheaf)
{
struct slub_percpu_sheaves *pcs;
- bool refill = false;
+ bool keep = false;
struct node_barn *barn;
//TODO: handle oversize sheaf
+ /* Assume it will be kept */
+ if (!sheaf->size && refill_sheaf(s, sheaf, gfp)) {
+ sheaf_flush(s, sheaf);
+ free_empty_sheaf(s, sheaf);
+ return;
+ }
+
pcs = cpu_sheaves_lock(s->cpu_sheaves);
if (!pcs->spare) {
} else if (pcs->barn->nr_full >= MAX_FULL_SHEAVES) {
/* racy check */
barn = pcs->barn;
- refill = true;
+ keep = true;
}
cpu_sheaves_unlock(s->cpu_sheaves);
if (!sheaf)
return;
- /*
- * if the barn is full of full sheaves or we fail to refill the sheaf,
- * simply flush and free it
- */
- if (!refill || refill_sheaf(s, sheaf, gfp)) {
+ /* if the barn is full, simply flush and free it */
+ if (!keep) {
sheaf_flush(s, sheaf);
free_empty_sheaf(s, sheaf);
return;