projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactor #includes and headers
[fio.git]
/
filesetup.c
diff --git
a/filesetup.c
b/filesetup.c
index 30af085d0b33e3eb4ee6fd490fee0a01018d368b..c115f7b16863a88f411427a424be06f3f558e56a 100644
(file)
--- a/
filesetup.c
+++ b/
filesetup.c
@@
-5,8
+5,6
@@
#include <dirent.h>
#include <libgen.h>
#include <sys/stat.h>
#include <dirent.h>
#include <libgen.h>
#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/types.h>
#include "fio.h"
#include "smalloc.h"
#include "fio.h"
#include "smalloc.h"
@@
-15,13
+13,12
@@
#include "os/os.h"
#include "hash.h"
#include "lib/axmap.h"
#include "os/os.h"
#include "hash.h"
#include "lib/axmap.h"
+#include "rwlock.h"
#ifdef CONFIG_LINUX_FALLOCATE
#include <linux/falloc.h>
#endif
#ifdef CONFIG_LINUX_FALLOCATE
#include <linux/falloc.h>
#endif
-static int root_warn;
-
static FLIST_HEAD(filename_list);
/*
static FLIST_HEAD(filename_list);
/*
@@
-490,6
+487,10
@@
static int __file_invalidate_cache(struct thread_data *td, struct fio_file *f,
ret = td->io_ops->invalidate(td, f);
if (ret < 0)
errval = -ret;
ret = td->io_ops->invalidate(td, f);
if (ret < 0)
errval = -ret;
+ } else if (td_ioengine_flagged(td, FIO_DISKLESSIO)) {
+ dprint(FD_IO, "invalidate not supported by ioengine %s\n",
+ td->io_ops->name);
+ ret = 0;
} else if (f->filetype == FIO_TYPE_FILE) {
dprint(FD_IO, "declare unneeded cache %s: %llu/%llu\n",
f->file_name, off, len);
} else if (f->filetype == FIO_TYPE_FILE) {
dprint(FD_IO, "declare unneeded cache %s: %llu/%llu\n",
f->file_name, off, len);
@@
-512,10
+513,9
@@
static int __file_invalidate_cache(struct thread_data *td, struct fio_file *f,
ret = blockdev_invalidate_cache(f);
}
if (ret < 0 && errno == EACCES && geteuid()) {
ret = blockdev_invalidate_cache(f);
}
if (ret < 0 && errno == EACCES && geteuid()) {
- if (!
root_warn
) {
+ if (!
fio_did_warn(FIO_WARN_ROOT_FLUSH)
) {
log_err("fio: only root may flush block "
"devices. Cache flush bypassed!\n");
log_err("fio: only root may flush block "
"devices. Cache flush bypassed!\n");
- root_warn = 1;
}
ret = 0;
}
}
ret = 0;
}
@@
-1035,7
+1035,7
@@
int setup_files(struct thread_data *td)
if (f->io_size == -1ULL)
total_size = -1ULL;
else {
if (f->io_size == -1ULL)
total_size = -1ULL;
else {
- if (o->size_percent) {
+ if (o->size_percent
&& o->size_percent != 100
) {
uint64_t file_size;
file_size = f->io_size + f->file_offset;
uint64_t file_size;
file_size = f->io_size + f->file_offset;
@@
-1480,7
+1480,7
@@
static struct fio_file *alloc_new_file(struct thread_data *td)
if (td_ioengine_flagged(td, FIO_NOFILEHASH))
f = calloc(1, sizeof(*f));
else
if (td_ioengine_flagged(td, FIO_NOFILEHASH))
f = calloc(1, sizeof(*f));
else
- f = s
malloc(
sizeof(*f));
+ f = s
calloc(1,
sizeof(*f));
if (!f) {
assert(0);
return NULL;
if (!f) {
assert(0);
return NULL;
@@
-1620,7
+1620,7
@@
int add_file(struct thread_data *td, const char *fname, int numjob, int inc)
f->rwlock = fio_rwlock_init();
break;
case FILE_LOCK_EXCLUSIVE:
f->rwlock = fio_rwlock_init();
break;
case FILE_LOCK_EXCLUSIVE:
- f->lock = fio_
mutex_init(FIO_MUTEX
_UNLOCKED);
+ f->lock = fio_
sem_init(FIO_SEM
_UNLOCKED);
break;
default:
log_err("fio: unknown lock mode: %d\n", td->o.file_lock_mode);
break;
default:
log_err("fio: unknown lock mode: %d\n", td->o.file_lock_mode);
@@
-1705,7
+1705,7
@@
void lock_file(struct thread_data *td, struct fio_file *f, enum fio_ddir ddir)
else
fio_rwlock_write(f->rwlock);
} else if (td->o.file_lock_mode == FILE_LOCK_EXCLUSIVE)
else
fio_rwlock_write(f->rwlock);
} else if (td->o.file_lock_mode == FILE_LOCK_EXCLUSIVE)
- fio_
mutex
_down(f->lock);
+ fio_
sem
_down(f->lock);
td->file_locks[f->fileno] = td->o.file_lock_mode;
}
td->file_locks[f->fileno] = td->o.file_lock_mode;
}
@@
-1718,7
+1718,7
@@
void unlock_file(struct thread_data *td, struct fio_file *f)
if (td->o.file_lock_mode == FILE_LOCK_READWRITE)
fio_rwlock_unlock(f->rwlock);
else if (td->o.file_lock_mode == FILE_LOCK_EXCLUSIVE)
if (td->o.file_lock_mode == FILE_LOCK_READWRITE)
fio_rwlock_unlock(f->rwlock);
else if (td->o.file_lock_mode == FILE_LOCK_EXCLUSIVE)
- fio_
mutex
_up(f->lock);
+ fio_
sem
_up(f->lock);
td->file_locks[f->fileno] = FILE_LOCK_NONE;
}
td->file_locks[f->fileno] = FILE_LOCK_NONE;
}