summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
c75f74f)
This flips the success return from 0 to true.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
if (o->exec_prerun && exec_string(o, o->exec_prerun, (const char *)"prerun"))
goto err;
if (o->exec_prerun && exec_string(o, o->exec_prerun, (const char *)"prerun"))
goto err;
- if (o->pre_read) {
- if (pre_read_files(td) < 0)
- goto err;
- }
+ if (o->pre_read && !pre_read_files(td))
+ goto err;
}
#endif
extern int __must_check file_lookup_open(struct fio_file *f, int flags);
}
#endif
extern int __must_check file_lookup_open(struct fio_file *f, int flags);
-extern int __must_check pre_read_files(struct thread_data *);
+extern bool __must_check pre_read_files(struct thread_data *);
extern unsigned long long get_rand_file_size(struct thread_data *td);
extern int add_file(struct thread_data *, const char *, int, int);
extern int add_file_exclusive(struct thread_data *, const char *);
extern unsigned long long get_rand_file_size(struct thread_data *td);
extern int add_file(struct thread_data *, const char *, int, int);
extern int add_file_exclusive(struct thread_data *, const char *);
-static int pre_read_file(struct thread_data *td, struct fio_file *f)
+static bool pre_read_file(struct thread_data *td, struct fio_file *f)
- int ret = 0, r, did_open = 0, old_runstate;
+ int r, did_open = 0, old_runstate;
unsigned long long left;
unsigned int bs;
unsigned long long left;
unsigned int bs;
char *b;
if (td_ioengine_flagged(td, FIO_PIPEIO) ||
td_ioengine_flagged(td, FIO_NOIO))
char *b;
if (td_ioengine_flagged(td, FIO_PIPEIO) ||
td_ioengine_flagged(td, FIO_NOIO))
if (f->filetype == FIO_TYPE_CHAR)
if (f->filetype == FIO_TYPE_CHAR)
if (!fio_file_open(f)) {
if (td->io_ops->open_file(td, f)) {
log_err("fio: cannot pre-read, failed to open file\n");
if (!fio_file_open(f)) {
if (td->io_ops->open_file(td, f)) {
log_err("fio: cannot pre-read, failed to open file\n");
b = malloc(bs);
if (!b) {
td_verror(td, errno, "malloc");
b = malloc(bs);
if (!b) {
td_verror(td, errno, "malloc");
goto error;
}
memset(b, 0, bs);
goto error;
}
memset(b, 0, bs);
if (lseek(f->fd, f->file_offset, SEEK_SET) < 0) {
td_verror(td, errno, "lseek");
log_err("fio: failed to lseek pre-read file\n");
if (lseek(f->fd, f->file_offset, SEEK_SET) < 0) {
td_verror(td, errno, "lseek");
log_err("fio: failed to lseek pre-read file\n");
-int pre_read_files(struct thread_data *td)
+bool pre_read_files(struct thread_data *td)
{
struct fio_file *f;
unsigned int i;
{
struct fio_file *f;
unsigned int i;
dprint(FD_FILE, "pre_read files\n");
for_each_file(td, f, i) {
dprint(FD_FILE, "pre_read files\n");
for_each_file(td, f, i) {
- if (pre_read_file(td, f))
- return -1;
+ if (!pre_read_file(td, f))
+ return false;
}
static int __init_rand_distribution(struct thread_data *td, struct fio_file *f)
}
static int __init_rand_distribution(struct thread_data *td, struct fio_file *f)