Re: linux-next: manual merge of the target-updates tree with Linus' tree
Hi Stephen, On Mon, 2015-06-01 at 20:48 +1000, Stephen Rothwell wrote: > Hi Nicholas, > > Today's linux-next merge of the target-updates tree got a conflict in > drivers/target/target_core_configfs.c between commit d588cf8f618d > ("target: Fix se_tpg_tfo->tf_subsys regression + remove tf_subsystem") > from Linus' tree and commits c6eec4d58f5d ("target: remove tf_subsystem > pointers") and 93af633991fd ("target: don't copy fabric ops") and > f0eb815f8a53 ("target: put struct target_fabric_configfs on a diet") > from the target-updates tree. > > I fixed it up (the first of the target-updates tree patches is a subset > of the patch in Linus' tree - see the result below) and can carry the > fix as necessary (no action is required). > Fixed in this morning's push to target-pending/for-next, using v4.1-rc6 updates in target-pending/master -> mainline as the updated for-next base. Thank you, --nab -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_user.c between commit 9c1cd1b68cd1 ("target/user: Only support full command pass-through") from Linus' tree and commit 1f44c7e00856 ("target: simplify backend driver registration") and 1854440347ec ("target: consolidate backend attribute implementations") from the target-updates tree. I fixed it up (just this file - see below - I hope that the rest was taken care of) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au diff --cc drivers/target/target_core_user.c index edc98250,6742e53f5f97.. --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@@ -1050,30 -1115,57 +1099,10 @@@ tcmu_pass_op(struct se_cmd *se_cmd static sense_reason_t tcmu_parse_cdb(struct se_cmd *cmd) { - unsigned char *cdb = cmd->t_task_cdb; - struct tcmu_dev *udev = TCMU_DEV(cmd->se_dev); - sense_reason_t ret; - - switch (udev->pass_level) { - case TCMU_PASS_ALL: - /* We're just like pscsi, then */ - /* - * For REPORT LUNS we always need to emulate the response, for everything - * else, pass it up. - */ - switch (cdb[0]) { - case REPORT_LUNS: - cmd->execute_cmd = spc_emulate_report_luns; - break; - case READ_6: - case READ_10: - case READ_12: - case READ_16: - case WRITE_6: - case WRITE_10: - case WRITE_12: - case WRITE_16: - case WRITE_VERIFY: - cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; - /* FALLTHROUGH */ - default: - cmd->execute_cmd = tcmu_pass_op; - } - ret = TCM_NO_SENSE; - break; - case TCMU_PASS_IO: - ret = sbc_parse_cdb(cmd, _sbc_ops); - break; - default: - pr_err("Unknown tcm-user pass level %d\n", udev->pass_level); - ret = TCM_CHECK_CONDITION_ABORT_CMD; - } - - return ret; + return passthrough_parse_cdb(cmd, tcmu_pass_op); } - DEF_TB_DEV_ATTRIB_RO(tcmu, hw_pi_prot_type); - TB_DEV_ATTR_RO(tcmu, hw_pi_prot_type); - - DEF_TB_DEV_ATTRIB_RO(tcmu, hw_block_size); - TB_DEV_ATTR_RO(tcmu, hw_block_size); - - DEF_TB_DEV_ATTRIB_RO(tcmu, hw_max_sectors); - TB_DEV_ATTR_RO(tcmu, hw_max_sectors); - - DEF_TB_DEV_ATTRIB_RO(tcmu, hw_queue_depth); - TB_DEV_ATTR_RO(tcmu, hw_queue_depth); - - static struct configfs_attribute *tcmu_backend_dev_attrs[] = { - _dev_attrib_hw_pi_prot_type.attr, - _dev_attrib_hw_block_size.attr, - _dev_attrib_hw_max_sectors.attr, - _dev_attrib_hw_queue_depth.attr, - NULL, - }; - - static struct se_subsystem_api tcmu_template = { + static const struct target_backend_ops tcmu_ops = { .name = "user", .inquiry_prod = "USER", .inquiry_rev= TCMU_VERSION, pgpImDY8ONk75.pgp Description: OpenPGP digital signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_transport.c between commit a3541703ebbf ("target: Use a PASSTHROUGH flag instead of transport_types") from Linus' tree and commit 50c44f9b1587 ("target: Add support for fabric IRQ completion") from the target-updates tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au diff --cc drivers/target/target_core_transport.c index 2b17bddeff0f,a98a23c475b2.. --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@@ -1767,11 -1767,11 +1768,11 @@@ static int target_write_prot_action(str break; sectors = cmd->data_length >> ilog2(cmd->se_dev->dev_attrib.block_size); - cmd->pi_err = sbc_dif_verify_write(cmd, cmd->t_task_lba, - sectors, 0, NULL, 0); + cmd->pi_err = sbc_dif_verify(cmd, cmd->t_task_lba, +sectors, 0, cmd->t_prot_sg, 0); if (unlikely(cmd->pi_err)) { spin_lock_irq(>t_state_lock); - cmd->transport_state &= ~CMD_T_BUSY|CMD_T_SENT; + cmd->transport_state &= ~(CMD_T_BUSY|CMD_T_SENT); spin_unlock_irq(>t_state_lock); transport_generic_request_failure(cmd, cmd->pi_err); return -1; @@@ -1913,8 -1914,8 +1915,8 @@@ static bool transport_complete_task_att { struct se_device *dev = cmd->se_dev; - if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) + if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) - return; + return true; if (cmd->sam_task_attr == TCM_SIMPLE_TAG) { atomic_dec_mb(>simple_cmds); pgpNDXcPVaiGX.pgp Description: OpenPGP digital signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_pr.c between commit d588cf8f618d (target: Fix se_tpg_tfo->tf_subsys regression + remove tf_subsystem"") from Linus' tree and commits c6eec4d58f5d ("target: remove tf_subsystem pointers") and 293f3c05b01a ("target: Convert se_node_acl->device_list[] to RCU hlist") from the target-updates tree. I fixed it up (again, the first of the target-updates trees patches is a subset of the one in Linus' tree) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au pgpfkwl3JYcZz.pgp Description: OpenPGP digital signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_device.c between commit a3541703ebbf ("target: Use a PASSTHROUGH flag instead of transport_types") from Linus' tree and commit 1362adc724c4 ("target: Subsume se_port + t10_alua_tg_pt_gp_member into se_lun") from the target-updates tree. I fixed it up (the latter removed the code updated by the former) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au pgpb0MMWAttti.pgp Description: OpenPGP digital signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_configfs.c between commit d588cf8f618d ("target: Fix se_tpg_tfo->tf_subsys regression + remove tf_subsystem") from Linus' tree and commits c6eec4d58f5d ("target: remove tf_subsystem pointers") and 93af633991fd ("target: don't copy fabric ops") and f0eb815f8a53 ("target: put struct target_fabric_configfs on a diet") from the target-updates tree. I fixed it up (the first of the target-updates tree patches is a subset of the patch in Linus' tree - see the result below) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au diff --cc drivers/target/target_core_configfs.c index e7b0430a0575,4ada522d7bc3.. --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c @@@ -1034,10 -1587,10 +1587,10 @@@ static ssize_t target_core_dev_pr_store u64 sa_res_key = 0; u32 mapped_lun = 0, target_lun = 0; int ret = -1, res_holder = 0, all_tg_pt = 0, arg, token; - u16 port_rpti = 0, tpgt = 0; - u8 type = 0, scope; + u16 tpgt = 0; + u8 type = 0; - if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) + if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) return 0; if (dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS) return 0; pgpA_ZxXDmxL7.pgp Description: OpenPGP digital signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_transport.c between commit a3541703ebbf (target: Use a PASSTHROUGH flag instead of transport_types) from Linus' tree and commit 50c44f9b1587 (target: Add support for fabric IRQ completion) from the target-updates tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au diff --cc drivers/target/target_core_transport.c index 2b17bddeff0f,a98a23c475b2.. --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@@ -1767,11 -1767,11 +1768,11 @@@ static int target_write_prot_action(str break; sectors = cmd-data_length ilog2(cmd-se_dev-dev_attrib.block_size); - cmd-pi_err = sbc_dif_verify_write(cmd, cmd-t_task_lba, - sectors, 0, NULL, 0); + cmd-pi_err = sbc_dif_verify(cmd, cmd-t_task_lba, +sectors, 0, cmd-t_prot_sg, 0); if (unlikely(cmd-pi_err)) { spin_lock_irq(cmd-t_state_lock); - cmd-transport_state = ~CMD_T_BUSY|CMD_T_SENT; + cmd-transport_state = ~(CMD_T_BUSY|CMD_T_SENT); spin_unlock_irq(cmd-t_state_lock); transport_generic_request_failure(cmd, cmd-pi_err); return -1; @@@ -1913,8 -1914,8 +1915,8 @@@ static bool transport_complete_task_att { struct se_device *dev = cmd-se_dev; - if (dev-transport-transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) + if (dev-transport-transport_flags TRANSPORT_FLAG_PASSTHROUGH) - return; + return true; if (cmd-sam_task_attr == TCM_SIMPLE_TAG) { atomic_dec_mb(dev-simple_cmds); pgpNDXcPVaiGX.pgp Description: OpenPGP digital signature
Re: linux-next: manual merge of the target-updates tree with Linus' tree
Hi Stephen, On Mon, 2015-06-01 at 20:48 +1000, Stephen Rothwell wrote: Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_configfs.c between commit d588cf8f618d (target: Fix se_tpg_tfo-tf_subsys regression + remove tf_subsystem) from Linus' tree and commits c6eec4d58f5d (target: remove tf_subsystem pointers) and 93af633991fd (target: don't copy fabric ops) and f0eb815f8a53 (target: put struct target_fabric_configfs on a diet) from the target-updates tree. I fixed it up (the first of the target-updates tree patches is a subset of the patch in Linus' tree - see the result below) and can carry the fix as necessary (no action is required). Fixed in this morning's push to target-pending/for-next, using v4.1-rc6 updates in target-pending/master - mainline as the updated for-next base. Thank you, --nab -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_pr.c between commit d588cf8f618d (target: Fix se_tpg_tfo-tf_subsys regression + remove tf_subsystem) from Linus' tree and commits c6eec4d58f5d (target: remove tf_subsystem pointers) and 293f3c05b01a (target: Convert se_node_acl-device_list[] to RCU hlist) from the target-updates tree. I fixed it up (again, the first of the target-updates trees patches is a subset of the one in Linus' tree) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au pgpfkwl3JYcZz.pgp Description: OpenPGP digital signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_user.c between commit 9c1cd1b68cd1 (target/user: Only support full command pass-through) from Linus' tree and commit 1f44c7e00856 (target: simplify backend driver registration) and 1854440347ec (target: consolidate backend attribute implementations) from the target-updates tree. I fixed it up (just this file - see below - I hope that the rest was taken care of) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au diff --cc drivers/target/target_core_user.c index edc98250,6742e53f5f97.. --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@@ -1050,30 -1115,57 +1099,10 @@@ tcmu_pass_op(struct se_cmd *se_cmd static sense_reason_t tcmu_parse_cdb(struct se_cmd *cmd) { - unsigned char *cdb = cmd-t_task_cdb; - struct tcmu_dev *udev = TCMU_DEV(cmd-se_dev); - sense_reason_t ret; - - switch (udev-pass_level) { - case TCMU_PASS_ALL: - /* We're just like pscsi, then */ - /* - * For REPORT LUNS we always need to emulate the response, for everything - * else, pass it up. - */ - switch (cdb[0]) { - case REPORT_LUNS: - cmd-execute_cmd = spc_emulate_report_luns; - break; - case READ_6: - case READ_10: - case READ_12: - case READ_16: - case WRITE_6: - case WRITE_10: - case WRITE_12: - case WRITE_16: - case WRITE_VERIFY: - cmd-se_cmd_flags |= SCF_SCSI_DATA_CDB; - /* FALLTHROUGH */ - default: - cmd-execute_cmd = tcmu_pass_op; - } - ret = TCM_NO_SENSE; - break; - case TCMU_PASS_IO: - ret = sbc_parse_cdb(cmd, tcmu_sbc_ops); - break; - default: - pr_err(Unknown tcm-user pass level %d\n, udev-pass_level); - ret = TCM_CHECK_CONDITION_ABORT_CMD; - } - - return ret; + return passthrough_parse_cdb(cmd, tcmu_pass_op); } - DEF_TB_DEV_ATTRIB_RO(tcmu, hw_pi_prot_type); - TB_DEV_ATTR_RO(tcmu, hw_pi_prot_type); - - DEF_TB_DEV_ATTRIB_RO(tcmu, hw_block_size); - TB_DEV_ATTR_RO(tcmu, hw_block_size); - - DEF_TB_DEV_ATTRIB_RO(tcmu, hw_max_sectors); - TB_DEV_ATTR_RO(tcmu, hw_max_sectors); - - DEF_TB_DEV_ATTRIB_RO(tcmu, hw_queue_depth); - TB_DEV_ATTR_RO(tcmu, hw_queue_depth); - - static struct configfs_attribute *tcmu_backend_dev_attrs[] = { - tcmu_dev_attrib_hw_pi_prot_type.attr, - tcmu_dev_attrib_hw_block_size.attr, - tcmu_dev_attrib_hw_max_sectors.attr, - tcmu_dev_attrib_hw_queue_depth.attr, - NULL, - }; - - static struct se_subsystem_api tcmu_template = { + static const struct target_backend_ops tcmu_ops = { .name = user, .inquiry_prod = USER, .inquiry_rev= TCMU_VERSION, pgpImDY8ONk75.pgp Description: OpenPGP digital signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_device.c between commit a3541703ebbf (target: Use a PASSTHROUGH flag instead of transport_types) from Linus' tree and commit 1362adc724c4 (target: Subsume se_port + t10_alua_tg_pt_gp_member into se_lun) from the target-updates tree. I fixed it up (the latter removed the code updated by the former) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au pgpb0MMWAttti.pgp Description: OpenPGP digital signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_configfs.c between commit d588cf8f618d (target: Fix se_tpg_tfo-tf_subsys regression + remove tf_subsystem) from Linus' tree and commits c6eec4d58f5d (target: remove tf_subsystem pointers) and 93af633991fd (target: don't copy fabric ops) and f0eb815f8a53 (target: put struct target_fabric_configfs on a diet) from the target-updates tree. I fixed it up (the first of the target-updates tree patches is a subset of the patch in Linus' tree - see the result below) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au diff --cc drivers/target/target_core_configfs.c index e7b0430a0575,4ada522d7bc3.. --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c @@@ -1034,10 -1587,10 +1587,10 @@@ static ssize_t target_core_dev_pr_store u64 sa_res_key = 0; u32 mapped_lun = 0, target_lun = 0; int ret = -1, res_holder = 0, all_tg_pt = 0, arg, token; - u16 port_rpti = 0, tpgt = 0; - u8 type = 0, scope; + u16 tpgt = 0; + u8 type = 0; - if (dev-transport-transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) + if (dev-transport-transport_flags TRANSPORT_FLAG_PASSTHROUGH) return 0; if (dev-dev_reservation_flags DRF_SPC2_RESERVATIONS) return 0; pgpA_ZxXDmxL7.pgp Description: OpenPGP digital signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/vhost/scsi.c between commit 46243860806b ("vhost-scsi: Add missing virtio-scsi -> TCM attribute conversion") from Linus' tree and commit 2936f1d4f3e8 ("vhost/scsi: Global tcm_vhost -> vhost_scsi rename") from the target-updates tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au diff --cc drivers/vhost/scsi.c index d695b1673ae5,57a6f0ac4c55.. --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@@ -911,28 -938,11 +938,28 @@@ vhost_scsi_mapal(struct vhost_scsi_cmd return 0; } +static int vhost_scsi_to_tcm_attr(int attr) +{ + switch (attr) { + case VIRTIO_SCSI_S_SIMPLE: + return TCM_SIMPLE_TAG; + case VIRTIO_SCSI_S_ORDERED: + return TCM_ORDERED_TAG; + case VIRTIO_SCSI_S_HEAD: + return TCM_HEAD_TAG; + case VIRTIO_SCSI_S_ACA: + return TCM_ACA_TAG; + default: + break; + } + return TCM_SIMPLE_TAG; +} + - static void tcm_vhost_submission_work(struct work_struct *work) + static void vhost_scsi_submission_work(struct work_struct *work) { - struct tcm_vhost_cmd *cmd = - container_of(work, struct tcm_vhost_cmd, work); - struct tcm_vhost_nexus *tv_nexus; + struct vhost_scsi_cmd *cmd = + container_of(work, struct vhost_scsi_cmd, work); + struct vhost_scsi_nexus *tv_nexus; struct se_cmd *se_cmd = >tvc_se_cmd; struct scatterlist *sg_ptr, *sg_prot_ptr = NULL; int rc; pgpnSsWsT6Q6M.pgp Description: OpenPGP digital signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/vhost/scsi.c between commit 46243860806b (vhost-scsi: Add missing virtio-scsi - TCM attribute conversion) from Linus' tree and commit 2936f1d4f3e8 (vhost/scsi: Global tcm_vhost - vhost_scsi rename) from the target-updates tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au diff --cc drivers/vhost/scsi.c index d695b1673ae5,57a6f0ac4c55.. --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@@ -911,28 -938,11 +938,28 @@@ vhost_scsi_mapal(struct vhost_scsi_cmd return 0; } +static int vhost_scsi_to_tcm_attr(int attr) +{ + switch (attr) { + case VIRTIO_SCSI_S_SIMPLE: + return TCM_SIMPLE_TAG; + case VIRTIO_SCSI_S_ORDERED: + return TCM_ORDERED_TAG; + case VIRTIO_SCSI_S_HEAD: + return TCM_HEAD_TAG; + case VIRTIO_SCSI_S_ACA: + return TCM_ACA_TAG; + default: + break; + } + return TCM_SIMPLE_TAG; +} + - static void tcm_vhost_submission_work(struct work_struct *work) + static void vhost_scsi_submission_work(struct work_struct *work) { - struct tcm_vhost_cmd *cmd = - container_of(work, struct tcm_vhost_cmd, work); - struct tcm_vhost_nexus *tv_nexus; + struct vhost_scsi_cmd *cmd = + container_of(work, struct vhost_scsi_cmd, work); + struct vhost_scsi_nexus *tv_nexus; struct se_cmd *se_cmd = cmd-tvc_se_cmd; struct scatterlist *sg_ptr, *sg_prot_ptr = NULL; int rc; pgpnSsWsT6Q6M.pgp Description: OpenPGP digital signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/vhost/scsi.c between commit 46243860806b ("vhost-scsi: Add missing virtio-scsi -> TCM attribute conversion") from Linus' tree and commit 6df22d68ecaf ("vhost/scsi: Add ANY_LAYOUT prerequisites") from the target-updates tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au diff --cc drivers/vhost/scsi.c index d695b1673ae5,a773af3550ee.. --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@@ -911,23 -911,111 +911,128 @@@ vhost_scsi_map_iov_to_prot(struct tcm_v return 0; } +static int vhost_scsi_to_tcm_attr(int attr) +{ + switch (attr) { + case VIRTIO_SCSI_S_SIMPLE: + return TCM_SIMPLE_TAG; + case VIRTIO_SCSI_S_ORDERED: + return TCM_ORDERED_TAG; + case VIRTIO_SCSI_S_HEAD: + return TCM_HEAD_TAG; + case VIRTIO_SCSI_S_ACA: + return TCM_ACA_TAG; + default: + break; + } + return TCM_SIMPLE_TAG; +} + + static int + vhost_scsi_calc_sgls(struct iovec *iov, size_t off, size_t bytes, +int *niov, int max_sgls) + { + size_t tmp = 0; + int sgl_count = 0; + + *niov = 0; + + while (tmp < bytes) { + void __user *base = iov[*niov].iov_base + off; + size_t len = iov[(*niov)++].iov_len - off; + + sgl_count += iov_num_pages(base, len); + tmp += min(len, bytes); + off = 0; + } + if (sgl_count > max_sgls) { + pr_err("%s: requested sgl_count: %d exceeds pre-allocated" + " max_sgls: %d\n", __func__, sgl_count, max_sgls); + return -ENOBUFS; + } + return sgl_count; + } + + static int + vhost_scsi_iov_to_sgl(struct tcm_vhost_cmd *cmd, bool write, + struct iovec *iov, size_t iov_off, int niov, + struct scatterlist *sg, int sg_count) + { + int i, ret; + + for (i = 0; i < niov; i++) { + void __user *base = iov[i].iov_base + iov_off; + size_t len = iov[i].iov_len - iov_off; + + ret = vhost_scsi_map_to_sgl(cmd, base, len, sg, write); + if (ret < 0) { + for (i = 0; i < sg_count; i++) { + struct page *page = sg_page([i]); + if (page) + put_page(page); + } + return ret; + } + sg += ret; + iov_off = 0; + } + return 0; + } + + static int + vhost_scsi_mapal(struct tcm_vhost_cmd *cmd, +size_t prot_bytes, struct iovec *prot_iov, size_t prot_off, +size_t data_bytes, struct iovec *data_iov, size_t data_off) + { + int data_sgl_count = 0, niov, ret; + bool write = (cmd->tvc_data_direction == DMA_FROM_DEVICE); + + if (prot_bytes) { + int prot_sgl_count; + + if (!prot_iov) { + pr_err("%s: prot_iov is NULL, but prot_bytes: %zu" + "present\n", __func__, prot_bytes); + return -EINVAL; + } + prot_sgl_count = vhost_scsi_calc_sgls(prot_iov, prot_off, + prot_bytes, , + TCM_VHOST_PREALLOC_PROT_SGLS); + if (prot_sgl_count < 0) + return prot_sgl_count; + + sg_init_table(cmd->tvc_prot_sgl, prot_sgl_count); + cmd->tvc_prot_sgl_count = prot_sgl_count; + pr_debug("%s prot_sg %p prot_sgl_count %u\n", __func__, +cmd->tvc_prot_sgl, cmd->tvc_prot_sgl_count); + + ret = vhost_scsi_iov_to_sgl(cmd, write, prot_iov, prot_off, + niov, cmd->tvc_prot_sgl, + prot_sgl_count); + if (ret < 0) { + cmd->tvc_prot_sgl_count = 0; + return ret; + } + } + if (!data_iov) { + pr_err("%s: data_iov is NULL, but data_bytes: %zu present\n", + __func__, data_bytes); + return -EINVAL; + } + data_sgl_count = vhost_scsi_calc_sgls(data_iov, data_off, data_bytes, + , TCM_VHOST_PREALLOC_SGLS); + if (data_sgl_count < 0) + return data_sgl_count; + + sg_init_table(cmd->tvc_sgl, data_sgl_count); + cmd->tvc_sgl_count = data_sgl_count; + pr_debug("%s data_sg %p data_sgl_count %u\n", __func__, + cmd->tvc_sgl, cmd->tvc_sgl_count); + +
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/vhost/scsi.c between commit 46243860806b (vhost-scsi: Add missing virtio-scsi - TCM attribute conversion) from Linus' tree and commit 6df22d68ecaf (vhost/scsi: Add ANY_LAYOUT prerequisites) from the target-updates tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au diff --cc drivers/vhost/scsi.c index d695b1673ae5,a773af3550ee.. --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@@ -911,23 -911,111 +911,128 @@@ vhost_scsi_map_iov_to_prot(struct tcm_v return 0; } +static int vhost_scsi_to_tcm_attr(int attr) +{ + switch (attr) { + case VIRTIO_SCSI_S_SIMPLE: + return TCM_SIMPLE_TAG; + case VIRTIO_SCSI_S_ORDERED: + return TCM_ORDERED_TAG; + case VIRTIO_SCSI_S_HEAD: + return TCM_HEAD_TAG; + case VIRTIO_SCSI_S_ACA: + return TCM_ACA_TAG; + default: + break; + } + return TCM_SIMPLE_TAG; +} + + static int + vhost_scsi_calc_sgls(struct iovec *iov, size_t off, size_t bytes, +int *niov, int max_sgls) + { + size_t tmp = 0; + int sgl_count = 0; + + *niov = 0; + + while (tmp bytes) { + void __user *base = iov[*niov].iov_base + off; + size_t len = iov[(*niov)++].iov_len - off; + + sgl_count += iov_num_pages(base, len); + tmp += min(len, bytes); + off = 0; + } + if (sgl_count max_sgls) { + pr_err(%s: requested sgl_count: %d exceeds pre-allocated + max_sgls: %d\n, __func__, sgl_count, max_sgls); + return -ENOBUFS; + } + return sgl_count; + } + + static int + vhost_scsi_iov_to_sgl(struct tcm_vhost_cmd *cmd, bool write, + struct iovec *iov, size_t iov_off, int niov, + struct scatterlist *sg, int sg_count) + { + int i, ret; + + for (i = 0; i niov; i++) { + void __user *base = iov[i].iov_base + iov_off; + size_t len = iov[i].iov_len - iov_off; + + ret = vhost_scsi_map_to_sgl(cmd, base, len, sg, write); + if (ret 0) { + for (i = 0; i sg_count; i++) { + struct page *page = sg_page(sg[i]); + if (page) + put_page(page); + } + return ret; + } + sg += ret; + iov_off = 0; + } + return 0; + } + + static int + vhost_scsi_mapal(struct tcm_vhost_cmd *cmd, +size_t prot_bytes, struct iovec *prot_iov, size_t prot_off, +size_t data_bytes, struct iovec *data_iov, size_t data_off) + { + int data_sgl_count = 0, niov, ret; + bool write = (cmd-tvc_data_direction == DMA_FROM_DEVICE); + + if (prot_bytes) { + int prot_sgl_count; + + if (!prot_iov) { + pr_err(%s: prot_iov is NULL, but prot_bytes: %zu + present\n, __func__, prot_bytes); + return -EINVAL; + } + prot_sgl_count = vhost_scsi_calc_sgls(prot_iov, prot_off, + prot_bytes, niov, + TCM_VHOST_PREALLOC_PROT_SGLS); + if (prot_sgl_count 0) + return prot_sgl_count; + + sg_init_table(cmd-tvc_prot_sgl, prot_sgl_count); + cmd-tvc_prot_sgl_count = prot_sgl_count; + pr_debug(%s prot_sg %p prot_sgl_count %u\n, __func__, +cmd-tvc_prot_sgl, cmd-tvc_prot_sgl_count); + + ret = vhost_scsi_iov_to_sgl(cmd, write, prot_iov, prot_off, + niov, cmd-tvc_prot_sgl, + prot_sgl_count); + if (ret 0) { + cmd-tvc_prot_sgl_count = 0; + return ret; + } + } + if (!data_iov) { + pr_err(%s: data_iov is NULL, but data_bytes: %zu present\n, + __func__, data_bytes); + return -EINVAL; + } + data_sgl_count = vhost_scsi_calc_sgls(data_iov, data_off, data_bytes, + niov, TCM_VHOST_PREALLOC_SGLS); + if (data_sgl_count 0) + return data_sgl_count; + + sg_init_table(cmd-tvc_sgl, data_sgl_count); + cmd-tvc_sgl_count = data_sgl_count; + pr_debug(%s data_sg %p data_sgl_count %u\n, __func__, + cmd-tvc_sgl, cmd-tvc_sgl_count); + + return
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_tpg.c between commit de06875f0896 ("target: Remove extra percpu_ref_init") from Linus' tree and commit d344f8a15637 ("target: Rename core_tpg_{pre,post}_addlun for clarity") from the target-updates tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au diff --cc drivers/target/target_core_tpg.c index 2a573de19a9f,d1df39a05d88.. --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c @@@ -656,9 -658,15 +656,9 @@@ static int core_tpg_setup_virtual_lun0( spin_lock_init(>lun_sep_lock); init_completion(>lun_ref_comp); - ret = core_tpg_post_addlun(se_tpg, lun, lun_access, dev); - ret = percpu_ref_init(>lun_ref, core_tpg_lun_ref_release); - if (ret < 0) - return ret; - + ret = core_tpg_add_lun(se_tpg, lun, lun_access, dev); - if (ret < 0) { - percpu_ref_cancel_init(>lun_ref); + if (ret < 0) return ret; - } return 0; } pgpYNbAT59FL0.pgp Description: PGP signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_tpg.c between commit de06875f0896 (target: Remove extra percpu_ref_init) from Linus' tree and commit d344f8a15637 (target: Rename core_tpg_{pre,post}_addlun for clarity) from the target-updates tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au diff --cc drivers/target/target_core_tpg.c index 2a573de19a9f,d1df39a05d88.. --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c @@@ -656,9 -658,15 +656,9 @@@ static int core_tpg_setup_virtual_lun0( spin_lock_init(lun-lun_sep_lock); init_completion(lun-lun_ref_comp); - ret = core_tpg_post_addlun(se_tpg, lun, lun_access, dev); - ret = percpu_ref_init(lun-lun_ref, core_tpg_lun_ref_release); - if (ret 0) - return ret; - + ret = core_tpg_add_lun(se_tpg, lun, lun_access, dev); - if (ret 0) { - percpu_ref_cancel_init(lun-lun_ref); + if (ret 0) return ret; - } return 0; } pgpYNbAT59FL0.pgp Description: PGP signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in lib/percpu-refcount.c between commit 5e9dd373dea4 ("percpu_refcount: export symbols") from Linus' tree and commit c9e8d128fe31 ("percpu-refcount: Add EXPORT_SYMBOL to use percpu_ref from modules") from the target-updates tree. I fixed it up (the version from Linus' tree used EXPORT_SYMBOL_GPL, so I used that) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au pgpaQfeVLj8gO.pgp Description: PGP signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in lib/percpu-refcount.c between commit 5e9dd373dea4 (percpu_refcount: export symbols) from Linus' tree and commit c9e8d128fe31 (percpu-refcount: Add EXPORT_SYMBOL to use percpu_ref from modules) from the target-updates tree. I fixed it up (the version from Linus' tree used EXPORT_SYMBOL_GPL, so I used that) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au pgpaQfeVLj8gO.pgp Description: PGP signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_transport.c between commit 3ea160b3e8f0 ("target: Fix handling of aborted commands") from Linus' tree and commit 019c4ca62148 ("target: kill dev->dev_task_attr_type") from the target-updates tree. I just use the target-updates tree version and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au pgpoD4vPyEh6f.pgp Description: PGP signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_transport.c between commit 3ea160b3e8f0 (target: Fix handling of aborted commands) from Linus' tree and commit 019c4ca62148 (target: kill dev-dev_task_attr_type) from the target-updates tree. I just use the target-updates tree version and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwells...@canb.auug.org.au pgpoD4vPyEh6f.pgp Description: PGP signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_transport.c between commit 6138ed2ab879 ("target: move transport_get_sense_data") from Linus' tree and commit 867c8e7dae31 ("target: Simplify fabric sense data length handling") from the target-updates tree. I just removed the latter version of transport_get_sense_data() (which has been renamed to transport_get_sense_buffer() and changed in Linus' tree) and can carry the fix as necessary - someone should really look at the result when it is available. -- Cheers, Stephen Rothwells...@canb.auug.org.au pgpsCKtVCVbsV.pgp Description: PGP signature
linux-next: manual merge of the target-updates tree with Linus' tree
Hi Nicholas, Today's linux-next merge of the target-updates tree got a conflict in drivers/target/target_core_transport.c between commit 6138ed2ab879 (target: move transport_get_sense_data) from Linus' tree and commit 867c8e7dae31 (target: Simplify fabric sense data length handling) from the target-updates tree. I just removed the latter version of transport_get_sense_data() (which has been renamed to transport_get_sense_buffer() and changed in Linus' tree) and can carry the fix as necessary - someone should really look at the result when it is available. -- Cheers, Stephen Rothwells...@canb.auug.org.au pgpsCKtVCVbsV.pgp Description: PGP signature