Skip to content

Commit 5447ed6

Browse files
doug-gilbertJames Bottomley
authored andcommitted
[SCSI] scsi_debug: virtual_gb ignores sector_size
In the scsi_debug driver, the virtual_gb option ignores the sector_size, implicitly assuming that is 512 bytes. So if 'virtual_gb=1 sector_size=4096' the result is an 8 GB (virtual) disk. Signed-off-by: Douglas Gilbert <dgilbert@interlog.com> Cc: Stable Tree <stable@kernel.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
1 parent 96b1f96 commit 5447ed6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/scsi/scsi_debug.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,8 @@ static int resp_start_stop(struct scsi_cmnd * scp,
957957
static sector_t get_sdebug_capacity(void)
958958
{
959959
if (scsi_debug_virtual_gb > 0)
960-
return 2048 * 1024 * (sector_t)scsi_debug_virtual_gb;
960+
return (sector_t)scsi_debug_virtual_gb *
961+
(1073741824 / scsi_debug_sector_size);
961962
else
962963
return sdebug_store_sectors;
963964
}

0 commit comments

Comments
 (0)