From 89bc3c6e69f08b61f339325a444b11e32334819f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Nov 2018 04:29:14 +0000 Subject: [PATCH] Merge r7445 from trunk git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@7698 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index a221b8f04..b521ed9c0 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -7955,7 +7955,14 @@ static struct request *blk_make_request(struct request_queue *q, struct bio *bio, gfp_t gfp_mask) { - struct request *rq = blk_get_request(q, bio_data_dir(bio), gfp_mask); + struct request *rq; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + rq = blk_get_request(q, bio_data_dir(bio), gfp_mask); +#else + rq = blk_get_request(q, bio_data_dir(bio) == READ ? REQ_OP_SCSI_IN : + REQ_OP_SCSI_OUT, gfp_mask); +#endif if (IS_ERR(rq)) return rq; @@ -7965,12 +7972,6 @@ static struct request *blk_make_request(struct request_queue *q, #else scsi_req_init(rq); #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) - rq->cmd_flags = bio_data_dir(bio) == READ ? REQ_OP_SCSI_IN : - REQ_OP_SCSI_OUT; -#else - blk_rq_set_block_pc(rq); -#endif for_each_bio(bio) { int ret; @@ -8155,9 +8156,6 @@ static struct request *__blk_map_kern_sg(struct request_queue *q, */ rq->cmd_type = REQ_TYPE_BLOCK_PC; #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) - rq->cmd_flags = reading ? REQ_OP_SCSI_IN : REQ_OP_SCSI_OUT; -#endif if (bw != NULL) { atomic_set(&bw->bios_inflight, bios); @@ -8203,7 +8201,12 @@ static struct request *blk_map_kern_sg(struct request_queue *q, struct request *rq; if (!sgl) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) rq = blk_get_request(q, reading ? READ : WRITE, gfp); +#else + rq = blk_get_request(q, reading ? REQ_OP_SCSI_IN : + REQ_OP_SCSI_OUT, gfp); +#endif if (unlikely(!rq)) return ERR_PTR(-ENOMEM); @@ -8211,9 +8214,6 @@ static struct request *blk_map_kern_sg(struct request_queue *q, scsi_req_init(scsi_req(rq)); #else scsi_req_init(rq); -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) - rq->cmd_flags = reading ? REQ_OP_SCSI_IN : REQ_OP_SCSI_OUT; #endif goto out; }