If we have drained the list of trim operations but its original contents
were fewer than a full batch we should zero out the running batch count
to make sure that we issue another full set of trim_backlog write
operations before considering trims again. Otherwise we will immediately
trim after each subsequent write operation until we have met the batch
size requirement.
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
{
if (!(td->flags & TD_F_TRIM_BACKLOG))
return false;
- if (!td->trim_entries)
+ if (!td->trim_entries) {
+ td->trim_batch = 0;
return false;
+ }
if (td->trim_batch) {
td->trim_batch--;
if (get_next_trim(td, io_u))
return true;
+ else
+ td->trim_batch = 0;
} else if (!(td->io_hist_len % td->o.trim_backlog) &&
td->last_ddir_completed != DDIR_READ) {
td->trim_batch = td->o.trim_batch;