Add unmap hook that belongs to the IO engines
authorJens Axboe <jens.axboe@oracle.com>
Tue, 4 Sep 2007 13:17:09 +0000 (15:17 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 4 Sep 2007 13:17:09 +0000 (15:17 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.h
io_u.c

diff --git a/fio.h b/fio.h
index c202b0dc31346d475e322823b536b4eaa301b643..fe314bfde1eebd1e18ed6178103ce33ec9ff5f3d 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -175,6 +175,11 @@ struct io_u {
         * Callback for io completion
         */
        int (*end_io)(struct thread_data *, struct io_u *);
+
+       /*
+        * Called when io_u is about to be freed
+        */
+       void (*unmap)(struct thread_data *, struct io_u *);
 };
 
 /*
diff --git a/io_u.c b/io_u.c
index 4750ac600a4272142bc85ccf9333382fcb1a4d28..1a68ad1171c2a175950f6ac20ac5bcdf1f1803c9 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -770,6 +770,8 @@ static void io_completed(struct thread_data *td, struct io_u *io_u,
                        if (ret && !icd->error)
                                icd->error = ret;
                }
+               if (io_u->unmap)
+                       io_u->unmap(td, io_u);
        } else {
                icd->error = io_u->error;
                io_u_log_error(td, io_u);