VN=`git describe --match "fio-[0-9]*" --abbrev=4 HEAD 2>/dev/null` &&
case "$VN" in
*$LF*) (exit 1) ;;
- v[0-9]*)
+ fio-[0-9]*)
git update-index -q --refresh
test -z "`git diff-index --name-only HEAD --`" ||
VN="$VN-dirty" ;;
echo >&2 "FIO_VERSION = $VN"
echo "FIO_VERSION = $VN" >$GVF
}
-
-
* the rusage_sem, which would never get upped because
* this thread is waiting for the stat mutex.
*/
- check_update_rusage(td);
+ do {
+ check_update_rusage(td);
+ if (!fio_mutex_down_trylock(stat_mutex))
+ break;
+ usleep(1000);
+ } while (1);
- fio_mutex_down(stat_mutex);
if (td_read(td) && td->io_bytes[DDIR_READ])
update_runtime(td, elapsed_us, DDIR_READ);
if (td_write(td) && td->io_bytes[DDIR_WRITE])
iodepth=256
numjobs=4
bssplit=512/4:1024/1:1536/1:2048/1:2560/1:3072/1:3584/1:4k/67:8k/10:16k/7:32k/3:64k/3
+blockalign=4k
random_distribution=zoned:50/5:30/15:20/80
filename=/dev/nvme0n1
group_reporting=1
extern void free_release_files(struct thread_data *);
extern void filesetup_mem_free(void);
extern void fio_file_reset(struct thread_data *, struct fio_file *);
-extern int fio_files_done(struct thread_data *);
+extern bool fio_files_done(struct thread_data *);
extern bool exists_and_not_regfile(const char *);
#endif
return ff;
}
-static int __fio_lock_file(const char *fname, int trylock)
+static bool __fio_lock_file(const char *fname, int trylock)
{
struct fio_filelock *ff;
uint32_t hash;
if (!ff) {
assert(!trylock);
- return 1;
+ return true;
}
if (!trylock) {
fio_mutex_down(&ff->lock);
- return 0;
+ return false;
}
if (!fio_mutex_down_trylock(&ff->lock))
- return 0;
+ return false;
fio_mutex_down(&fld->lock);
if (ff) {
fio_mutex_down(&ff->lock);
- return 0;
+ return false;
}
- return 1;
+ return true;
}
-int fio_trylock_file(const char *fname)
+bool fio_trylock_file(const char *fname)
{
return __fio_lock_file(fname, 1);
}
#ifndef FIO_LOCK_FILE_H
#define FIO_LOCK_FILE_H
+#include "lib/types.h"
+
extern void fio_lock_file(const char *);
-extern int fio_trylock_file(const char *);
+extern bool fio_trylock_file(const char *);
extern void fio_unlock_file(const char *);
extern int fio_filelock_init(void);
}
}
-
static void free_already_allocated(void)
{
struct flist_head *entry, *tmp;
lfsr_reset(&f->lfsr, td->rand_seeds[FIO_RAND_BLOCK_OFF]);
}
-int fio_files_done(struct thread_data *td)
+bool fio_files_done(struct thread_data *td)
{
struct fio_file *f;
unsigned int i;
for_each_file(td, f, i)
if (!fio_file_done(f))
- return 0;
+ return false;
- return 1;
+ return true;
}
/* free memory used in initialization phase only */
get_trim = 1;
}
- if (get_trim && !get_next_trim(td, io_u))
+ if (get_trim && get_next_trim(td, io_u))
return true;
}
#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;
* 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))
- return 1;
+ return false;
assert(td->trim_entries);
ipo = flist_first_entry(&td->trim_list, struct io_piece, trim_list);
if (r) {
dprint(FD_VERIFY, "failed file %s open\n",
io_u->file->file_name);
- return 1;
+ return false;
}
}
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)
- return 0;
+ return false;
frand_max = rand_max(&td->trim_state);
r = __rand(&td->trim_state);
#include "fio.h"
#ifdef FIO_HAVE_TRIM
-extern int __must_check get_next_trim(struct thread_data *td, struct io_u *io_u);
-extern int io_u_should_trim(struct thread_data *td, struct io_u *io_u);
+extern bool __must_check get_next_trim(struct thread_data *td, struct io_u *io_u);
+extern bool io_u_should_trim(struct thread_data *td, struct io_u *io_u);
/*
* Determine whether a given io_u should be logged for verify or
}
#else
-static inline int get_next_trim(struct thread_data *td, struct io_u *io_u)
+static inline bool get_next_trim(struct thread_data *td, struct io_u *io_u)
{
- return 1;
+ return false;
}
-static inline int io_u_should_trim(struct thread_data *td, struct io_u *io_u)
+static inline bool io_u_should_trim(struct thread_data *td, struct io_u *io_u)
{
- return 0;
+ return false;
}
static inline void remove_trim_entry(struct thread_data *td, struct io_piece *ipo)
{