#include "fio.h"
#include "os.h"
-static unsigned long page_mask;
+unsigned long page_mask;
+unsigned long page_size;
#define ALIGN(buf) \
(char *) (((unsigned long) (buf) + page_mask) & ~page_mask)
return 0;
if (bytes < td->rate_bytes) {
- fprintf(f_out, "%s: min rate %u not met\n", td->name, td->ratemin);
+ log_err("%s: min rate %u not met\n", td->name, td->ratemin);
return 1;
} else {
rate = (bytes - td->rate_bytes) / spent;
if (rate < td->ratemin || bytes < td->rate_bytes) {
- fprintf(f_out, "%s: min rate %u not met, got %luKiB/sec\n", td->name, td->ratemin, rate);
+ log_err("%s: min rate %u not met, got %luKiB/sec\n", td->name, td->ratemin, rate);
return 1;
}
}
{
struct fio_file *f;
struct io_u *io_u;
- int ret, i, min_events;
+ int ret, min_events;
+ unsigned int i;
/*
* sync io first and invalidate cache, to make sure we really
* read from disk.
*/
for_each_file(td, f, i) {
+ if (!(f->flags & FIO_FILE_OPEN))
+ continue;
if (fio_io_sync(td, f))
break;
if (file_invalidate_cache(td, f))
{
struct timeval s;
unsigned long usec;
- int i, ret = 0;
+ unsigned int i;
+ int ret = 0;
td_set_runstate(td, TD_RUNNING);
if (should_fsync(td) && td->end_fsync) {
td_set_runstate(td, TD_FSYNCING);
- for_each_file(td, f, i)
+
+ for_each_file(td, f, i) {
+ if (!(f->flags & FIO_FILE_OPEN))
+ continue;
fio_io_sync(td, f);
+ }
}
} else
cleanup_pending_aio(td);
static int clear_io_state(struct thread_data *td)
{
struct fio_file *f;
- int i, ret;
+ unsigned int i;
+ int ret;
td->ts.stat_io_bytes[0] = td->ts.stat_io_bytes[1] = 0;
td->this_io_bytes[0] = td->this_io_bytes[1] = 0;
goto err_sem;
}
- if (init_random_state(td))
- goto err_sem;
-
if (td->ioscheduler && switch_ioscheduler(td))
goto err_sem;
return 1;
}
+ page_size = ps;
page_mask = ps - 1;
if (write_bw_log) {