#include <limits.h>
#include <fcntl.h>
+#include "fio.h"
#include "mutex.h"
#include "arch/arch.h"
#include "os/os.h"
goto out_fail;
pool->map = ptr;
- pool->bitmap = (void *) ptr + (pool->nr_blocks * SMALLOC_BPL);
+ pool->bitmap = (unsigned int *)((char *) ptr + (pool->nr_blocks * SMALLOC_BPL));
memset(pool->bitmap, 0, bitmap_blocks * sizeof(unsigned int));
pool->lock = fio_mutex_init(FIO_MUTEX_UNLOCKED);
uintptr_t ptr;
ptr = (uintptr_t) hdr + hdr->size - sizeof(unsigned int);
- ptr = (ptr + int_mask) & ~int_mask;
+ ptr = (uintptr_t) PTR_ALIGN(ptr, int_mask);
return (void *) ptr;
}
break;
} while (1);
+ log_err("smalloc: OOM. Consider using --alloc-size to increase the "
+ "shared memory available.\n");
return NULL;
}