From: Douglas Gilbert <dgilbert@interlog.com>
To: James Bottomley <James.Bottomley@suse.de>,
SCSI development list <linux-scsi@vger.kernel.org>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Subject: [PATCH] scsi_debug: virtual_gb ignores sector_size
Date: Sun, 25 Apr 2010 12:30:23 +0200 [thread overview]
Message-ID: <4BD419BF.4040109@interlog.com> (raw)
[-- 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;
}
next reply other threads:[~2010-04-25 10:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-25 10:30 Douglas Gilbert [this message]
2010-04-26 14:44 ` [PATCH] scsi_debug: virtual_gb ignores sector_size Martin K. Petersen
2010-04-26 14:46 ` James Bottomley
2010-05-02 15:44 ` James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BD419BF.4040109@interlog.com \
--to=dgilbert@interlog.com \
--cc=James.Bottomley@suse.de \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox