scsi_debug: virtual_gb ignores sector_size
PATCH 1/1 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.
ChangeLog:
- correct get_sdebug_capacity() calculation of sectors when virtual_gb option is used. Needs to take into account sector_size.
drivers/scsi/scsi_debug.c2633mqnu2ss renamed from drivers/scsi/scsi_debug.c +3 -2
@@ -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; }
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Doug" == Douglas Gilbert <[email protected]> writes:
Doug> In the scsi_debug driver, the virtual_gb option ignores the Doug> sector_size, implicitly assuming that is 512 bytes. So if Doug> 'virtual_gb=1 sector_size=4096' the result is an 8 GB (virtual) Doug> disk.
James: We've got quite a few unmerged scsi_debug changes out there right now. Are you keeping track??
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Quoted 7 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Doug" == Douglas Gilbert <[email protected]> writes:
Doug> In the
scsi_debugdriver, thevirtual_gboption ignores the Doug>sector_size, implicitly assuming that is 512 bytes. So if Doug> 'virtual_gb=1 sector_size=4096' the result is an 8 GB (virtual) Doug> disk.
Quoted 5 lines
James: We've got quite a few unmerged
scsi_debugchanges out there right now. Are you keeping track??
Yes, but unless I missed something, Doug is still the maintainer, so I'm waiting for his testing and ack on some of the ones you submitted.
James
drivers/scsi/scsi_debug.c2633mqnu2ss line 61
Quoted 10 lines · Douglas Gilbert
---
linux/drivers/scsi/scsi_debug.c2010-03-24 20:13:03.000000000
+0100
+++ linux/drivers/scsi/scsi_debug.c2633mqnu2ss 2010-04-25 12:03:50.000000000 +0200drivers/scsi/scsi_debug.c2633mqnu2ss renamed from drivers/scsi/scsi_debug.c +1
-1@@ -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";
I got a rejection here ... presumably because there's a missing patch somewhere along the way.
I've got to say, I don't think bumping the date with every patch is a good idea ... apart from the patch ordering problems, it will give rejections every time I try to send a patch to stable (which I'm doing with this).
James