mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-17 20:56:24 +00:00
Merge branch 'svn-trunk'
This commit is contained in:
@@ -2461,7 +2461,7 @@ static DEVICE_ATTR(port_no, 0444, qla2x00_port_no_show, NULL);
|
||||
static DEVICE_ATTR(fw_attr, 0444, qla2x00_fw_attr_show, NULL);
|
||||
static DEVICE_ATTR_RO(edif_doorbell);
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
struct device_attribute *qla2x00_host_attrs[] = {
|
||||
&dev_attr_driver_version,
|
||||
&dev_attr_fw_version,
|
||||
@@ -2527,6 +2527,79 @@ void qla_insert_tgt_attrs(void)
|
||||
attr++;
|
||||
*attr = &dev_attr_ql2xexchoffld;
|
||||
}
|
||||
#else
|
||||
static struct attribute *qla2x00_host_attrs[] = {
|
||||
&dev_attr_driver_version.attr,
|
||||
&dev_attr_fw_version.attr,
|
||||
&dev_attr_serial_num.attr,
|
||||
&dev_attr_isp_name.attr,
|
||||
&dev_attr_isp_id.attr,
|
||||
&dev_attr_model_name.attr,
|
||||
&dev_attr_model_desc.attr,
|
||||
&dev_attr_pci_info.attr,
|
||||
&dev_attr_link_state.attr,
|
||||
&dev_attr_zio.attr,
|
||||
&dev_attr_zio_timer.attr,
|
||||
&dev_attr_beacon.attr,
|
||||
&dev_attr_beacon_config.attr,
|
||||
&dev_attr_optrom_bios_version.attr,
|
||||
&dev_attr_optrom_efi_version.attr,
|
||||
&dev_attr_optrom_fcode_version.attr,
|
||||
&dev_attr_optrom_fw_version.attr,
|
||||
&dev_attr_84xx_fw_version.attr,
|
||||
&dev_attr_total_isp_aborts.attr,
|
||||
&dev_attr_serdes_version.attr,
|
||||
&dev_attr_mpi_version.attr,
|
||||
&dev_attr_phy_version.attr,
|
||||
&dev_attr_flash_block_size.attr,
|
||||
&dev_attr_vlan_id.attr,
|
||||
&dev_attr_vn_port_mac_address.attr,
|
||||
&dev_attr_fabric_param.attr,
|
||||
&dev_attr_fw_state.attr,
|
||||
&dev_attr_optrom_gold_fw_version.attr,
|
||||
&dev_attr_thermal_temp.attr,
|
||||
&dev_attr_diag_requests.attr,
|
||||
&dev_attr_diag_megabytes.attr,
|
||||
&dev_attr_fw_dump_size.attr,
|
||||
&dev_attr_allow_cna_fw_dump.attr,
|
||||
&dev_attr_pep_version.attr,
|
||||
&dev_attr_min_supported_speed.attr,
|
||||
&dev_attr_max_supported_speed.attr,
|
||||
&dev_attr_zio_threshold.attr,
|
||||
&dev_attr_dif_bundle_statistics.attr,
|
||||
&dev_attr_port_speed.attr,
|
||||
&dev_attr_port_no.attr,
|
||||
&dev_attr_fw_attr.attr,
|
||||
&dev_attr_dport_diagnostics.attr,
|
||||
&dev_attr_edif_doorbell.attr,
|
||||
&dev_attr_mpi_pause.attr,
|
||||
&dev_attr_qlini_mode.attr,
|
||||
&dev_attr_ql2xiniexchg.attr,
|
||||
&dev_attr_ql2xexchoffld.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static umode_t qla_host_attr_is_visible(struct kobject *kobj,
|
||||
struct attribute *attr, int i)
|
||||
{
|
||||
if (ql2x_ini_mode != QLA2XXX_INI_MODE_DUAL &&
|
||||
(attr == &dev_attr_qlini_mode.attr ||
|
||||
attr == &dev_attr_ql2xiniexchg.attr ||
|
||||
attr == &dev_attr_ql2xexchoffld.attr))
|
||||
return 0;
|
||||
return attr->mode;
|
||||
}
|
||||
|
||||
static const struct attribute_group qla2x00_host_attr_group = {
|
||||
.is_visible = qla_host_attr_is_visible,
|
||||
.attrs = qla2x00_host_attrs
|
||||
};
|
||||
|
||||
const struct attribute_group *qla2x00_host_groups[] = {
|
||||
&qla2x00_host_attr_group,
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Host attributes. */
|
||||
|
||||
|
||||
@@ -742,7 +742,11 @@ uint qla25xx_fdmi_port_speed_currently(struct qla_hw_data *);
|
||||
* Global Function Prototypes in qla_attr.c source file.
|
||||
*/
|
||||
struct device_attribute;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
extern struct device_attribute *qla2x00_host_attrs[];
|
||||
#else
|
||||
extern const struct attribute_group *qla2x00_host_groups[];
|
||||
#endif
|
||||
extern struct device_attribute *qla2x00_host_attrs_dm[];
|
||||
struct fc_function_template;
|
||||
extern struct fc_function_template qla2xxx_transport_functions;
|
||||
@@ -757,7 +761,9 @@ extern int qla2x00_echo_test(scsi_qla_host_t *,
|
||||
extern int qla24xx_update_all_fcp_prio(scsi_qla_host_t *);
|
||||
extern int qla24xx_fcp_prio_cfg_valid(scsi_qla_host_t *,
|
||||
struct qla_fcp_prio_cfg *, uint8_t);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
void qla_insert_tgt_attrs(void);
|
||||
#endif
|
||||
/*
|
||||
* Global Function Prototypes in qla_dfs.c source file.
|
||||
*/
|
||||
|
||||
@@ -757,7 +757,7 @@ void qla2x00_sp_compl(srb_t *sp, int res)
|
||||
sp->free(sp);
|
||||
cmd->result = res;
|
||||
CMD_SP(cmd) = NULL;
|
||||
cmd->scsi_done(cmd);
|
||||
scsi_done(cmd);
|
||||
if (comp)
|
||||
complete(comp);
|
||||
}
|
||||
@@ -848,7 +848,7 @@ void qla2xxx_qpair_sp_compl(srb_t *sp, int res)
|
||||
sp->free(sp);
|
||||
cmd->result = res;
|
||||
CMD_SP(cmd) = NULL;
|
||||
cmd->scsi_done(cmd);
|
||||
scsi_done(cmd);
|
||||
if (comp)
|
||||
complete(comp);
|
||||
}
|
||||
@@ -987,7 +987,7 @@ qc24_target_busy:
|
||||
return SCSI_MLQUEUE_TARGET_BUSY;
|
||||
|
||||
qc24_fail_command:
|
||||
cmd->scsi_done(cmd);
|
||||
scsi_done(cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1075,7 +1075,7 @@ qc24_target_busy:
|
||||
return SCSI_MLQUEUE_TARGET_BUSY;
|
||||
|
||||
qc24_fail_command:
|
||||
cmd->scsi_done(cmd);
|
||||
scsi_done(cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -8039,7 +8039,11 @@ struct scsi_host_template qla2xxx_driver_template = {
|
||||
.sg_tablesize = SG_ALL,
|
||||
|
||||
.max_sectors = 0xFFFF,
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
.shost_attrs = qla2x00_host_attrs,
|
||||
#else
|
||||
.shost_groups = qla2x00_host_groups,
|
||||
#endif
|
||||
|
||||
.supported_mode = MODE_INITIATOR,
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
|
||||
@@ -8252,8 +8256,10 @@ qla2x00_module_init(void)
|
||||
if (ql2xextended_error_logging == 1)
|
||||
ql2xextended_error_logging = QL_DBG_DEFAULT1_MASK;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
if (ql2x_ini_mode == QLA2XXX_INI_MODE_DUAL)
|
||||
qla_insert_tgt_attrs();
|
||||
#endif
|
||||
|
||||
qla2xxx_transport_template =
|
||||
fc_attach_transport(&qla2xxx_transport_functions);
|
||||
|
||||
@@ -1803,6 +1803,7 @@ static DEVICE_ATTR(fabric_param, S_IRUGO, qla2x00_fabric_param_show, NULL);
|
||||
static DEVICE_ATTR(fw_state, S_IRUGO, qla2x00_fw_state_show, NULL);
|
||||
static DEVICE_ATTR(thermal_temp, S_IRUGO, qla2x00_thermal_temp_show, NULL);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
struct device_attribute *qla2x00_host_attrs[] = {
|
||||
&dev_attr_driver_version,
|
||||
&dev_attr_fw_version,
|
||||
@@ -1839,6 +1840,53 @@ struct device_attribute *qla2x00_host_attrs[] = {
|
||||
&dev_attr_thermal_temp,
|
||||
NULL,
|
||||
};
|
||||
#else
|
||||
static struct attribute *qla2x00_host_attrs[] = {
|
||||
&dev_attr_driver_version.attr,
|
||||
&dev_attr_fw_version.attr,
|
||||
&dev_attr_serial_num.attr,
|
||||
&dev_attr_isp_name.attr,
|
||||
&dev_attr_isp_id.attr,
|
||||
&dev_attr_model_name.attr,
|
||||
&dev_attr_model_desc.attr,
|
||||
&dev_attr_pci_info.attr,
|
||||
&dev_attr_link_state.attr,
|
||||
&dev_attr_zio.attr,
|
||||
&dev_attr_zio_timer.attr,
|
||||
&dev_attr_beacon.attr,
|
||||
&dev_attr_optrom_bios_version.attr,
|
||||
&dev_attr_optrom_efi_version.attr,
|
||||
&dev_attr_optrom_fcode_version.attr,
|
||||
&dev_attr_optrom_fw_version.attr,
|
||||
&dev_attr_84xx_fw_version.attr,
|
||||
&dev_attr_class2_enabled.attr,
|
||||
#ifdef CONFIG_SCSI_QLA2XXX_TARGET
|
||||
&dev_attr_ini_mode_force_reverse.attr,
|
||||
&dev_attr_resource_counts.attr,
|
||||
&dev_attr_port_database.attr,
|
||||
#endif
|
||||
&dev_attr_total_isp_aborts.attr,
|
||||
&dev_attr_mpi_version.attr,
|
||||
&dev_attr_phy_version.attr,
|
||||
&dev_attr_flash_block_size.attr,
|
||||
&dev_attr_vlan_id.attr,
|
||||
&dev_attr_vn_port_mac_address.attr,
|
||||
&dev_attr_fabric_param.attr,
|
||||
&dev_attr_fw_state.attr,
|
||||
&dev_attr_optrom_gold_fw_version.attr,
|
||||
&dev_attr_thermal_temp.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct attribute_group qla2x00_host_attr_group = {
|
||||
.attrs = qla2x00_host_attrs
|
||||
};
|
||||
|
||||
const struct attribute_group *qla2x00_host_groups[] = {
|
||||
&qla2x00_host_attr_group,
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Host attributes. */
|
||||
|
||||
|
||||
@@ -496,7 +496,11 @@ extern void qla2x00_get_sym_node_name(scsi_qla_host_t *, uint8_t *);
|
||||
* Global Function Prototypes in qla_attr.c source file.
|
||||
*/
|
||||
struct device_attribute;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
extern struct device_attribute *qla2x00_host_attrs[];
|
||||
#else
|
||||
extern const struct attribute_group *qla2x00_host_groups[];
|
||||
#endif
|
||||
struct fc_function_template;
|
||||
extern struct fc_function_template qla2xxx_transport_functions;
|
||||
extern struct fc_function_template qla2xxx_transport_vport_functions;
|
||||
|
||||
+16
-2
@@ -249,8 +249,12 @@ static int qla2xxx_slave_alloc(struct scsi_device *);
|
||||
static int qla2xxx_scan_finished(struct Scsi_Host *, unsigned long time);
|
||||
static void qla2xxx_scan_start(struct Scsi_Host *);
|
||||
static void qla2xxx_slave_destroy(struct scsi_device *);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
static int qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd,
|
||||
void (*fn)(struct scsi_cmnd *));
|
||||
#else
|
||||
static int qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd);
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
|
||||
static DEF_SCSI_QCMD(qla2xxx_queuecommand);
|
||||
#endif
|
||||
@@ -306,7 +310,11 @@ struct scsi_host_template qla2xxx_driver_template = {
|
||||
.sg_tablesize = SG_ALL,
|
||||
|
||||
.max_sectors = 0xFFFF,
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
.shost_attrs = qla2x00_host_attrs,
|
||||
#else
|
||||
.shost_groups = qla2x00_host_groups,
|
||||
#endif
|
||||
#ifdef CONFIG_SCSI_QLA2XXX_TARGET
|
||||
.supported_mode = MODE_INITIATOR | MODE_TARGET,
|
||||
#endif /* CONFIG_SCSI_QLA2XXX_TARGET */
|
||||
@@ -674,11 +682,15 @@ qla2x00_sp_compl(void *data, void *ptr, int res)
|
||||
return;
|
||||
|
||||
qla2x00_sp_free_dma(ha, sp);
|
||||
cmd->scsi_done(cmd);
|
||||
scsi_done(cmd);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
static int
|
||||
qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
|
||||
#else
|
||||
static int qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd)
|
||||
#endif
|
||||
{
|
||||
scsi_qla_host_t *vha = shost_priv(cmd->device->host);
|
||||
fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
|
||||
@@ -757,7 +769,9 @@ qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)
|
||||
sp->type = SRB_SCSI_CMD;
|
||||
atomic_set(&sp->ref_count, 1);
|
||||
CMD_SP(cmd) = (void *)sp;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
cmd->scsi_done = done;
|
||||
#endif
|
||||
sp->free = qla2x00_sp_free_dma;
|
||||
sp->done = qla2x00_sp_compl;
|
||||
|
||||
@@ -785,7 +799,7 @@ qc24_target_busy:
|
||||
|
||||
qc24_fail_command:
|
||||
spin_lock_irq(vha->host->host_lock);
|
||||
done(cmd);
|
||||
scsi_done(cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2267,6 +2267,16 @@ static inline u32 scsi_prot_ref_tag(struct scsi_cmnd *scmd)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
/*
|
||||
* See also commit 11b68e36b167 ("scsi: core: Call scsi_done directly"; v5.16)
|
||||
*/
|
||||
static inline void scsi_done(struct scsi_cmnd *cmd)
|
||||
{
|
||||
return cmd->scsi_done(cmd);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* <scsi/scsi_request.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
#else
|
||||
#include <asm/atomic.h>
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
|
||||
#include <linux/blk-integrity.h>
|
||||
#endif
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/delay.h>
|
||||
@@ -371,13 +374,6 @@ static struct file *vdev_open_fd(const struct scst_vdisk_dev *virt_dev,
|
||||
|
||||
sBUG_ON(!name);
|
||||
|
||||
if (!virt_dev->dev_active) {
|
||||
TRACE_MGMT_DBG("Skip opening for not active dev %s",
|
||||
virt_dev->dev->virt_name);
|
||||
fd = ERR_PTR(-EMEDIUMTYPE);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (read_only)
|
||||
open_flags |= O_RDONLY;
|
||||
else
|
||||
@@ -395,7 +391,6 @@ static struct file *vdev_open_fd(const struct scst_vdisk_dev *virt_dev,
|
||||
PRINT_ERROR("filp_open(%s) failed: %d", name, (int)PTR_ERR(fd));
|
||||
}
|
||||
|
||||
out:
|
||||
TRACE_EXIT();
|
||||
return fd;
|
||||
}
|
||||
@@ -1191,7 +1186,7 @@ next:
|
||||
}
|
||||
}
|
||||
|
||||
if (virt_dev->dif_filename != NULL) {
|
||||
if (virt_dev->dev_active && virt_dev->dif_filename != NULL) {
|
||||
/* Check if it can be used */
|
||||
struct file *dfd = vdev_open_fd(virt_dev, virt_dev->dif_filename,
|
||||
virt_dev->rd_only);
|
||||
@@ -1340,7 +1335,11 @@ static int vdisk_open_fd(struct scst_vdisk_dev *virt_dev, bool read_only)
|
||||
sBUG_ON(!virt_dev->filename);
|
||||
sBUG_ON(vdisk_is_open(virt_dev));
|
||||
|
||||
if (virt_dev->blockio) {
|
||||
if (!virt_dev->dev_active) {
|
||||
TRACE_MGMT_DBG("Skip opening for not active dev %s",
|
||||
virt_dev->dev->virt_name);
|
||||
res = -EMEDIUMTYPE;
|
||||
} else if (virt_dev->blockio) {
|
||||
virt_dev->bdev_mode = FMODE_READ;
|
||||
if (!read_only)
|
||||
virt_dev->bdev_mode |= FMODE_WRITE;
|
||||
@@ -3198,7 +3197,11 @@ static bool vdisk_alloc_async_kvec(struct scst_cmd *cmd,
|
||||
return true;
|
||||
}
|
||||
|
||||
static void fileio_async_complete(struct kiocb *iocb, long ret, long ret2)
|
||||
static void fileio_async_complete(struct kiocb *iocb, long ret
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
, long ret2
|
||||
#endif
|
||||
)
|
||||
{
|
||||
struct vdisk_cmd_params *p = container_of(iocb, typeof(*p), async.iocb);
|
||||
struct scst_cmd *cmd = p->cmd;
|
||||
@@ -3300,8 +3303,13 @@ static enum compl_status_e fileio_exec_async(struct vdisk_cmd_params *p)
|
||||
}
|
||||
if (p->async.kvec != p->async.small_kvec)
|
||||
kfree(p->async.kvec);
|
||||
if (ret != -EIOCBQUEUED)
|
||||
if (ret != -EIOCBQUEUED) {
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
fileio_async_complete(iocb, ret, 0);
|
||||
#else
|
||||
fileio_async_complete(iocb, ret);
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* Return RUNNING_ASYNC even if fileio_async_complete() has been
|
||||
* called because that function calls cmd->scst_cmd_done().
|
||||
|
||||
+42
-23
@@ -8213,7 +8213,7 @@ static void bio_kmalloc_destructor(struct bio *bio)
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
|
||||
static blk_mq_req_flags_t gfp_mask_to_flags(gfp_t gfp_mask)
|
||||
static blk_mq_req_flags_t scst_gfp_mask_to_flags(gfp_t gfp_mask)
|
||||
{
|
||||
switch (gfp_mask) {
|
||||
case GFP_KERNEL:
|
||||
@@ -8228,6 +8228,35 @@ static blk_mq_req_flags_t gfp_mask_to_flags(gfp_t gfp_mask)
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* scst_alloc_passthrough_request - Allocate a SCSI pass-through request.
|
||||
* @q: Request queue.
|
||||
* @rw: READ or WRITE.
|
||||
* @gfp_mask: GFP_KERNEL, GFP_ATOMIC or GFP_NOIO.
|
||||
*
|
||||
* Returns
|
||||
* A valid request pointer, NULL or an error pointer. The value NULL is only
|
||||
* returned for the legacy block layer if allocation fails. The legacy block
|
||||
* layer is only supported by kernel versions before v5.0.
|
||||
*/
|
||||
static inline struct request *
|
||||
scst_alloc_passthrough_request(struct request_queue *q, int rw, gfp_t gfp_mask)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
|
||||
return blk_get_request(q, rw, gfp_mask);
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
|
||||
return blk_get_request(q, rw == READ ? REQ_OP_SCSI_IN : REQ_OP_SCSI_OUT,
|
||||
gfp_mask);
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
return blk_get_request(q, rw == READ ? REQ_OP_SCSI_IN : REQ_OP_SCSI_OUT,
|
||||
scst_gfp_mask_to_flags(gfp_mask));
|
||||
#else
|
||||
return blk_mq_alloc_request(q, rw == READ ? REQ_OP_DRV_IN :
|
||||
rw == READ ? REQ_OP_DRV_IN : REQ_OP_DRV_OUT,
|
||||
scst_gfp_mask_to_flags(gfp_mask));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) || \
|
||||
(defined(CONFIG_SUSE_KERNEL) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
|
||||
static struct request *blk_make_request(struct request_queue *q,
|
||||
@@ -8236,17 +8265,8 @@ static struct request *blk_make_request(struct request_queue *q,
|
||||
{
|
||||
struct request *rq;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
|
||||
rq = blk_get_request(q, bio_data_dir(bio), gfp_mask);
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
|
||||
rq = blk_get_request(q, bio_data_dir(bio) == READ ? REQ_OP_SCSI_IN :
|
||||
REQ_OP_SCSI_OUT, gfp_mask);
|
||||
#else
|
||||
rq = blk_get_request(q, bio_data_dir(bio) == READ ? REQ_OP_SCSI_IN :
|
||||
REQ_OP_SCSI_OUT, gfp_mask_to_flags(gfp_mask));
|
||||
#endif
|
||||
|
||||
if (IS_ERR(rq))
|
||||
rq = scst_alloc_passthrough_request(q, bio_data_dir(bio), gfp_mask);
|
||||
if (IS_ERR_OR_NULL(rq))
|
||||
return rq;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
|
||||
@@ -8280,7 +8300,11 @@ static struct request *blk_make_request(struct request_queue *q,
|
||||
ret = blk_rq_append_bio(rq, bio);
|
||||
#endif
|
||||
if (unlikely(ret)) {
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
blk_put_request(rq);
|
||||
#else
|
||||
blk_mq_free_request(rq);
|
||||
#endif
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
}
|
||||
@@ -8469,16 +8493,9 @@ 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);
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
|
||||
rq = blk_get_request(q, reading ? REQ_OP_SCSI_IN :
|
||||
REQ_OP_SCSI_OUT, gfp);
|
||||
#else
|
||||
rq = blk_get_request(q, reading ? REQ_OP_SCSI_IN :
|
||||
REQ_OP_SCSI_OUT, gfp_mask_to_flags(gfp));
|
||||
#endif
|
||||
if (unlikely(!rq))
|
||||
rq = scst_alloc_passthrough_request(q, reading ? READ : WRITE,
|
||||
gfp);
|
||||
if (unlikely(IS_ERR_OR_NULL(rq)))
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
|
||||
@@ -8728,8 +8745,10 @@ static void scsi_end_async(struct request *req, blk_status_t error)
|
||||
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 8)
|
||||
/* See also commit 92bc5a24844a ("block: remove __blk_put_request()") */
|
||||
__blk_put_request(req->q, req);
|
||||
#else
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
blk_put_request(req);
|
||||
#else
|
||||
blk_mq_free_request(req);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,11 @@
|
||||
#endif
|
||||
#include <linux/vmalloc.h>
|
||||
#include <asm/unaligned.h>
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <linux/stdarg.h>
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
|
||||
#include <linux/mount.h>
|
||||
|
||||
@@ -925,7 +925,7 @@ static int scst_local_queuecommand_lck(struct scsi_cmnd *scmd,
|
||||
|
||||
if (sess->unregistering) {
|
||||
scmd->result = DID_BAD_TARGET << 16;
|
||||
scmd->scsi_done(scmd);
|
||||
scsi_done(scmd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1420,7 +1420,11 @@ static int scst_local_targ_xmit_response(struct scst_cmd *scst_cmd)
|
||||
done = tgt_specific->done;
|
||||
#else
|
||||
scmd = scst_cmd_get_tgt_priv(scst_cmd);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
done = scmd->scsi_done;
|
||||
#else
|
||||
done = scsi_done;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user