scst_lib: WRITE SAME performance improvement fix

Fix the argument of the second kunmap() call. Detected by smatch.
See also patch "scst_lib: Improve WRITE SAME performance" (commit
ID a15628d683). Note: this patch does not have any impact on
64-bit architectures since kunmap() doesn't to anything on such
architectures.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6350 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2015-06-16 23:53:43 +00:00
parent ae2534f0a6
commit a0f46a0a69
+4 -2
View File
@@ -5877,16 +5877,18 @@ void scst_write_same(struct scst_cmd *cmd)
if (cmd->bufflen <= PAGE_SIZE / 2)
pg = alloc_page(GFP_KERNEL);
if (pg) {
struct page *src_pg;
void *src, *dst;
int k;
mult = 0;
src = kmap(sg_page(cmd->sg));
src_pg = sg_page(cmd->sg);
src = kmap(src_pg);
dst = kmap(pg);
for (k = 0; k < PAGE_SIZE; k += cmd->bufflen, mult++)
memcpy(dst + k, src + cmd->sg->offset, cmd->bufflen);
kunmap(pg);
kunmap(src);
kunmap(src_pg);
offset = 0;
length = k;
} else {