From e1441fd9e87aedb51758121508541e5f382588a7 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 11 Aug 2016 14:58:13 -0700 Subject: [PATCH] Reorder HAVE_BIO_RW_* checks The HAVE_BIO_RW_* #ifdef's must appear before REQ_* #ifdef's in the bio_is_flush() and bio_is_discard() macros. Linux 2.6.32 era kernels defined both of values and the HAVE_BIO_RW_* must be used in this case. This resulted in a panic in zconfig test 5. Signed-off-by: Brian Behlendorf Issue #4951 --- include/linux/blkdev_compat.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h index aa7e6b498df8..666d32de904a 100644 --- a/include/linux/blkdev_compat.h +++ b/include/linux/blkdev_compat.h @@ -336,10 +336,10 @@ bio_is_flush(struct bio *bio) return (bio->bi_opf & REQ_PREFLUSH); #elif defined(REQ_PREFLUSH) && !defined(HAVE_BIO_BI_OPF) return (bio->bi_rw & REQ_PREFLUSH); -#elif defined(REQ_FLUSH) - return (bio->bi_rw & REQ_FLUSH); #elif defined(HAVE_BIO_RW_BARRIER) return (bio->bi_rw & (1 << BIO_RW_BARRIER)); +#elif defined(REQ_FLUSH) + return (bio->bi_rw & REQ_FLUSH); #else #error "Allowing the build will cause flush requests to be ignored. Please " "file an issue report at: https://github.com/zfsonlinux/zfs/issues/new" @@ -384,10 +384,10 @@ bio_is_discard(struct bio *bio) { #if defined(HAVE_REQ_OP_DISCARD) return (bio_op(bio) == REQ_OP_DISCARD); -#elif defined(REQ_DISCARD) - return (bio->bi_rw & REQ_DISCARD); #elif defined(HAVE_BIO_RW_DISCARD) return (bio->bi_rw & (1 << BIO_RW_DISCARD)); +#elif defined(REQ_DISCARD) + return (bio->bi_rw & REQ_DISCARD); #else #error "Allowing the build will cause discard requests to become writes " "potentially triggering the DMU_MAX_ACCESS assertion. Please file "