summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0060-target-Fix-range-calculation-in-WRITE-SAME-emulation.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0060-target-Fix-range-calculation-in-WRITE-SAME-emulation.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0060-target-Fix-range-calculation-in-WRITE-SAME-emulation.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0060-target-Fix-range-calculation-in-WRITE-SAME-emulation.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0060-target-Fix-range-calculation-in-WRITE-SAME-emulation.patch
new file mode 100644
index 00000000..264206d6
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0060-target-Fix-range-calculation-in-WRITE-SAME-emulation.patch
@@ -0,0 +1,41 @@
1From 63a96e329f2c66af145a93d6f42067e54ef932af Mon Sep 17 00:00:00 2001
2From: Roland Dreier <roland@purestorage.com>
3Date: Mon, 16 Jul 2012 17:10:17 -0700
4Subject: [PATCH 060/109] target: Fix range calculation in WRITE SAME
5 emulation when num blocks == 0
6
7commit 1765fe5edcb83f53fc67edeb559fcf4bc82c6460 upstream.
8
9When NUMBER OF LOGICAL BLOCKS is 0, WRITE SAME is supposed to write
10all the blocks from the specified LBA through the end of the device.
11However, dev->transport->get_blocks(dev) (perhaps confusingly) returns
12the last valid LBA rather than the number of blocks, so the correct
13number of blocks to write starting with lba is
14
15dev->transport->get_blocks(dev) - lba + 1
16
17(nab: Backport roland's for-3.6 patch to for-3.5)
18
19Signed-off-by: Roland Dreier <roland@purestorage.com>
20Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
21Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
22---
23 drivers/target/target_core_cdb.c | 2 +-
24 1 files changed, 1 insertions(+), 1 deletions(-)
25
26diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c
27index 65ea65a..93b9406 100644
28--- a/drivers/target/target_core_cdb.c
29+++ b/drivers/target/target_core_cdb.c
30@@ -1199,7 +1199,7 @@ int target_emulate_write_same(struct se_task *task)
31 if (num_blocks != 0)
32 range = num_blocks;
33 else
34- range = (dev->transport->get_blocks(dev) - lba);
35+ range = (dev->transport->get_blocks(dev) - lba) + 1;
36
37 pr_debug("WRITE_SAME UNMAP: LBA: %llu Range: %llu\n",
38 (unsigned long long)lba, (unsigned long long)range);
39--
401.7.7.6
41