X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=include%2Fsys%2Fblkdev.h;h=7f242202ae76e6da51867bcd68075c404722ecec;hb=3c4988c83e4f278cd6c8076f6cdb8e4858d05840;hp=7102890f14da659228a151fda9ce6041924bfbe3;hpb=2959d94a0a53612cc1ca9ce9d17df26c3d69a513;p=zfs.git diff --git a/include/sys/blkdev.h b/include/sys/blkdev.h index 7102890..7f24220 100644 --- a/include/sys/blkdev.h +++ b/include/sys/blkdev.h @@ -163,6 +163,16 @@ __blk_rq_bytes(struct request *req) } #endif /* !HAVE_BLK_RQ_BYTES || HAVE_BLK_RQ_BYTES_GPL_ONLY */ +/* + * Most of the blk_* macros were removed in 2.6.36. Ostensibly this was + * done to improve readability and allow easier grepping. However, from + * a portability stand point the macros are helpful. Therefore the needed + * macros are redefined here if they are missing from the kernel. + */ +#ifndef blk_fs_request +#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) +#endif + #ifndef HAVE_GET_DISK_RO static inline int get_disk_ro(struct gendisk *disk) @@ -205,17 +215,16 @@ struct req_iterator { static inline void bio_set_flags_failfast(struct block_device *bdev, int *flags) { -#ifdef HAVE_BIO_RW_FAILFAST +#ifdef CONFIG_BUG /* - * Disable BIO_RW_FAILFAST_* for loopback devices because of - * the following incorrect BUG_ON() in loop_make_request(). + * Disable FAILFAST for loopback devices because of the + * following incorrect BUG_ON() in loop_make_request(). * This support is also disabled for md devices because the * test suite layers md devices on top of loopback devices. * This may be removed when the loopback driver is fixed. * * BUG_ON(!lo || (rw != READ && rw != WRITE)); */ -#ifdef CONFIG_BUG if ((MAJOR(bdev->bd_dev) == LOOP_MAJOR) || (MAJOR(bdev->bd_dev) == MD_MAJOR)) return; @@ -225,13 +234,25 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags) return; #endif /* BLOCK_EXT_MAJOR */ #endif /* CONFIG_BUG */ + +#ifdef HAVE_BIO_RW_FAILFAST_DTD + /* BIO_RW_FAILFAST_* preferred interface from 2.6.28 - 2.6.35 */ *flags |= ((1 << BIO_RW_FAILFAST_DEV) | (1 << BIO_RW_FAILFAST_TRANSPORT) | (1 << BIO_RW_FAILFAST_DRIVER)); -#else /* !HAVE_BIO_RW_FAILFAST */ +#else +# ifdef HAVE_BIO_RW_FAILFAST + /* BIO_RW_FAILFAST preferred interface from 2.6.12 - 2.6.27 */ *flags |= (1 << BIO_RW_FAILFAST); -#endif /* HAVE_BIO_RW_FAILFAST */ +# else +# ifdef HAVE_REQ_FAILFAST_MASK + /* REQ_FAILFAST_* preferred interface from 2.6.36 - 2.6.xx, + * the BIO_* and REQ_* flags were unified under REQ_* flags. */ + *flags |= REQ_FAILFAST_MASK; +# endif /* HAVE_REQ_FAILFAST_MASK */ +# endif /* HAVE_BIO_RW_FAILFAST */ +#endif /* HAVE_BIO_RW_FAILFAST_DTD */ } #ifndef DISK_NAME_LEN