summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2018-10-23 18:05:41 -0600
committerJens Axboe <axboe@kernel.dk>2018-10-24 05:00:53 -0600
commitd7e92306bde2117702ed96b7c5647d9485869047 (patch)
treea79115774b03d3f5c2fe9a2bf29f6335e5036f53
parent425d3e0ee60f195df202fcd389d76a6671e76b05 (diff)
downloadfio-d7e92306bde2117702ed96b7c5647d9485869047.tar.gz
fio-d7e92306bde2117702ed96b7c5647d9485869047.tar.bz2
io_u: move trim error notification out-of-line
Also kill dead code, we never touch BLOCK_STATE_WRITTEN as it was guarded by a check for ddir == DDIR_TRIM. The latter should probably be double checked... Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--io_u.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/io_u.c b/io_u.c
index a3540d14..56abe6fd 100644
--- a/io_u.c
+++ b/io_u.c
@@ -1798,6 +1798,16 @@ static inline bool gtod_reduce(struct thread_data *td)
|| td->o.gtod_reduce;
}
+static void trim_block_info(struct thread_data *td, struct io_u *io_u)
+{
+ uint32_t *info = io_u_block_info(td, io_u);
+
+ if (BLOCK_INFO_STATE(*info) >= BLOCK_STATE_TRIM_FAILURE)
+ return;
+
+ *info = BLOCK_INFO(BLOCK_STATE_TRIMMED, BLOCK_INFO_TRIMS(*info) + 1);
+}
+
static void account_io_completion(struct thread_data *td, struct io_u *io_u,
struct io_completion_data *icd,
const enum fio_ddir idx, unsigned int bytes)
@@ -1849,18 +1859,8 @@ static void account_io_completion(struct thread_data *td, struct io_u *io_u,
} else if (ddir_sync(idx) && !td->o.disable_clat)
add_sync_clat_sample(&td->ts, llnsec);
- if (td->ts.nr_block_infos && io_u->ddir == DDIR_TRIM) {
- uint32_t *info = io_u_block_info(td, io_u);
- if (BLOCK_INFO_STATE(*info) < BLOCK_STATE_TRIM_FAILURE) {
- if (io_u->ddir == DDIR_TRIM) {
- *info = BLOCK_INFO(BLOCK_STATE_TRIMMED,
- BLOCK_INFO_TRIMS(*info) + 1);
- } else if (io_u->ddir == DDIR_WRITE) {
- *info = BLOCK_INFO_SET_STATE(BLOCK_STATE_WRITTEN,
- *info);
- }
- }
- }
+ if (td->ts.nr_block_infos && io_u->ddir == DDIR_TRIM)
+ trim_block_info(td, io_u);
}
static void file_log_write_comp(const struct thread_data *td, struct fio_file *f,