+/*
+ * 2.6.24 API change,
+ * The bio_end_io() prototype changed slightly. These are helper
+ * macro's to ensure the prototype and return value are handled.
+ */
+#ifdef HAVE_2ARGS_BIO_END_IO_T
+# define BIO_END_IO_PROTO(fn, x, y, z) static void fn(struct bio *x, int z)
+# define BIO_END_IO_RETURN(rc) return
+#else
+# define BIO_END_IO_PROTO(fn, x, y, z) static int fn(struct bio *x, \
+ unsigned int y, int z)
+# define BIO_END_IO_RETURN(rc) return rc
+#endif /* HAVE_2ARGS_BIO_END_IO_T */
+
+/*
+ * 2.6.28 API change
+ * Used to exclusively open a block device from within the kernel.
+ */
+#ifdef HAVE_OPEN_BDEV_EXCLUSIVE
+# define vdev_bdev_open(path, md, hld) open_bdev_exclusive(path, md, hld)
+# define vdev_bdev_close(bdev, md) close_bdev_exclusive(bdev, md)
+#else
+# define vdev_bdev_open(path, md, hld) open_bdev_excl(path, md, hld)
+# define vdev_bdev_close(bdev, md) close_bdev_excl(bdev)
+#endif /* HAVE_OPEN_BDEV_EXCLUSIVE */
+
+/*
+ * 2.6.22 API change
+ * The function invalidate_bdev() lost it's second argument because
+ * it was unused.
+ */
+#ifdef HAVE_1ARG_INVALIDATE_BDEV
+# define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev)
+#else
+# define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev, 1)
+#endif /* HAVE_1ARG_INVALIDATE_BDEV */
+
+/*
+ * 2.6.30 API change
+ * Change to make it explicit there this is the logical block size.
+ */
+#ifdef HAVE_BDEV_LOGICAL_BLOCK_SIZE
+# define vdev_bdev_block_size(bdev) bdev_logical_block_size(bdev)
+#else
+# define vdev_bdev_block_size(bdev) bdev_hardsect_size(bdev)
+#endif
+
+/*
+ * Default Linux IO Scheduler,
+ * Setting the scheduler to noop will allow the Linux IO scheduler to
+ * still perform front and back merging, while leaving the request
+ * ordering and prioritization to the ZFS IO scheduler.
+ */
+#define VDEV_SCHEDULER "noop"