mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
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 <tim@chase2k.com> Signed-off-by: Chunwei Chen <david.chen@osnexus.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #4892 Closes #4899
This commit is contained in:
committed by
Brian Behlendorf
parent
76e5f6fe10
commit
3b86aeb295
@@ -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 "
|
||||
|
||||
Reference in New Issue
Block a user