From 04b790e43aa1d720bd24b2dd21ec7ce44136cdff Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Sat, 19 Jan 2013 01:59:01 +0000 Subject: [PATCH] Orig offset should also be saved during SG entries manipulations git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4744 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/scst.h | 2 +- scst/src/scst_lib.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scst/include/scst.h b/scst/include/scst.h index 022b38330..1c9bca356 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -2140,7 +2140,7 @@ struct scst_cmd { int *p_orig_sg_cnt; int orig_sg_cnt; struct scatterlist *orig_sg_entry; - int orig_entry_len; + int orig_entry_offs, orig_entry_len; /* Used to retry commands in case of double UA */ int dbl_ua_orig_resp_data_len, dbl_ua_orig_data_direction; diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 9a1f34623..3b178c65e 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -2816,6 +2816,7 @@ static void scst_adjust_sg(struct scst_cmd *cmd, struct scatterlist *sg, cmd->p_orig_sg_cnt = sg_cnt; cmd->orig_sg_cnt = *sg_cnt; cmd->orig_sg_entry = &sg[j]; + cmd->orig_entry_offs = sg[j].offset; cmd->orig_entry_len = sg[j].length; *sg_cnt = (left > 0) ? i+1 : i; sg[j].length = left; @@ -2835,10 +2836,11 @@ static void scst_adjust_sg(struct scst_cmd *cmd, struct scatterlist *sg, */ void scst_restore_sg_buff(struct scst_cmd *cmd) { - TRACE_MEM("cmd %p, sg %p, orig_sg_entry %p, " + TRACE_MEM("cmd %p, sg %p, orig_sg_entry %p, orig_entry_offs %d, " "orig_entry_len %d, orig_sg_cnt %d", cmd, cmd->sg, - cmd->orig_sg_entry, cmd->orig_entry_len, + cmd->orig_sg_entry, cmd->orig_entry_offs, cmd->orig_entry_len, cmd->orig_sg_cnt); + cmd->orig_sg_entry->offset = cmd->orig_entry_offs; cmd->orig_sg_entry->length = cmd->orig_entry_len; *cmd->p_orig_sg_cnt = cmd->orig_sg_cnt; cmd->sg_buff_modified = 0;