scst: Introduce the kernel v4.14 bio_set_dev() macro

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7259 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2017-11-13 05:49:08 +00:00
parent 62a0e4569f
commit 64c76f339c
2 changed files with 11 additions and 3 deletions
+8
View File
@@ -60,6 +60,14 @@ static inline struct bio_set *bioset_create_backport(unsigned int pool_size,
#define BIOSET_NEED_BVECS 0
#endif
/* See also commit 74d46992e0d9. */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
static inline void bio_set_dev(struct bio *bio, struct block_device *bdev)
{
bio->bi_bdev = bdev;
}
#endif
/* <linux/blkdev.h> */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
+3 -3
View File
@@ -6919,7 +6919,7 @@ static void blockio_exec_rw(struct vdisk_cmd_params *p, bool write, bool fua)
#else
bio->bi_sector = lba_start0 << (block_shift - 9);
#endif
bio->bi_bdev = bdev;
bio_set_dev(bio, bdev);
bio->bi_private = blockio_work;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)) && (LINUX_VERSION_CODE <= KERNEL_VERSION(3, 6, 0))
bio->bi_destructor = blockio_bio_destructor;
@@ -7103,7 +7103,7 @@ static int vdisk_blockio_flush(struct block_device *bdev, gfp_t gfp_mask,
}
bio->bi_end_io = vdev_flush_end_io;
bio->bi_private = cmd;
bio->bi_bdev = bdev;
bio_set_dev(bio, bdev);
#if (!defined(CONFIG_SUSE_KERNEL) && \
LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) || \
LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
@@ -7262,7 +7262,7 @@ static ssize_t blockio_read_sync(struct scst_vdisk_dev *virt_dev, void *buf,
#else
bio_set_op_attrs(bio, REQ_OP_READ, REQ_SYNC);
#endif
bio->bi_bdev = bdev;
bio_set_dev(bio, bdev);
bio->bi_end_io = blockio_end_sync_io;
bio->bi_private = &s;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)) && (LINUX_VERSION_CODE <= KERNEL_VERSION(3, 6, 0))