mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
target: Add transport_reset_sgl_orig() for COMPARE_AND_WRITE
After COMPARE_AND_WRITE completes it's comparision, the WRITE payload SGLs head expect to be updated to point from the verify instance of user data, to the write instance of user data. So for this special case, add transport_reset_sgl_orig() usage within transport_free_pages() and add se_cmd->t_data_[sg,nents]_orig members to save the original assignments. Cc: Christoph Hellwig <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Martin Petersen <[email protected]> Cc: Chris Mason <[email protected]> Cc: James Bottomley <[email protected]> Cc: Nicholas Bellinger <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
This commit is contained in:
parent
8cefe07b5e
commit
47e459e622
2 changed files with 22 additions and 1 deletions
|
|
@ -1991,10 +1991,29 @@ static inline void transport_free_sgl(struct scatterlist *sgl, int nents)
|
|||
kfree(sgl);
|
||||
}
|
||||
|
||||
static inline void transport_reset_sgl_orig(struct se_cmd *cmd)
|
||||
{
|
||||
/*
|
||||
* Check for saved t_data_sg that may be used for COMPARE_AND_WRITE
|
||||
* emulation, and free + reset pointers if necessary..
|
||||
*/
|
||||
if (!cmd->t_data_sg_orig)
|
||||
return;
|
||||
|
||||
kfree(cmd->t_data_sg);
|
||||
cmd->t_data_sg = cmd->t_data_sg_orig;
|
||||
cmd->t_data_sg_orig = NULL;
|
||||
cmd->t_data_nents = cmd->t_data_nents_orig;
|
||||
cmd->t_data_nents_orig = 0;
|
||||
}
|
||||
|
||||
static inline void transport_free_pages(struct se_cmd *cmd)
|
||||
{
|
||||
if (cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC)
|
||||
if (cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) {
|
||||
transport_reset_sgl_orig(cmd);
|
||||
return;
|
||||
}
|
||||
transport_reset_sgl_orig(cmd);
|
||||
|
||||
transport_free_sgl(cmd->t_data_sg, cmd->t_data_nents);
|
||||
cmd->t_data_sg = NULL;
|
||||
|
|
|
|||
Loading…
Reference in a new issue