mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
target: Add per device xcopy_lun for copy offload I/O
This patch adds a se_device->xcopy_lun that is used for local copy offload I/O, instead of allocating + initializing a pseudo se_lun for each received EXTENDED_COPY operation. Also, move declaration of struct se_lun + struct se_port_stat_grps ahead of struct se_device. Signed-off-by: Nicholas Bellinger <[email protected]>
This commit is contained in:
parent
4a9a6c8d53
commit
4863e52565
3 changed files with 39 additions and 45 deletions
|
|
@ -1409,6 +1409,7 @@ static void scsi_dump_inquiry(struct se_device *dev)
|
|||
struct se_device *target_alloc_device(struct se_hba *hba, const char *name)
|
||||
{
|
||||
struct se_device *dev;
|
||||
struct se_lun *xcopy_lun;
|
||||
|
||||
dev = hba->transport->alloc_device(hba, name);
|
||||
if (!dev)
|
||||
|
|
@ -1471,6 +1472,14 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name)
|
|||
dev->dev_attrib.fabric_max_sectors = DA_FABRIC_MAX_SECTORS;
|
||||
dev->dev_attrib.optimal_sectors = DA_FABRIC_MAX_SECTORS;
|
||||
|
||||
xcopy_lun = &dev->xcopy_lun;
|
||||
xcopy_lun->lun_se_dev = dev;
|
||||
init_completion(&xcopy_lun->lun_shutdown_comp);
|
||||
INIT_LIST_HEAD(&xcopy_lun->lun_acl_list);
|
||||
spin_lock_init(&xcopy_lun->lun_acl_lock);
|
||||
spin_lock_init(&xcopy_lun->lun_sep_lock);
|
||||
init_completion(&xcopy_lun->lun_ref_comp);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -401,9 +401,6 @@ static void xcopy_pt_release_cmd(struct se_cmd *se_cmd)
|
|||
struct xcopy_pt_cmd *xpt_cmd = container_of(se_cmd,
|
||||
struct xcopy_pt_cmd, se_cmd);
|
||||
|
||||
if (xpt_cmd->remote_port)
|
||||
kfree(se_cmd->se_lun);
|
||||
|
||||
kfree(xpt_cmd);
|
||||
}
|
||||
|
||||
|
|
@ -568,21 +565,10 @@ static int target_xcopy_init_pt_lun(
|
|||
return 0;
|
||||
}
|
||||
|
||||
pt_cmd->se_lun = kzalloc(sizeof(struct se_lun), GFP_KERNEL);
|
||||
if (!pt_cmd->se_lun) {
|
||||
pr_err("Unable to allocate pt_cmd->se_lun\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
init_completion(&pt_cmd->se_lun->lun_shutdown_comp);
|
||||
INIT_LIST_HEAD(&pt_cmd->se_lun->lun_acl_list);
|
||||
spin_lock_init(&pt_cmd->se_lun->lun_acl_lock);
|
||||
spin_lock_init(&pt_cmd->se_lun->lun_sep_lock);
|
||||
init_completion(&pt_cmd->se_lun->lun_ref_comp);
|
||||
|
||||
pt_cmd->se_lun = &se_dev->xcopy_lun;
|
||||
pt_cmd->se_dev = se_dev;
|
||||
|
||||
pr_debug("Setup emulated se_dev: %p from se_dev\n", pt_cmd->se_dev);
|
||||
pt_cmd->se_lun->lun_se_dev = se_dev;
|
||||
pt_cmd->se_cmd_flags |= SCF_SE_LUN_CMD | SCF_CMD_XCOPY_PASSTHROUGH;
|
||||
|
||||
pr_debug("Setup emulated se_dev: %p to pt_cmd->se_lun->lun_se_dev\n",
|
||||
|
|
@ -653,8 +639,6 @@ static int target_xcopy_setup_pt_cmd(
|
|||
return 0;
|
||||
|
||||
out:
|
||||
if (remote_port == true)
|
||||
kfree(cmd->se_lun);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue