public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi_debug: virtual_gb ignores sector_size
@ 2010-04-25 10:30 Douglas Gilbert
  2010-04-26 14:44 ` Martin K. Petersen
  2010-05-02 15:44 ` James Bottomley
  0 siblings, 2 replies; 4+ messages in thread
From: Douglas Gilbert @ 2010-04-25 10:30 UTC (permalink / raw)
  To: James Bottomley, SCSI development list; +Cc: Martin K. Petersen

[-- Attachment #1: Type: text/plain, Size: 396 bytes --]

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.

ChangeLog:
   - correct get_sdebug_capacity() calculation of
     sectors when virtual_gb option is used. Needs
     to take into account sector_size.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>

[-- Attachment #2: sdebug_vgig_ss1.patch --]
[-- Type: text/x-patch, Size: 751 bytes --]

--- linux/drivers/scsi/scsi_debug.c	2010-03-24 20:13:03.000000000 +0100
+++ linux/drivers/scsi/scsi_debug.c2633mqnu2ss	2010-04-25 12:03:50.000000000 +0200
@@ -58,7 +58,7 @@
 #include "scsi_logging.h"
 
 #define SCSI_DEBUG_VERSION "1.82"
-static const char * scsi_debug_version_date = "20100324";
+static const char * scsi_debug_version_date = "20100425";
 
 /* Additional Sense Code (ASC) */
 #define NO_ADDITIONAL_SENSE 0x0
@@ -961,7 +961,8 @@ static int resp_start_stop(struct scsi_c
 static sector_t get_sdebug_capacity(void)
 {
 	if (scsi_debug_virtual_gb > 0)
-		return 2048 * 1024 * (sector_t)scsi_debug_virtual_gb;
+		return (sector_t)scsi_debug_virtual_gb *
+			(1073741824 / scsi_debug_sector_size);
 	else
 		return sdebug_store_sectors;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-02 15:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-25 10:30 [PATCH] scsi_debug: virtual_gb ignores sector_size Douglas Gilbert
2010-04-26 14:44 ` Martin K. Petersen
2010-04-26 14:46   ` James Bottomley
2010-05-02 15:44 ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox