engines/rbd: add support for rbd_invalidate_cache()
authorJens Axboe <axboe@fb.com>
Tue, 28 Oct 2014 15:00:06 +0000 (09:00 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 28 Oct 2014 15:00:06 +0000 (09:00 -0600)
Signed-off-by: Jens Axboe <axboe@fb.com>
configure
engines/rbd.c

index 58f02fa57ed51f1721dc79f3c19cfcacde6f6af1..da637a9733da8b92d54b574efb5c092b21f65045 100755 (executable)
--- a/configure
+++ b/configure
@@ -1202,6 +1202,26 @@ if test "$disable_rbd" != "yes"  && compile_prog "" "-lrbd -lrados" "rbd"; then
 fi
 echo "Rados Block Device engine     $rbd"
 
+##########################################
+# check for rbd_invaidate_cache()
+rbd_inval="no"
+if test "$rbd" = "yes"; then
+cat > $TMPC << EOF
+#include <rbd/librbd.h>
+
+int main(int argc, char **argv)
+{
+  rbd_image_t image;
+
+  return rbd_invalidate_cache(image);
+}
+EOF
+if compile_prog "" "-lrbd -lrados" "rbd"; then
+  rbd_inval="yes"
+fi
+echo "rbd_invalidate_cache          $rbd_inval"
+fi
+
 ##########################################
 # Check whether we have setvbuf
 setvbuf="no"
@@ -1489,6 +1509,9 @@ fi
 if test "$rbd" = "yes" ; then
   output_sym "CONFIG_RBD"
 fi
+if test "$rbd_inval" = "yes" ; then
+  output_sym "CONFIG_RBD_INVAL"
+fi
 if test "$setvbuf" = "yes" ; then
   output_sym "CONFIG_SETVBUF"
 fi
index 5160c32aedb09aa2b1e780e9a04625e1ae653a55..e4155da2f97194c961ada6d42563bf182836a9ff 100644 (file)
@@ -445,7 +445,13 @@ static int fio_rbd_open(struct thread_data *td, struct fio_file *f)
 
 static int fio_rbd_invalidate(struct thread_data *td, struct fio_file *f)
 {
+#if defined(CONFIG_RBD_INVAL)
+       struct rbd_data *rbd_data = td->io_ops->data;
+
+       return rbd_invalidate_cache(rbd_data->image);
+#else
        return 0;
+#endif
 }
 
 static void fio_rbd_io_u_free(struct thread_data *td, struct io_u *io_u)