projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
blockdev_invalidate_cache(): return -1 for error
[fio.git]
/
fio.c
diff --git
a/fio.c
b/fio.c
index 6222a4185c7105973b4080669e34a37303a7f281..b5fada8983e90c2caeb4ca7c4c9ed1bed9a63e5a 100644
(file)
--- a/
fio.c
+++ b/
fio.c
@@
-37,7
+37,8
@@
#include "fio.h"
#include "os.h"
#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)
#define ALIGN(buf) \
(char *) (((unsigned long) (buf) + page_mask) & ~page_mask)
@@
-131,12
+132,12
@@
static int check_min_rate(struct thread_data *td, struct timeval *now)
return 0;
if (bytes < td->rate_bytes) {
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) {
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;
}
}
return 1;
}
}
@@
-255,13
+256,16
@@
static void do_verify(struct thread_data *td)
{
struct fio_file *f;
struct io_u *io_u;
{
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) {
/*
* 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))
if (fio_io_sync(td, f))
break;
if (file_invalidate_cache(td, f))
@@
-379,7
+383,8
@@
static void do_io(struct thread_data *td)
{
struct timeval s;
unsigned long usec;
{
struct timeval s;
unsigned long usec;
- int i, ret = 0;
+ unsigned int i;
+ int ret = 0;
td_set_runstate(td, TD_RUNNING);
td_set_runstate(td, TD_RUNNING);
@@
-518,8
+523,12
@@
static void do_io(struct thread_data *td)
if (should_fsync(td) && td->end_fsync) {
td_set_runstate(td, TD_FSYNCING);
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);
fio_io_sync(td, f);
+ }
}
} else
cleanup_pending_aio(td);
}
} else
cleanup_pending_aio(td);
@@
-650,7
+659,8
@@
static int switch_ioscheduler(struct thread_data *td)
static int clear_io_state(struct thread_data *td)
{
struct fio_file *f;
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;
td->ts.stat_io_bytes[0] = td->ts.stat_io_bytes[1] = 0;
td->this_io_bytes[0] = td->this_io_bytes[1] = 0;
@@
-716,9
+726,6
@@
static void *thread_main(void *data)
goto err_sem;
}
goto err_sem;
}
- if (init_random_state(td))
- goto err_sem;
-
if (td->ioscheduler && switch_ioscheduler(td))
goto err_sem;
if (td->ioscheduler && switch_ioscheduler(td))
goto err_sem;
@@
-1149,6
+1156,7
@@
int main(int argc, char *argv[])
return 1;
}
return 1;
}
+ page_size = ps;
page_mask = ps - 1;
if (write_bw_log) {
page_mask = ps - 1;
if (write_bw_log) {