scst: Port to Linux kernel v5.12

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9373 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2021-04-07 03:46:01 +00:00
parent 3749cf3427
commit a3a78b8013
3 changed files with 32 additions and 7 deletions

View File

@@ -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
/* <linux/blk-mq.h> */
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
/* <linux/bsg-lib.h> */
/*

View File

@@ -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;

View File

@@ -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);
}