#endif
int numa_node;
+ int per_file_depth;
const char *filename;
struct file files[MAX_FDS];
#endif
}
-static unsigned file_depth(struct submitter *s)
-{
- return (depth + s->nr_files - 1) / s->nr_files;
-}
-
static unsigned long long get_offset(struct submitter *s, struct file *f)
{
unsigned long long offset;
return offset;
}
-static struct file *init_new_io(struct submitter *s)
+static struct file *get_next_file(struct submitter *s)
{
struct file *f;
f = &s->files[0];
} else {
f = &s->files[s->cur_file];
- if (f->pending_ios >= file_depth(s)) {
+ if (f->pending_ios >= s->per_file_depth) {
s->cur_file++;
if (s->cur_file == s->nr_files)
s->cur_file = 0;
return;
}
- f = init_new_io(s);
+ f = get_next_file(s);
if (register_files) {
sqe->flags = IOSQE_FIXED_FILE;
unsigned long long slba;
unsigned long long nlb;
- f = init_new_io(s);
+ f = get_next_file(s);
offset = get_offset(s, f);
fixedbufs = register_files = 0;
}
+ s->per_file_depth = (depth + s->nr_files - 1) / s->nr_files;
return io_queue_init(roundup_pow2(depth), &s->aio_ctx);
#else
fprintf(stderr, "Legacy AIO not available on this system/build\n");
for (i = 0; i < p.sq_entries; i++)
sring->array[i] = i;
+ s->per_file_depth = (depth + s->nr_files - 1) / s->nr_files;
return 0;
}
static int init_printed;
char buf[80];
s->tid = gettid();
- printf("submitter=%d, tid=%d, file=%s, node=%d\n", s->index, s->tid,
- s->filename, s->numa_node);
+ printf("submitter=%d, tid=%d, file=%s, nfiles=%d, node=%d\n", s->index, s->tid,
+ s->filename, s->nr_files, s->numa_node);
set_affinity(s);
while (index < max_ios) {
struct iocb *iocb = &iocbs[index];
- f = init_new_io(s);
+ f = get_next_file(s);
io_prep_pread(iocb, f->real_fd, s->iovecs[index].iov_base,
s->iovecs[index].iov_len, get_offset(s, f));
uint64_t offset;
struct file *f;
- f = init_new_io(s);
+ f = get_next_file(s);
#ifdef ARCH_HAVE_CPU_CLOCK
if (stats)