aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2008-10-10 15:33:24 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2008-10-10 15:33:59 -0400
commit3ce66093f5ec5a6ae0ca90c79d81eee15e842293 (patch)
tree5c345c93203742dd3b03a128e4e21db789a5e4a1 /drivers
parentada3df9171e48b2a5f1e9c828337b61746e19ff0 (diff)
[S390] xpram: per device block request queues.
The xpram driver uses a single block device queue for all of its devices so far. With recent kernels removing xpram module fails to clean up all sysfs files. The next time the xpram module is loaded you'll get warnings: WARNING: at fs/sysfs/dir.c:463 sysfs_add_one+0x5e/0x64() sysfs: duplicate filename '35:0' can not be created Modules linked in: xpram(+) [last unloaded: xpram] Followed by the usual WARN_ON output, followed by an error message from kobject_add_internal, followed by a badness in genhd. Allocating a block queue per device fixes this. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/s390/block/xpram.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
index dd9b986389a2..03916989ed2d 100644
--- a/drivers/s390/block/xpram.c
+++ b/drivers/s390/block/xpram.c
@@ -56,6 +56,7 @@ typedef struct {
56static xpram_device_t xpram_devices[XPRAM_MAX_DEVS]; 56static xpram_device_t xpram_devices[XPRAM_MAX_DEVS];
57static unsigned int xpram_sizes[XPRAM_MAX_DEVS]; 57static unsigned int xpram_sizes[XPRAM_MAX_DEVS];
58static struct gendisk *xpram_disks[XPRAM_MAX_DEVS]; 58static struct gendisk *xpram_disks[XPRAM_MAX_DEVS];
59static struct request_queue *xpram_queues[XPRAM_MAX_DEVS];
59static unsigned int xpram_pages; 60static unsigned int xpram_pages;
60static int xpram_devs; 61static int xpram_devs;
61 62
@@ -330,18 +331,22 @@ static int __init xpram_setup_sizes(unsigned long pages)
330 return 0; 331 return 0;
331} 332}
332 333
333static struct request_queue *xpram_queue;
334
335static int __init xpram_setup_blkdev(void) 334static int __init xpram_setup_blkdev(void)
336{ 335{
337 unsigned long offset; 336 unsigned long offset;
338 int i, rc = -ENOMEM; 337 int i, rc = -ENOMEM;
339 338
340 for (i = 0; i < xpram_devs; i++) { 339 for (i = 0; i < xpram_devs; i++) {
341 struct gendisk *disk = alloc_disk(1); 340 xpram_disks[i] = alloc_disk(1);
342 if (!disk) 341 if (!xpram_disks[i])
342 goto out;
343 xpram_queues[i] = blk_alloc_queue(GFP_KERNEL);
344 if (!xpram_queues[i]) {
345 put_disk(xpram_disks[i]);
343 goto out; 346 goto out;
344 xpram_disks[i] = disk; 347 }
348 blk_queue_make_request(xpram_queues[i], xpram_make_request);
349 blk_queue_hardsect_size(xpram_queues[i], 4096);
345 } 350 }
346 351
347 /* 352 /*
@@ -352,18 +357,6 @@ static int __init xpram_setup_blkdev(void)
352 goto out; 357 goto out;
353 358
354 /* 359 /*
355 * Assign the other needed values: make request function, sizes and
356 * hardsect size. All the minor devices feature the same value.
357 */
358 xpram_queue = blk_alloc_queue(GFP_KERNEL);
359 if (!xpram_queue) {
360 rc = -ENOMEM;
361 goto out_unreg;
362 }
363 blk_queue_make_request(xpram_queue, xpram_make_request);
364 blk_queue_hardsect_size(xpram_queue, 4096);
365
366 /*
367 * Setup device structures. 360 * Setup device structures.
368 */ 361 */
369 offset = 0; 362 offset = 0;
@@ -377,18 +370,18 @@ static int __init xpram_setup_blkdev(void)
377 disk->first_minor = i; 370 disk->first_minor = i;
378 disk->fops = &xpram_devops; 371 disk->fops = &xpram_devops;
379 disk->private_data = &xpram_devices[i]; 372 disk->private_data = &xpram_devices[i];
380 disk->queue = xpram_queue; 373 disk->queue = xpram_queues[i];
381 sprintf(disk->disk_name, "slram%d", i); 374 sprintf(disk->disk_name, "slram%d", i);
382 set_capacity(disk, xpram_sizes[i] << 1); 375 set_capacity(disk, xpram_sizes[i] << 1);
383 add_disk(disk); 376 add_disk(disk);
384 } 377 }
385 378
386 return 0; 379 return 0;
387out_unreg:
388 unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME);
389out: 380out:
390 while (i--) 381 while (i--) {
382 blk_cleanup_queue(xpram_queues[i]);
391 put_disk(xpram_disks[i]); 383 put_disk(xpram_disks[i]);
384 }
392 return rc; 385 return rc;
393} 386}
394 387
@@ -400,10 +393,10 @@ static void __exit xpram_exit(void)
400 int i; 393 int i;
401 for (i = 0; i < xpram_devs; i++) { 394 for (i = 0; i < xpram_devs; i++) {
402 del_gendisk(xpram_disks[i]); 395 del_gendisk(xpram_disks[i]);
396 blk_cleanup_queue(xpram_queues[i]);
403 put_disk(xpram_disks[i]); 397 put_disk(xpram_disks[i]);
404 } 398 }
405 unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME); 399 unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME);
406 blk_cleanup_queue(xpram_queue);
407} 400}
408 401
409static int __init xpram_init(void) 402static int __init xpram_init(void)