diff options
author | Tony Hutter <[email protected]> | 2017-03-08 09:20:21 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-03-08 09:20:21 -0800 |
commit | 463009865fb4398b32a825d7c00cd8a942637fae (patch) | |
tree | d0e057b5f6787310aeffc76f4aec63807e8b9b5e /include | |
parent | 423e7b62613d0a359e488cf2599a44174d073805 (diff) |
Fix harmless "BARRIER is deprecated" kernel warning on Centos 6.8
A one time warning after module load that "BARRIER is deprecated" was seen
on the heavily patched 2.6.32-642.13.1.el6.x86_64 Centos 6.8 kernel. It seems
that kernel had both the old BARRIER and the newer FLUSH/FUA interfaces
defined. This fixes the warning by prefering the newer FLUSH/FUA interface
if it's available.
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #5739
Closes #5828
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/blkdev_compat.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h index 881c038a8..ad095cdf1 100644 --- a/include/linux/blkdev_compat.h +++ b/include/linux/blkdev_compat.h @@ -343,12 +343,12 @@ bio_set_op_attrs(struct bio *bio, unsigned rw, unsigned flags) static inline void bio_set_flush(struct bio *bio) { -#if defined(WRITE_BARRIER) /* < 2.6.37 */ - bio_set_op_attrs(bio, 0, WRITE_BARRIER); +#if defined(REQ_PREFLUSH) /* >= 4.10 */ + bio_set_op_attrs(bio, 0, REQ_PREFLUSH); #elif defined(WRITE_FLUSH_FUA) /* >= 2.6.37 and <= 4.9 */ bio_set_op_attrs(bio, 0, WRITE_FLUSH_FUA); -#elif defined(REQ_PREFLUSH) /* >= 4.10 */ - bio_set_op_attrs(bio, 0, REQ_PREFLUSH); +#elif defined(WRITE_BARRIER) /* < 2.6.37 */ + bio_set_op_attrs(bio, 0, WRITE_BARRIER); #else #error "Allowing the build will cause bio_set_flush requests to be ignored." #endif @@ -373,9 +373,6 @@ bio_set_flush(struct bio *bio) * in all cases but may have a performance impact for some kernels. It * has the advantage of minimizing kernel specific changes in the zvol code. * - * Note that 2.6.32 era kernels provide both BIO_RW_BARRIER and REQ_FLUSH, - * where BIO_RW_BARRIER is the correct interface. Therefore, it is important - * that the HAVE_BIO_RW_BARRIER check occur before the REQ_FLUSH check. */ static inline boolean_t bio_is_flush(struct bio *bio) @@ -386,10 +383,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(HAVE_BIO_RW_BARRIER) - return (bio->bi_rw & (1 << BIO_RW_BARRIER)); #elif defined(REQ_FLUSH) return (bio->bi_rw & REQ_FLUSH); +#elif defined(HAVE_BIO_RW_BARRIER) + return (bio->bi_rw & (1 << BIO_RW_BARRIER)); #else #error "Allowing the build will cause flush requests to be ignored." #endif |