diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2013-04-16 09:11:57 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-05-02 18:40:41 -0400 |
commit | cc34a8e663b2908b9ab487dab8456d117a1e0b93 (patch) | |
tree | 44afa617c1072371827df144f61e9781a99d9419 | |
parent | ac17078ae6947254331f56ce4f1db9ea221d43d6 (diff) |
[SCSI] scsi_debug: clear correct memory region when LBPRZ is enabled
The function unmap_region() clears memory region specified as the logical
block address and the number of logical blocks in ramdisk storage
(fake_storep) if lbpu and lbprz module parameters are enabled.
In the while loop of unmap_region(), it advances optimal unmap granularity
in logical blocks. But it only clears one logical block at LBA 'block' per
loop iteration. And furthermore, the 'block' is not pointing to a logical
block address which should be cleared, it is a index of probisioning map
(map_storep).
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | drivers/scsi/scsi_debug.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 5c321409fff3..4b5d3887ff47 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -2059,8 +2059,9 @@ static void unmap_region(sector_t lba, unsigned int len) | |||
2059 | clear_bit(block, map_storep); | 2059 | clear_bit(block, map_storep); |
2060 | if (scsi_debug_lbprz) | 2060 | if (scsi_debug_lbprz) |
2061 | memset(fake_storep + | 2061 | memset(fake_storep + |
2062 | block * scsi_debug_sector_size, 0, | 2062 | lba * scsi_debug_sector_size, 0, |
2063 | scsi_debug_sector_size); | 2063 | scsi_debug_sector_size * |
2064 | scsi_debug_unmap_granularity); | ||
2064 | } | 2065 | } |
2065 | lba += granularity - rem; | 2066 | lba += granularity - rem; |
2066 | } | 2067 | } |