aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/blkdev_compat.h25
-rw-r--r--include/sys/vdev_disk.h2
2 files changed, 21 insertions, 6 deletions
diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h
index 748963be8..ec301ee9b 100644
--- a/include/linux/blkdev_compat.h
+++ b/include/linux/blkdev_compat.h
@@ -332,15 +332,30 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags)
#endif
/*
- * 2.6.32 API change
- * Use the normal I/O patch for discards.
+ * 2.6.28 - 2.6.35 API,
+ * BIO_RW_DISCARD
+ *
+ * 2.6.36 - 4.7 API,
+ * REQ_DISCARD
+ *
+ * 4.8 - 4.x API,
+ * REQ_OP_DISCARD
+ *
+ * In all cases the normal I/O path is used for discards. The only
+ * difference is how the kernel tags individual I/Os as discards.
*/
#ifdef QUEUE_FLAG_DISCARD
-#ifdef HAVE_BIO_RW_DISCARD
-#define VDEV_REQ_DISCARD (1 << BIO_RW_DISCARD)
+static inline boolean_t
+bio_is_discard(struct bio *bio)
+{
+#if defined(HAVE_BIO_RW_DISCARD)
+ return (bio->bi_rw & (1 << BIO_RW_DISCARD));
+#elif defined(REQ_DISCARD)
+ return (bio->bi_rw & REQ_DISCARD);
#else
-#define VDEV_REQ_DISCARD REQ_DISCARD
+ return (bio_op(bio) == REQ_OP_DISCARD);
#endif
+}
#else
#error "Allowing the build will cause discard requests to become writes "
"potentially triggering the DMU_MAX_ACCESS assertion. Please file a "
diff --git a/include/sys/vdev_disk.h b/include/sys/vdev_disk.h
index d5a1889d2..cf8028d2a 100644
--- a/include/sys/vdev_disk.h
+++ b/include/sys/vdev_disk.h
@@ -38,7 +38,7 @@ typedef struct vdev_disk {
} vdev_disk_t;
extern int vdev_disk_physio(struct block_device *, caddr_t,
- size_t, uint64_t, int);
+ size_t, uint64_t, int, int);
extern int vdev_disk_read_rootlabel(char *, char *, nvlist_t **);
#endif /* _KERNEL */