projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert "Avoid irrelevant "offset extend ends" error message for chrdev"
[fio.git]
/
io_u.c
diff --git
a/io_u.c
b/io_u.c
index 375413f4b6d230e38432484179327736ae2de060..81ee724b7357a36651d4d6001bcf31c23b3853e9 100644
(file)
--- a/
io_u.c
+++ b/
io_u.c
@@
-37,7
+37,7
@@
static bool random_map_free(struct fio_file *f, const uint64_t block)
*/
static void mark_random_map(struct thread_data *td, struct io_u *io_u)
{
*/
static void mark_random_map(struct thread_data *td, struct io_u *io_u)
{
- unsigned int min_bs = td->o.
rw_min_bs
;
+ unsigned int min_bs = td->o.
min_bs[io_u->ddir]
;
struct fio_file *f = io_u->file;
unsigned int nr_blocks;
uint64_t block;
struct fio_file *f = io_u->file;
unsigned int nr_blocks;
uint64_t block;
@@
-323,6
+323,17
@@
fetch:
goto fetch;
}
goto fetch;
}
+static void loop_cache_invalidate(struct thread_data *td, struct fio_file *f)
+{
+ struct thread_options *o = &td->o;
+
+ if (o->invalidate_cache && !o->odirect) {
+ int fio_unused ret;
+
+ ret = file_invalidate_cache(td, f);
+ }
+}
+
static int get_next_rand_block(struct thread_data *td, struct fio_file *f,
enum fio_ddir ddir, uint64_t *b)
{
static int get_next_rand_block(struct thread_data *td, struct fio_file *f,
enum fio_ddir ddir, uint64_t *b)
{
@@
-334,6
+345,7
@@
static int get_next_rand_block(struct thread_data *td, struct fio_file *f,
fio_file_reset(td, f);
if (!get_next_rand_offset(td, f, ddir, b))
return 0;
fio_file_reset(td, f);
if (!get_next_rand_offset(td, f, ddir, b))
return 0;
+ loop_cache_invalidate(td, f);
}
dprint(FD_IO, "%s: rand offset failed, last=%llu, size=%llu\n",
}
dprint(FD_IO, "%s: rand offset failed, last=%llu, size=%llu\n",
@@
-349,15
+361,14
@@
static int get_next_seq_offset(struct thread_data *td, struct fio_file *f,
assert(ddir_rw(ddir));
assert(ddir_rw(ddir));
+ /*
+ * If we reach the end for a time based run, reset us back to 0
+ * and invalidate the cache, if we need to.
+ */
if (f->last_pos[ddir] >= f->io_size + get_start_offset(td, f) &&
o->time_based) {
if (f->last_pos[ddir] >= f->io_size + get_start_offset(td, f) &&
o->time_based) {
- struct thread_options *o = &td->o;
- uint64_t io_size = f->io_size + (f->io_size % o->min_bs[ddir]);
-
- if (io_size > f->last_pos[ddir])
- f->last_pos[ddir] = 0;
- else
- f->last_pos[ddir] = f->last_pos[ddir] - io_size;
+ f->last_pos[ddir] = f->file_offset;
+ loop_cache_invalidate(td, f);
}
if (f->last_pos[ddir] < f->real_file_size) {
}
if (f->last_pos[ddir] < f->real_file_size) {
@@
-552,9
+563,9
@@
static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u,
if (!io_u_fits(td, io_u, minbs))
return 0;
if (!io_u_fits(td, io_u, minbs))
return 0;
- frand_max = rand_max(&td->bsrange_state);
+ frand_max = rand_max(&td->bsrange_state
[ddir]
);
do {
do {
- r = __rand(&td->bsrange_state);
+ r = __rand(&td->bsrange_state
[ddir]
);
if (!td->o.bssplit_nr[ddir]) {
buflen = 1 + (unsigned int) ((double) maxbs *
if (!td->o.bssplit_nr[ddir]) {
buflen = 1 + (unsigned int) ((double) maxbs *
@@
-662,7
+673,7
@@
int io_u_quiesce(struct thread_data *td)
static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir)
{
enum fio_ddir odir = ddir ^ 1;
static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir)
{
enum fio_ddir odir = ddir ^ 1;
-
long
usec;
+
uint64_t
usec;
uint64_t now;
assert(ddir_rw(ddir));
uint64_t now;
assert(ddir_rw(ddir));
@@
-1602,7
+1613,7
@@
static void small_content_scramble(struct io_u *io_u)
unsigned int i, nr_blocks = io_u->buflen / 512;
uint64_t boffset;
unsigned int offset;
unsigned int i, nr_blocks = io_u->buflen / 512;
uint64_t boffset;
unsigned int offset;
-
void
*p, *end;
+
char
*p, *end;
if (!nr_blocks)
return;
if (!nr_blocks)
return;
@@
-1779,7
+1790,7
@@
static void account_io_completion(struct thread_data *td, struct io_u *io_u,
if (td->parent)
td = td->parent;
if (td->parent)
td = td->parent;
- if (!td->o.stats)
+ if (!td->o.stats
|| td_ioengine_flagged(td, FIO_NOSTATS)
)
return;
if (no_reduce)
return;
if (no_reduce)
@@
-2188,7
+2199,7
@@
int do_io_u_trim(const struct thread_data *td, struct io_u *io_u)
struct fio_file *f = io_u->file;
int ret;
struct fio_file *f = io_u->file;
int ret;
- ret = os_trim(f
->fd
, io_u->offset, io_u->xfer_buflen);
+ ret = os_trim(f, io_u->offset, io_u->xfer_buflen);
if (!ret)
return io_u->xfer_buflen;
if (!ret)
return io_u->xfer_buflen;