Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 110824
b: refs/heads/master
c: 3ce6609
h: refs/heads/master
v: v3
  • Loading branch information
Martin Schwidefsky committed Oct 10, 2008
1 parent b630e5b commit de31af2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ada3df9171e48b2a5f1e9c828337b61746e19ff0
refs/heads/master: 3ce66093f5ec5a6ae0ca90c79d81eee15e842293
37 changes: 15 additions & 22 deletions trunk/drivers/s390/block/xpram.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ typedef struct {
static xpram_device_t xpram_devices[XPRAM_MAX_DEVS];
static unsigned int xpram_sizes[XPRAM_MAX_DEVS];
static struct gendisk *xpram_disks[XPRAM_MAX_DEVS];
static struct request_queue *xpram_queues[XPRAM_MAX_DEVS];
static unsigned int xpram_pages;
static int xpram_devs;

Expand Down Expand Up @@ -330,18 +331,22 @@ static int __init xpram_setup_sizes(unsigned long pages)
return 0;
}

static struct request_queue *xpram_queue;

static int __init xpram_setup_blkdev(void)
{
unsigned long offset;
int i, rc = -ENOMEM;

for (i = 0; i < xpram_devs; i++) {
struct gendisk *disk = alloc_disk(1);
if (!disk)
xpram_disks[i] = alloc_disk(1);
if (!xpram_disks[i])
goto out;
xpram_queues[i] = blk_alloc_queue(GFP_KERNEL);
if (!xpram_queues[i]) {
put_disk(xpram_disks[i]);
goto out;
xpram_disks[i] = disk;
}
blk_queue_make_request(xpram_queues[i], xpram_make_request);
blk_queue_hardsect_size(xpram_queues[i], 4096);
}

/*
Expand All @@ -351,18 +356,6 @@ static int __init xpram_setup_blkdev(void)
if (rc < 0)
goto out;

/*
* Assign the other needed values: make request function, sizes and
* hardsect size. All the minor devices feature the same value.
*/
xpram_queue = blk_alloc_queue(GFP_KERNEL);
if (!xpram_queue) {
rc = -ENOMEM;
goto out_unreg;
}
blk_queue_make_request(xpram_queue, xpram_make_request);
blk_queue_hardsect_size(xpram_queue, 4096);

/*
* Setup device structures.
*/
Expand All @@ -377,18 +370,18 @@ static int __init xpram_setup_blkdev(void)
disk->first_minor = i;
disk->fops = &xpram_devops;
disk->private_data = &xpram_devices[i];
disk->queue = xpram_queue;
disk->queue = xpram_queues[i];
sprintf(disk->disk_name, "slram%d", i);
set_capacity(disk, xpram_sizes[i] << 1);
add_disk(disk);
}

return 0;
out_unreg:
unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME);
out:
while (i--)
while (i--) {
blk_cleanup_queue(xpram_queues[i]);
put_disk(xpram_disks[i]);
}
return rc;
}

Expand All @@ -400,10 +393,10 @@ static void __exit xpram_exit(void)
int i;
for (i = 0; i < xpram_devs; i++) {
del_gendisk(xpram_disks[i]);
blk_cleanup_queue(xpram_queues[i]);
put_disk(xpram_disks[i]);
}
unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME);
blk_cleanup_queue(xpram_queue);
}

static int __init xpram_init(void)
Expand Down

0 comments on commit de31af2

Please sign in to comment.