diff --git a/scst/include/backport.h b/scst/include/backport.h index 634e8a9ae..d12083dea 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -126,6 +126,14 @@ static inline void bio_set_dev(struct bio *bio, struct block_device *bdev) } #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0) +/* + * See also commit a8affc03a9b3 ("block: rename BIO_MAX_PAGES to BIO_MAX_VECS") + * # v5.12. + */ +#define BIO_MAX_VECS BIO_MAX_PAGES +#endif + /* */ static inline unsigned int scst_blk_rq_cpu(struct request *rq) @@ -184,6 +192,20 @@ blkdev_get_by_path(const char *path, fmode_t mode, void *holder) } #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0) +/* + * See also commit 8eeed0b554b9 ("block: remove unnecessary argument from + * blk_execute_rq_nowait") # v5.12. + */ +static inline void blk_execute_rq_nowait_backport(struct gendisk *bd_disk, + struct request *rq, int at_head, rq_end_io_fn *done) +{ + blk_execute_rq_nowait(rq->q, bd_disk, rq, at_head, done); +} + +#define blk_execute_rq_nowait blk_execute_rq_nowait_backport +#endif + /* */ /* diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index ca41cf824..c7874aebc 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -2931,9 +2931,9 @@ static ssize_t blockio_read_sync(struct scst_vdisk_dev *virt_dev, void *buf, #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) - max_nr_vecs = BIO_MAX_PAGES; + max_nr_vecs = BIO_MAX_VECS; #else - max_nr_vecs = min(bio_get_nr_vecs(bdev), BIO_MAX_PAGES); + max_nr_vecs = min(bio_get_nr_vecs(bdev), BIO_MAX_VECS); #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) @@ -6052,9 +6052,9 @@ static void blockio_exec_rw(struct vdisk_cmd_params *p, bool write, bool fua) if (q) #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) - max_nr_vecs = BIO_MAX_PAGES; + max_nr_vecs = BIO_MAX_VECS; #else - max_nr_vecs = min(bio_get_nr_vecs(bdev), BIO_MAX_PAGES); + max_nr_vecs = min(bio_get_nr_vecs(bdev), BIO_MAX_VECS); #endif else max_nr_vecs = 1; diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 17b5cb7d7..701e49626 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -8313,7 +8313,7 @@ static struct request *__blk_map_kern_sg(struct request_queue *q, */ max_nr_vecs = min_t(int, (PAGE_SIZE - sizeof(struct bio)) / sizeof(struct bio_vec), - BIO_MAX_PAGES); + BIO_MAX_VECS); TRACE_DBG("max_nr_vecs %d, nents %d, reading %d", max_nr_vecs, nents, reading); @@ -8823,7 +8823,7 @@ int scst_scsi_exec_async(struct scst_cmd *cmd, void *data, rq->cmd_flags |= REQ_FAILFAST_MASK; #endif - blk_execute_rq_nowait(rq->q, NULL, rq, + blk_execute_rq_nowait(NULL, rq, (cmd->queue_type == SCST_CMD_QUEUE_HEAD_OF_QUEUE), scsi_end_async); out: return res; @@ -15208,8 +15208,11 @@ void scst_vfs_unlink_and_put(struct path *path) (!defined(CONFIG_SUSE_KERNEL) || \ LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)) vfs_unlink(path->dentry->d_parent->d_inode, path->dentry); -#else +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0) vfs_unlink(path->dentry->d_parent->d_inode, path->dentry, NULL); +#else + vfs_unlink(&init_user_ns, path->dentry->d_parent->d_inode, path->dentry, + NULL); #endif path_put(path); }