summaryrefslogtreecommitdiff
path: root/io_u.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2017-11-30 07:03:33 -0700
committerJens Axboe <axboe@kernel.dk>2017-11-30 07:03:33 -0700
commitc9a7305461ffe8f22a4295a40e9cc919175d51e7 (patch)
tree2454b3c6f420e46d047ae71dbdee148c8ea8cb9f /io_u.c
parent63f87de888df01e7ed93dc0afee0d0193e43a084 (diff)
downloadfio-c9a7305461ffe8f22a4295a40e9cc919175d51e7.tar.gz
fio-c9a7305461ffe8f22a4295a40e9cc919175d51e7.tar.bz2
io_u: cleanup check_get_trim()
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_u.c')
-rw-r--r--io_u.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/io_u.c b/io_u.c
index c2585427..086384a1 100644
--- a/io_u.c
+++ b/io_u.c
@@ -1615,22 +1615,19 @@ static bool check_get_trim(struct thread_data *td, struct io_u *io_u)
{
if (!(td->flags & TD_F_TRIM_BACKLOG))
return false;
+ if (!td->trim_entries)
+ return false;
- if (td->trim_entries) {
- int get_trim = 0;
-
- if (td->trim_batch) {
- td->trim_batch--;
- get_trim = 1;
- } else if (!(td->io_hist_len % td->o.trim_backlog) &&
- td->last_ddir != DDIR_READ) {
- td->trim_batch = td->o.trim_batch;
- if (!td->trim_batch)
- td->trim_batch = td->o.trim_backlog;
- get_trim = 1;
- }
-
- if (get_trim && get_next_trim(td, io_u))
+ if (td->trim_batch) {
+ td->trim_batch--;
+ if (get_next_trim(td, io_u))
+ return true;
+ } else if (!(td->io_hist_len % td->o.trim_backlog) &&
+ td->last_ddir != DDIR_READ) {
+ td->trim_batch = td->o.trim_batch;
+ if (!td->trim_batch)
+ td->trim_batch = td->o.trim_backlog;
+ if (get_next_trim(td, io_u))
return true;
}