From a0591c4370b621d3962f6a8e44fe8ee0c12a8fc2 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 27 Jul 2016 18:06:17 +0000 Subject: [PATCH] Linux 4.8 compat: REQ_PREFLUSH The REQ_FLUSH flag was renamed REQ_PREFLUSH to avoid confusion with REQ_OP_FLUSH. See https://github.com/torvalds/linux/commit/28a8f0d3 for complete details. Signed-off-by: Tim Chase Signed-off-by: Chunwei Chen Signed-off-by: Brian Behlendorf Issue #4892 Issue #4899 --- include/linux/blkdev_compat.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h index 2b553bd23a..748963be81 100644 --- a/include/linux/blkdev_compat.h +++ b/include/linux/blkdev_compat.h @@ -303,12 +303,23 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags) * The existence of these flags implies that REQ_FLUSH an REQ_FUA are * defined. Thus we can safely define VDEV_REQ_FLUSH and VDEV_REQ_FUA * compatibility macros. + * + * Linux 4.8 renamed the REQ_FLUSH to REQ_PREFLUSH but there was no + * functional change in behavior. */ #ifdef WRITE_FLUSH_FUA + #define VDEV_WRITE_FLUSH_FUA WRITE_FLUSH_FUA -#define VDEV_REQ_FLUSH REQ_FLUSH +#ifdef REQ_PREFLUSH +#define VDEV_REQ_FLUSH REQ_PREFLUSH #define VDEV_REQ_FUA REQ_FUA #else +#define VDEV_REQ_FLUSH REQ_FLUSH +#define VDEV_REQ_FUA REQ_FUA +#endif + +#else + #define VDEV_WRITE_FLUSH_FUA WRITE_BARRIER #ifdef HAVE_BIO_RW_BARRIER #define VDEV_REQ_FLUSH (1 << BIO_RW_BARRIER) @@ -317,6 +328,7 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags) #define VDEV_REQ_FLUSH REQ_HARDBARRIER #define VDEV_REQ_FUA REQ_FUA #endif + #endif /*