Add unlink hook to ioengine API, gluster ioengine
fio would just call unlink even with engines that are not using the
operating systems file namespace... This provides a hook to allow
overriding that, with a default handler, and implements it for the
gluster ioengine.
There are others which it'd probably make sense I'm sure.
Huamin Chen looked over my changes to the gluster code earlier...
>I like this unlink idea, it would be great if you can also make unlink optional (if my coding reading is correct). This looks a great pull request candidate to fio. Please ping Axboe after you are done. He is not actively watching pull requests.
>Please also feel free to augment gluster code and pull me for review if necessary.
-castor
Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/ioengines.c b/ioengines.c
index 0f94d0d..3010f6c 100644
--- a/ioengines.c
+++ b/ioengines.c
@@ -506,6 +506,14 @@
return put_file(td, f);
}
+int td_io_unlink_file(struct thread_data *td, struct fio_file *f)
+{
+ if (td->io_ops->unlink_file)
+ return td->io_ops->unlink_file(td, f);
+ else
+ return unlink(f->file_name);
+}
+
int td_io_get_file_size(struct thread_data *td, struct fio_file *f)
{
if (!td->io_ops->get_file_size)