From: Jens Axboe Date: Tue, 8 Nov 2005 08:22:00 +0000 (+0100) Subject: [PATCH] fio: td_write() X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=62bb42859cc0fac377607834b0162ab338f12349;p=disktools.git [PATCH] fio: td_write() --- diff --git a/fio.c b/fio.c index 6366f22..f67d372 100644 --- a/fio.c +++ b/fio.c @@ -230,7 +230,8 @@ struct verify_header { }; #define td_read(td) ((td)->ddir == DDIR_READ) -#define should_fsync(td) (!td_read(td) && !(td)->odirect) +#define td_write(td) ((td)->ddir == DDIR_WRITE) +#define should_fsync(td) (td_write(td) && !(td)->odirect) #define BLOCKS_PER_MAP (8 * sizeof(long)) #define RAND_MAP_IDX(sector) ((sector) / BLOCKS_PER_MAP) @@ -970,7 +971,7 @@ static void do_sync_io(struct thread_data *td) break; } - if (!td_read(td)) + if (td_write(td)) log_io_piece(td, io_u); td->io_blocks++; @@ -1072,7 +1073,7 @@ static int ios_completed(struct thread_data *td, int nr) add_clat_sample(td, msec); add_bw_sample(td); - if (!td_read(td)) + if (td_write(td)) log_io_piece(td, io_u); bytes_done += io_u->buflen; @@ -1405,7 +1406,7 @@ static int create_file(struct thread_data *td) /* * unless specifically asked for overwrite, let normal io extend it */ - if (!td_read(td) && !td->overwrite) + if (td_write(td) && !td->overwrite) return 0; if (!td->file_size) { @@ -1560,7 +1561,7 @@ static int setup_file(struct thread_data *td) if (get_file_size(td)) return 1; - if (!td_read(td) && ftruncate(td->fd, td->file_size) == -1) { + if (td_write(td) && ftruncate(td->fd, td->file_size) == -1) { td->error = errno; return 1; }