block: virtual-storage: Drop version check

The function blk_mq_alloc_request() has been exported in the Linux
kernel since v3.16 and the function blk_mq_free_request() has been
exported in the Linux kernel since v3.19. The function

Since Linux v5.0, blk_get_request() has always called
blk_mq_alloc_request() and blk_put_request() has always called
blk_mq_free_request(). Given that kernels newer than v5.0 are now
supported drop the version check around blk_mq_alloc_request() and
blk_mq_free_request() and always use these functions.

Bug 4119327

Change-Id: I018687b340acaa9617c81551efb436a0439b14f1
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2991457
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jon Hunter
2023-10-04 23:33:21 +01:00
committed by mobile promotions
parent ce678a37b1
commit 68d1ae26d6

View File

@@ -123,11 +123,7 @@ int vblk_submit_ioctl_req(struct block_device *bdev,
if (err) if (err)
goto free_ioctl_req; goto free_ioctl_req;
#if KERNEL_VERSION(5, 16, 0) <= LINUX_VERSION_CODE
rq = blk_mq_alloc_request(vblkdev->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_NOWAIT); rq = blk_mq_alloc_request(vblkdev->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_NOWAIT);
#else
rq = blk_get_request(vblkdev->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_NOWAIT);
#endif
if (IS_ERR_OR_NULL(rq)) { if (IS_ERR_OR_NULL(rq)) {
dev_err(vblkdev->device, dev_err(vblkdev->device,
"Failed to get handle to a request!\n"); "Failed to get handle to a request!\n");
@@ -143,11 +139,7 @@ int vblk_submit_ioctl_req(struct block_device *bdev,
blk_execute_rq(vblkdev->gd, rq, 0); blk_execute_rq(vblkdev->gd, rq, 0);
#endif #endif
#if KERNEL_VERSION(5, 16, 0) <= LINUX_VERSION_CODE
blk_mq_free_request(rq); blk_mq_free_request(rq);
#else
blk_put_request(rq);
#endif
switch (cmd) { switch (cmd) {
case SG_IO: case SG_IO: