Warn directly in smalloc() instead of having the callers do it.
Add a hint on how to solve a situation where we run out of
shared memory.
Signed-off-by: Jens Axboe <axboe@fb.com>
dprint(FD_DISKUTIL, "add maj/min %d/%d: %s\n", majdev, mindev, path);
du = smalloc(sizeof(*du));
dprint(FD_DISKUTIL, "add maj/min %d/%d: %s\n", majdev, mindev, path);
du = smalloc(sizeof(*du));
- if (!du) {
- log_err("fio: smalloc() pool exhausted\n");
memset(du, 0, sizeof(*du));
INIT_FLIST_HEAD(&du->list);
memset(du, 0, sizeof(*du));
INIT_FLIST_HEAD(&du->list);
f = smalloc(sizeof(*f));
if (!f) {
f = smalloc(sizeof(*f));
if (!f) {
- log_err("fio: smalloc OOM\n");
assert(0);
return NULL;
}
assert(0);
return NULL;
}
f->real_file_size = -1ULL;
f->file_name = smalloc_strdup(file_name);
f->real_file_size = -1ULL;
f->file_name = smalloc_strdup(file_name);
- if (!f->file_name) {
- log_err("fio: smalloc OOM\n");
if (f->file_name) {
__f->file_name = smalloc_strdup(f->file_name);
if (f->file_name) {
__f->file_name = smalloc_strdup(f->file_name);
- if (!__f->file_name) {
- log_err("fio: smalloc OOM\n");
__f->filetype = f->filetype;
}
__f->filetype = f->filetype;
}
if (!flow) {
flow = smalloc(sizeof(*flow));
if (!flow) {
if (!flow) {
flow = smalloc(sizeof(*flow));
if (!flow) {
- log_err("fio: smalloc pool exhausted\n");
fio_mutex_up(flow_lock);
return NULL;
}
fio_mutex_up(flow_lock);
return NULL;
}
struct sk_entry *entry;
entry = fio_net_prep_cmd(opcode, buf, size, tagptr, flags);
struct sk_entry *entry;
entry = fio_net_prep_cmd(opcode, buf, size, tagptr, flags);
- fio_net_queue_entry(entry);
- return 0;
+ if (entry) {
+ fio_net_queue_entry(entry);
+ return 0;
+ }
+
+ return 1;
}
static int fio_net_send_simple_stack_cmd(int sk, uint16_t opcode, uint64_t tag)
}
static int fio_net_send_simple_stack_cmd(int sk, uint16_t opcode, uint64_t tag)
dprint(FD_NET, "server: request verify state\n");
rep = smalloc(sizeof(*rep));
dprint(FD_NET, "server: request verify state\n");
rep = smalloc(sizeof(*rep));
- if (!rep) {
- log_err("fio: smalloc pool too small\n");
__fio_mutex_init(&rep->lock, FIO_MUTEX_LOCKED);
rep->data = NULL;
__fio_mutex_init(&rep->lock, FIO_MUTEX_LOCKED);
rep->data = NULL;
+ log_err("smalloc: OOM. Consider using --alloc-size to increase the "
+ "shared memory available.\n");
goto err;
wq->workers = smalloc(wq->max_workers * sizeof(struct submit_worker));
goto err;
wq->workers = smalloc(wq->max_workers * sizeof(struct submit_worker));
+ if (!wq->workers)
+ goto err;
for (i = 0; i < wq->max_workers; i++)
if (start_worker(wq, i, sk_out))
for (i = 0; i < wq->max_workers; i++)
if (start_worker(wq, i, sk_out))