projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gclient: bump output time buf size
[fio.git]
/
trim.c
diff --git
a/trim.c
b/trim.c
index 434554129453915515a5b64d47bbed6e914bf765..bf825db346df0596b63b88f6e755e7b7985965ca 100644
(file)
--- a/
trim.c
+++ b/
trim.c
@@
-1,17
+1,14
@@
/*
* TRIM/DISCARD support
*/
/*
* TRIM/DISCARD support
*/
-#include <unistd.h>
-#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <string.h>
#include <assert.h>
-#include <pthread.h>
#include "fio.h"
#include "trim.h"
#ifdef FIO_HAVE_TRIM
#include "fio.h"
#include "trim.h"
#ifdef FIO_HAVE_TRIM
-
int
get_next_trim(struct thread_data *td, struct io_u *io_u)
+
bool
get_next_trim(struct thread_data *td, struct io_u *io_u)
{
struct io_piece *ipo;
{
struct io_piece *ipo;
@@
-19,9
+16,9
@@
int get_next_trim(struct thread_data *td, struct io_u *io_u)
* this io_u is from a requeue, we already filled the offsets
*/
if (io_u->file)
* this io_u is from a requeue, we already filled the offsets
*/
if (io_u->file)
- return
0
;
+ return
true
;
if (flist_empty(&td->trim_list))
if (flist_empty(&td->trim_list))
- return
1
;
+ return
false
;
assert(td->trim_entries);
ipo = flist_first_entry(&td->trim_list, struct io_piece, trim_list);
assert(td->trim_entries);
ipo = flist_first_entry(&td->trim_list, struct io_piece, trim_list);
@@
-53,7
+50,7
@@
int get_next_trim(struct thread_data *td, struct io_u *io_u)
if (r) {
dprint(FD_VERIFY, "failed file %s open\n",
io_u->file->file_name);
if (r) {
dprint(FD_VERIFY, "failed file %s open\n",
io_u->file->file_name);
- return
1
;
+ return
false
;
}
}
}
}
@@
-64,17
+61,17
@@
int get_next_trim(struct thread_data *td, struct io_u *io_u)
io_u->xfer_buflen = io_u->buflen;
dprint(FD_VERIFY, "get_next_trim: ret io_u %p\n", io_u);
io_u->xfer_buflen = io_u->buflen;
dprint(FD_VERIFY, "get_next_trim: ret io_u %p\n", io_u);
- return
0
;
+ return
true
;
}
}
-
int
io_u_should_trim(struct thread_data *td, struct io_u *io_u)
+
bool
io_u_should_trim(struct thread_data *td, struct io_u *io_u)
{
unsigned long long val;
uint64_t frand_max;
unsigned long r;
if (!td->o.trim_percentage)
{
unsigned long long val;
uint64_t frand_max;
unsigned long r;
if (!td->o.trim_percentage)
- return
0
;
+ return
false
;
frand_max = rand_max(&td->trim_state);
r = __rand(&td->trim_state);
frand_max = rand_max(&td->trim_state);
r = __rand(&td->trim_state);