*/
#include "gfapi.h"
+#include "../optgroup.h"
struct fio_option gfapi_options[] = {
{
}
dprint(FD_FILE, "fio setup %p\n", g->fs);
td->io_ops->data = g;
+ return 0;
cleanup:
- if (r) {
- if (g) {
- if (g->fs) {
- glfs_fini(g->fs);
- }
- free(g);
- td->io_ops->data = NULL;
- }
- }
+ if (g->fs)
+ glfs_fini(g->fs);
+ free(g);
+ td->io_ops->data = NULL;
return r;
}
free(b);
glfs_lseek(g->fd, 0, SEEK_SET);
- if (td->terminate) {
+ if (td->terminate && td->o.unlink) {
dprint(FD_FILE, "terminate unlink %s\n",
f->file_name);
- unlink(f->file_name);
+ glfs_unlink(g->fs, f->file_name);
} else if (td->o.create_fsync) {
if (glfs_fsync(g->fd) < 0) {
dprint(FD_FILE,
dprint(FD_FILE, "fio %p created %s\n", g->fs, f->file_name);
f->fd = -1;
f->shadow_fd = -1;
-
+ td->o.open_files ++;
return ret;
}
if (g) {
if (g->fd && glfs_close(g->fd) < 0)
ret = errno;
+ g->fd = NULL;
+ }
+
+ return ret;
+}
+
+int fio_gf_unlink_file(struct thread_data *td, struct fio_file *f)
+{
+ int ret = 0;
+ struct gf_data *g = td->io_ops->data;
+
+ dprint(FD_FILE, "fd unlink %s\n", f->file_name);
+
+ if (g) {
+ if (g->fd && glfs_close(g->fd) < 0)
+ ret = errno;
+
+ glfs_unlink(g->fs, f->file_name);
if (g->fs)
glfs_fini(g->fs);
free(g);
}
td->io_ops->data = NULL;
- f->engine_data = 0;
return ret;
}