entry = cephsan_pagefrag_get_ptr(iter->pf, iter->current_offset);
/* Verify entry is valid */
if (!entry || entry->debug_poison != CEPH_SAN_LOG_ENTRY_POISON || entry->len == 0) {
- /* Get previous entry if available */
- struct ceph_san_log_entry *prev_entry = NULL;
- prev_entry = cephsan_pagefrag_get_ptr(iter->pf, iter->prev_offset);
- pr_err("Previous entry: entry=%px poison=%llx len=%u prev_offset=%llu\n",
- prev_entry, prev_entry->debug_poison, prev_entry->len, iter->prev_offset);
-
- iter->prev_offset = iter->current_offset;
- iter->current_offset = iter->end_offset;
- pr_err("Pagefrag corruption detected: entry=%px poison=%llx len=%u\n"
- "pf: head=%u tail=%u buffer=%px alloc_count=%u prev_offset=%llu\n",
- entry, entry->debug_poison, entry->len,
- iter->pf->head, iter->pf->tail, iter->pf->buffer,
- iter->pf->alloc_count, iter->prev_offset);
-
- BUG_ON(entry->debug_poison != CEPH_SAN_LOG_ENTRY_POISON);
- return NULL;
+ //This maybe legitimate the head doesnt have to be aligned to the tail
+ //if the last free was bigger than need alloc size
+ return NULL;
}
/* Store current offset before moving to next */
pf->buffer = page_address(pf->pages);
pf->head = 0;
pf->tail = 0;
+ pf->active_elements = 0;
+ pf->alloc_count = 0;
return 0;
}
EXPORT_SYMBOL(cephsan_pagefrag_init);
pf->buffer = buffer;
pf->head = 0;
pf->tail = 0;
+ pf->active_elements = 0;
+ pf->alloc_count = 0;
return 0;
}
EXPORT_SYMBOL(cephsan_pagefrag_init_with_buffer);
if (pf->tail - pf->head > n) {
pf->head += n;
pf->alloc_count++;
+ pf->active_elements++;
return ((u64)n << 32) | prev_head;
} else {
return 0;
if (delta >= 0) {
/* Normal allocation */
/* make sure we have enough space to allocate next entry */
+ pf->alloc_count++;
+ pf->active_elements++;
if (unlikely(delta < 64)) {
n += delta;
pf->head = 0;
- pf->alloc_count++;
return ((u64)n << 32) | prev_head;
}
pf->head += n;
/* Need to wrap around return a partial allocation*/
pf->head = n;
pf->alloc_count++;
+ pf->active_elements++;
return ((u64)(delta + n) << 32) | prev_head;
} else {
return 0;
void cephsan_pagefrag_free(struct cephsan_pagefrag *pf, unsigned int n)
{
pf->tail = (pf->tail + n) & (CEPHSAN_PAGEFRAG_SIZE - 1);
+ pf->active_elements--;
}
EXPORT_SYMBOL(cephsan_pagefrag_free);
pf->head = 0;
pf->tail = 0;
pf->alloc_count = 0;
+ pf->active_elements = 0;
spin_unlock(&pf->lock);
}
EXPORT_SYMBOL(cephsan_pagefrag_reset);