projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
zbd: add a new --ignore_zone_limits option
[fio.git]
/
engines
/
falloc.c
diff --git
a/engines/falloc.c
b/engines/falloc.c
index 4977d9e2bcd178b30c08e467a31102390322b903..4b05ed68fb467263ddbebabe7e79dd5231f92b63 100644
(file)
--- a/
engines/falloc.c
+++ b/
engines/falloc.c
@@
-4,16
+4,12
@@
* IO engine that does regular fallocate to simulate data transfer
* as fio ioengine.
* DDIR_READ does fallocate(,mode = FALLOC_FL_KEEP_SIZE,)
* IO engine that does regular fallocate to simulate data transfer
* as fio ioengine.
* DDIR_READ does fallocate(,mode = FALLOC_FL_KEEP_SIZE,)
- * DDIR_WRITE does fallocate(,mode = 0) : fallocate with size exten
tion
+ * DDIR_WRITE does fallocate(,mode = 0) : fallocate with size exten
sion
* DDIR_TRIM does fallocate(,mode = FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)
*
*/
#include <stdio.h>
* DDIR_TRIM does fallocate(,mode = FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)
*
*/
#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/uio.h>
#include <errno.h>
#include <errno.h>
-#include <assert.h>
#include <fcntl.h>
#include "../fio.h"
#include <fcntl.h>
#include "../fio.h"
@@
-23,14
+19,14
@@
* generic_open_file is not appropriate because does not allow to perform
* TRIM in to file
*/
* generic_open_file is not appropriate because does not allow to perform
* TRIM in to file
*/
-int open_file(struct thread_data *td, struct fio_file *f)
+
static
int open_file(struct thread_data *td, struct fio_file *f)
{
int from_hash = 0;
dprint(FD_FILE, "fd open %s\n", f->file_name);
{
int from_hash = 0;
dprint(FD_FILE, "fd open %s\n", f->file_name);
- if (f->filetype != FIO_TYPE_FILE) {
- log_err("fio: only files are supported fallocate \n");
+ if (f->filetype != FIO_TYPE_FILE
&& f->filetype != FIO_TYPE_BLOCK
) {
+ log_err("fio: only files a
nd blockdev a
re supported fallocate \n");
return 1;
}
if (!strcmp(f->file_name, "-")) {
return 1;
}
if (!strcmp(f->file_name, "-")) {
@@
-43,9
+39,10
@@
open_again:
if (f->fd == -1) {
char buf[FIO_VERROR_SIZE];
if (f->fd == -1) {
char buf[FIO_VERROR_SIZE];
- int __e = errno;
- snprintf(buf, sizeof(buf) - 1, "open(%s)", f->file_name);
- td_verror(td, __e, buf);
+ int e = errno;
+
+ snprintf(buf, sizeof(buf), "open(%s)", f->file_name);
+ td_verror(td, e, buf);
}
if (!from_hash && f->fd != -1) {
}
if (!from_hash && f->fd != -1) {
@@
-68,8
+65,10
@@
open_again:
#endif
#ifndef FALLOC_FL_PUNCH_HOLE
#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
#endif
#ifndef FALLOC_FL_PUNCH_HOLE
#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
-#endif
-static int fio_fallocate_queue(struct thread_data *td, struct io_u *io_u)
+#endif
+
+static enum fio_q_status fio_fallocate_queue(struct thread_data *td,
+ struct io_u *io_u)
{
struct fio_file *f = io_u->file;
int ret;
{
struct fio_file *f = io_u->file;
int ret;
@@
-86,14
+85,8
@@
static int fio_fallocate_queue(struct thread_data *td, struct io_u *io_u)
ret = fallocate(f->fd, flags, io_u->offset, io_u->xfer_buflen);
ret = fallocate(f->fd, flags, io_u->offset, io_u->xfer_buflen);
- if (ret)
{
+ if (ret)
io_u->error = errno;
io_u->error = errno;
- if (io_u->error)
- td_verror(td, io_u->error, "xfer");
- }
-
- if (io_u->file && ret == 0 && ddir_rw(io_u->ddir))
- io_u->file->file_pos = io_u->offset + ret;
return FIO_Q_COMPLETED;
}
return FIO_Q_COMPLETED;
}