[SCSI] scsi_debug: remove unnecessary sdebug_store_size

sdebug_store_size doesn't need to be static global. It's used at
startup only.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:
FUJITA Tomonori 2008-03-30 00:59:54 +09:00 коммит произвёл James Bottomley
Родитель 540d9b40fa
Коммит f58b0efbf4
1 изменённых файлов: 6 добавлений и 7 удалений

Просмотреть файл

@ -148,7 +148,6 @@ static int scsi_debug_cmnd_count = 0;
#define DEV_READONLY(TGT) (0) #define DEV_READONLY(TGT) (0)
#define DEV_REMOVEABLE(TGT) (0) #define DEV_REMOVEABLE(TGT) (0)
static unsigned int sdebug_store_size; /* in bytes */
static unsigned int sdebug_store_sectors; static unsigned int sdebug_store_sectors;
static sector_t sdebug_capacity; /* in sectors */ static sector_t sdebug_capacity; /* in sectors */
@ -1969,7 +1968,8 @@ static void __init init_all_queued(void)
spin_unlock_irqrestore(&queued_arr_lock, iflags); spin_unlock_irqrestore(&queued_arr_lock, iflags);
} }
static void __init sdebug_build_parts(unsigned char * ramp) static void __init sdebug_build_parts(unsigned char *ramp,
unsigned int store_size)
{ {
struct partition * pp; struct partition * pp;
int starts[SDEBUG_MAX_PARTS + 2]; int starts[SDEBUG_MAX_PARTS + 2];
@ -1977,7 +1977,7 @@ static void __init sdebug_build_parts(unsigned char * ramp)
int heads_by_sects, start_sec, end_sec; int heads_by_sects, start_sec, end_sec;
/* assume partition table already zeroed */ /* assume partition table already zeroed */
if ((scsi_debug_num_parts < 1) || (sdebug_store_size < 1048576)) if ((scsi_debug_num_parts < 1) || (store_size < 1048576))
return; return;
if (scsi_debug_num_parts > SDEBUG_MAX_PARTS) { if (scsi_debug_num_parts > SDEBUG_MAX_PARTS) {
scsi_debug_num_parts = SDEBUG_MAX_PARTS; scsi_debug_num_parts = SDEBUG_MAX_PARTS;
@ -2505,8 +2505,8 @@ static int __init scsi_debug_init(void)
if (scsi_debug_dev_size_mb < 1) if (scsi_debug_dev_size_mb < 1)
scsi_debug_dev_size_mb = 1; /* force minimum 1 MB ramdisk */ scsi_debug_dev_size_mb = 1; /* force minimum 1 MB ramdisk */
sdebug_store_size = (unsigned int)scsi_debug_dev_size_mb * 1048576; sz = (unsigned int)scsi_debug_dev_size_mb * 1048576;
sdebug_store_sectors = sdebug_store_size / SECT_SIZE; sdebug_store_sectors = sz / SECT_SIZE;
if (scsi_debug_virtual_gb > 0) { if (scsi_debug_virtual_gb > 0) {
sdebug_capacity = 2048 * 1024; sdebug_capacity = 2048 * 1024;
sdebug_capacity *= scsi_debug_virtual_gb; sdebug_capacity *= scsi_debug_virtual_gb;
@ -2530,7 +2530,6 @@ static int __init scsi_debug_init(void)
(sdebug_sectors_per * sdebug_heads); (sdebug_sectors_per * sdebug_heads);
} }
sz = sdebug_store_size;
fake_storep = vmalloc(sz); fake_storep = vmalloc(sz);
if (NULL == fake_storep) { if (NULL == fake_storep) {
printk(KERN_ERR "scsi_debug_init: out of memory, 1\n"); printk(KERN_ERR "scsi_debug_init: out of memory, 1\n");
@ -2538,7 +2537,7 @@ static int __init scsi_debug_init(void)
} }
memset(fake_storep, 0, sz); memset(fake_storep, 0, sz);
if (scsi_debug_num_parts > 0) if (scsi_debug_num_parts > 0)
sdebug_build_parts(fake_storep); sdebug_build_parts(fake_storep, sz);
ret = device_register(&pseudo_primary); ret = device_register(&pseudo_primary);
if (ret < 0) { if (ret < 0) {