projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Avoid buildenv conditional in thread_option struct
[fio.git]
/
io_u.c
diff --git
a/io_u.c
b/io_u.c
index 619fa25255f84ee785eccedcf7f96bfe94b41ab4..4b0b5a7a11bdb002f72d552c89ee4ce8c4fd6b4e 100644
(file)
--- a/
io_u.c
+++ b/
io_u.c
@@
-104,7
+104,7
@@
static int __get_next_rand_offset(struct thread_data *td, struct fio_file *f,
dprint(FD_RANDOM, "off rand %llu\n", (unsigned long long) r);
dprint(FD_RANDOM, "off rand %llu\n", (unsigned long long) r);
- *b =
(lastb - 1)
* (r / ((uint64_t) rmax + 1.0));
+ *b =
lastb
* (r / ((uint64_t) rmax + 1.0));
} else {
uint64_t off = 0;
} else {
uint64_t off = 0;
@@
-273,7
+273,7
@@
static int get_next_seq_offset(struct thread_data *td, struct fio_file *f,
{
assert(ddir_rw(ddir));
{
assert(ddir_rw(ddir));
- if (f->last_pos >= f->io_size + get_start_offset(td) && td->o.time_based)
+ if (f->last_pos >= f->io_size + get_start_offset(td
, f
) && td->o.time_based)
f->last_pos = f->last_pos - f->io_size;
if (f->last_pos < f->real_file_size) {
f->last_pos = f->last_pos - f->io_size;
if (f->last_pos < f->real_file_size) {
@@
-415,7
+415,7
@@
static inline int io_u_fits(struct thread_data *td, struct io_u *io_u,
{
struct fio_file *f = io_u->file;
{
struct fio_file *f = io_u->file;
- return io_u->offset + buflen <= f->io_size + get_start_offset(td);
+ return io_u->offset + buflen <= f->io_size + get_start_offset(td
, f
);
}
static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u,
}
static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u,
@@
-426,12
+426,10
@@
static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u,
unsigned int minbs, maxbs;
unsigned long r, rand_max;
unsigned int minbs, maxbs;
unsigned long r, rand_max;
- assert(ddir_rw(
io_u->
ddir));
+ assert(ddir_rw(ddir));
if (td->o.bs_is_seq_rand)
ddir = is_random ? DDIR_WRITE: DDIR_READ;
if (td->o.bs_is_seq_rand)
ddir = is_random ? DDIR_WRITE: DDIR_READ;
- else
- ddir = io_u->ddir;
minbs = td->o.min_bs[ddir];
maxbs = td->o.max_bs[ddir];
minbs = td->o.min_bs[ddir];
maxbs = td->o.max_bs[ddir];
@@
-680,7
+678,7
@@
static void set_rw_ddir(struct thread_data *td, struct io_u *io_u)
void put_file_log(struct thread_data *td, struct fio_file *f)
{
void put_file_log(struct thread_data *td, struct fio_file *f)
{
- int ret = put_file(td, f);
+
unsigned
int ret = put_file(td, f);
if (ret)
td_verror(td, ret, "file close");
if (ret)
td_verror(td, ret, "file close");
@@
-1093,7
+1091,10
@@
static struct fio_file *__get_next_file(struct thread_data *td)
td->file_service_file = f;
td->file_service_left = td->file_service_nr - 1;
out:
td->file_service_file = f;
td->file_service_left = td->file_service_nr - 1;
out:
- dprint(FD_FILE, "get_next_file: %p [%s]\n", f, f->file_name);
+ if (f)
+ dprint(FD_FILE, "get_next_file: %p [%s]\n", f, f->file_name);
+ else
+ dprint(FD_FILE, "get_next_file: NULL\n");
return f;
}
return f;
}
@@
-1294,7
+1295,7
@@
int queue_full(struct thread_data *td)
struct io_u *__get_io_u(struct thread_data *td)
{
struct io_u *__get_io_u(struct thread_data *td)
{
- struct io_u *io_u;
+ struct io_u *io_u
= NULL
;
td_io_u_lock(td);
td_io_u_lock(td);
@@
-1304,9
+1305,9
@@
again:
else if (!queue_full(td)) {
io_u = io_u_qpop(&td->io_u_freelist);
else if (!queue_full(td)) {
io_u = io_u_qpop(&td->io_u_freelist);
+ io_u->file = NULL;
io_u->buflen = 0;
io_u->resid = 0;
io_u->buflen = 0;
io_u->resid = 0;
- io_u->file = NULL;
io_u->end_io = NULL;
}
io_u->end_io = NULL;
}
@@
-1487,7
+1488,8
@@
struct io_u *get_io_u(struct thread_data *td)
if (td->flags & TD_F_REFILL_BUFFERS) {
io_u_fill_buffer(td, io_u,
io_u->xfer_buflen, io_u->xfer_buflen);
if (td->flags & TD_F_REFILL_BUFFERS) {
io_u_fill_buffer(td, io_u,
io_u->xfer_buflen, io_u->xfer_buflen);
- } else if (td->flags & TD_F_SCRAMBLE_BUFFERS)
+ } else if ((td->flags & TD_F_SCRAMBLE_BUFFERS) &&
+ !(td->flags & TD_F_COMPRESS))
do_scramble = 1;
if (td->flags & TD_F_VER_NONE) {
populate_verify_io_u(td, io_u);
do_scramble = 1;
if (td->flags & TD_F_VER_NONE) {
populate_verify_io_u(td, io_u);
@@
-1592,9
+1594,6
@@
static void account_io_completion(struct thread_data *td, struct io_u *io_u,
if (!gtod_reduce(td))
add_iops_sample(td, idx, bytes, &icd->time);
if (!gtod_reduce(td))
add_iops_sample(td, idx, bytes, &icd->time);
-
- if (td->o.number_ios && !--td->o.number_ios)
- td->done = 1;
}
static long long usec_for_io(struct thread_data *td, enum fio_ddir ddir)
}
static long long usec_for_io(struct thread_data *td, enum fio_ddir ddir)