diff options
author | Chunwei Chen <[email protected]> | 2016-07-27 17:55:32 +0000 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-07-29 14:48:19 -0700 |
commit | 3b86aeb2952c91aeb8ed0ebf9d5e43119fa537a0 (patch) | |
tree | 37b94f2a75deb3e22ca75f050c23c67b9e7b82f1 /include | |
parent | 76e5f6fe10ab8c9c8ae13e4c33ecb68f3d0ce5dc (diff) |
Linux 4.8 compat: REQ_OP and bio_set_op_attrs()
New REQ_OP_* definitions have been introduced to separate the
WRITE, READ, and DISCARD operations from the flags. This included
changing the encoding of bi_rw. It places REQ_OP_* in high order
bits and other stuff in low order bits. This encoding is done
through the new helper function bio_set_op_attrs. For complete
details refer to:
https://github.com/torvalds/linux/commit/f215082
https://github.com/torvalds/linux/commit/4e1b2d5
Signed-off-by: Tim Chase <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #4892
Closes #4899
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/blkdev_compat.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h index e263dc836..01bfad600 100644 --- a/include/linux/blkdev_compat.h +++ b/include/linux/blkdev_compat.h @@ -334,15 +334,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 " |