* [PATCH 0/2] scsi_debug: bug fixes for certain module parameters
@ 2013-08-26 13:08 Akinobu Mita
2013-08-26 13:08 ` [PATCH 1/2] scsi_debug: fix endianness bug in sdebug_build_parts() Akinobu Mita
2013-08-26 13:08 ` [PATCH 2/2] scsi_debug: fix logical block provisioning support when unmap_alignment != 0 Akinobu Mita
0 siblings, 2 replies; 3+ messages in thread
From: Akinobu Mita @ 2013-08-26 13:08 UTC (permalink / raw)
To: linux-scsi
Cc: Akinobu Mita, James E.J. Bottomley, Martin Peschke,
Douglas Gilbert, Martin K. Petersen
Hi James,
Please consider to apply these patches to your tree. These patches are
subset of the patch set I sent before:
http://marc.info/?l=linux-scsi&m=137388918402750&w=2
I'm sending the patches which have been acked by the appropriate reviewers.
The rest of the patches need some rework, and I'll try to submit next time.
Akinobu Mita (2):
scsi_debug: fix endianness bug in sdebug_build_parts()
scsi_debug: fix logical block provisioning support when
unmap_alignment != 0
drivers/scsi/scsi_debug.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Cc: Douglas Gilbert <dgilbert@interlog.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
--
1.8.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] scsi_debug: fix endianness bug in sdebug_build_parts()
2013-08-26 13:08 [PATCH 0/2] scsi_debug: bug fixes for certain module parameters Akinobu Mita
@ 2013-08-26 13:08 ` Akinobu Mita
2013-08-26 13:08 ` [PATCH 2/2] scsi_debug: fix logical block provisioning support when unmap_alignment != 0 Akinobu Mita
1 sibling, 0 replies; 3+ messages in thread
From: Akinobu Mita @ 2013-08-26 13:08 UTC (permalink / raw)
To: linux-scsi; +Cc: Akinobu Mita, James E.J. Bottomley, Douglas Gilbert
With module parameter num_parts > 0, partition table is built on the
ramdisk storage when loading the driver. Unfortunately, there is an
endianness bug in sdebug_build_parts(). So the partition table is not
correctly initialized on big-endian systems.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Douglas Gilbert <dgilbert@interlog.com>
Cc: linux-scsi@vger.kernel.org
---
drivers/scsi/scsi_debug.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index cb4fefa..2f39b13 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -2659,8 +2659,8 @@ static void __init sdebug_build_parts(unsigned char *ramp,
/ sdebug_sectors_per;
pp->end_sector = (end_sec % sdebug_sectors_per) + 1;
- pp->start_sect = start_sec;
- pp->nr_sects = end_sec - start_sec + 1;
+ pp->start_sect = cpu_to_le32(start_sec);
+ pp->nr_sects = cpu_to_le32(end_sec - start_sec + 1);
pp->sys_ind = 0x83; /* plain Linux partition */
}
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] scsi_debug: fix logical block provisioning support when unmap_alignment != 0
2013-08-26 13:08 [PATCH 0/2] scsi_debug: bug fixes for certain module parameters Akinobu Mita
2013-08-26 13:08 ` [PATCH 1/2] scsi_debug: fix endianness bug in sdebug_build_parts() Akinobu Mita
@ 2013-08-26 13:08 ` Akinobu Mita
1 sibling, 0 replies; 3+ messages in thread
From: Akinobu Mita @ 2013-08-26 13:08 UTC (permalink / raw)
To: linux-scsi
Cc: Akinobu Mita, James E.J. Bottomley, Douglas Gilbert,
Martin K. Petersen
Commit b90ebc3d5c41c9164ae04efd2e4f8204c2a186f1 ("[SCSI] scsi_debug:
fix logical block provisioning support") fixed several issues with
logical block provisioning support, but it still doesn't properly fix
the cases when unmap_alignment > 0.
For example, load scsi_debug module with the following module parameters
and make all blocks mapped by filling the storage with zero.
# modprobe scsi_debug lbpu=1 unmap_alignment=1 unmap_granularity=4
# dd if=/dev/zero of=$DEV
Then, try to unmap the first unmappable blocks at lba=1, but GET LBA STATUS
unexpectedly reports that the last UNMAP has done nothing.
# sg_unmap --lba=1 --num=4 $DEV
# sg_get_lba_status --lba=1 $DEV
descriptor LBA: 0x0000000000000001 blocks: 16383 mapped
The problem is in map_index_to_lba(), which should return the first
LBA which is corresponding to a given index of provisioning map
(map_storep).
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Acked-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Douglas Gilbert <dgilbert@interlog.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
---
drivers/scsi/scsi_debug.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 2f39b13..01c0ffa 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -1997,8 +1997,14 @@ static unsigned long lba_to_map_index(sector_t lba)
static sector_t map_index_to_lba(unsigned long index)
{
- return index * scsi_debug_unmap_granularity -
- scsi_debug_unmap_alignment;
+ sector_t lba = index * scsi_debug_unmap_granularity;
+
+ if (scsi_debug_unmap_alignment) {
+ lba -= scsi_debug_unmap_granularity -
+ scsi_debug_unmap_alignment;
+ }
+
+ return lba;
}
static unsigned int map_state(sector_t lba, unsigned int *num)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-26 13:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-26 13:08 [PATCH 0/2] scsi_debug: bug fixes for certain module parameters Akinobu Mita
2013-08-26 13:08 ` [PATCH 1/2] scsi_debug: fix endianness bug in sdebug_build_parts() Akinobu Mita
2013-08-26 13:08 ` [PATCH 2/2] scsi_debug: fix logical block provisioning support when unmap_alignment != 0 Akinobu Mita
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox