aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 19:03:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 19:03:40 -0400
commit548453fd107f789f5f1bc2dc13cc432ceb3b5efd (patch)
treedc5a62d49260d66b7390ef110113134e3bef9152 /drivers/block
parent9fd91217b15751997cab35ad309b37b44eaa6774 (diff)
parentfb199746303a6bfd6121834ec9e810471185c530 (diff)
Merge branch 'for-2.6.26' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.26' of git://git.kernel.dk/linux-2.6-block: block: fix blk_register_queue() return value block: fix memory hotplug and bouncing in block layer block: replace remaining __FUNCTION__ occurrences Kconfig: clean up block/Kconfig help descriptions cciss: fix warning oops on rmmod of driver cciss: Fix race between disk-adding code and interrupt handler block: move the padding adjustment to blk_rq_map_sg block: add bio_copy_user_iov support to blk_rq_map_user_iov block: convert bio_copy_user to bio_copy_user_iov loop: manage partitions in disk image cdrom: use kmalloced buffers instead of buffers on stack cdrom: make unregister_cdrom() return void cdrom: use list_head for cdrom_device_info list cdrom: protect cdrom_device_info list by mutex cdrom: cleanup hardcoded error-code cdrom: remove ifdef CONFIG_SYSCTL
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/cciss.c17
-rw-r--r--drivers/block/cciss_scsi.c2
-rw-r--r--drivers/block/loop.c26
-rw-r--r--drivers/block/sx8.c6
4 files changed, 41 insertions, 10 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 9c9627e8e334..cf6083a1f928 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1349,6 +1349,10 @@ static void cciss_update_drive_info(int ctlr, int drv_index)
1349 spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags); 1349 spin_lock_irqsave(CCISS_LOCK(h->ctlr), flags);
1350 h->drv[drv_index].busy_configuring = 1; 1350 h->drv[drv_index].busy_configuring = 1;
1351 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); 1351 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
1352
1353 /* deregister_disk sets h->drv[drv_index].queue = NULL */
1354 /* which keeps the interrupt handler from starting */
1355 /* the queue. */
1352 ret = deregister_disk(h->gendisk[drv_index], 1356 ret = deregister_disk(h->gendisk[drv_index],
1353 &h->drv[drv_index], 0); 1357 &h->drv[drv_index], 0);
1354 h->drv[drv_index].busy_configuring = 0; 1358 h->drv[drv_index].busy_configuring = 0;
@@ -1419,6 +1423,10 @@ geo_inq:
1419 blk_queue_hardsect_size(disk->queue, 1423 blk_queue_hardsect_size(disk->queue,
1420 hba[ctlr]->drv[drv_index].block_size); 1424 hba[ctlr]->drv[drv_index].block_size);
1421 1425
1426 /* Make sure all queue data is written out before */
1427 /* setting h->drv[drv_index].queue, as setting this */
1428 /* allows the interrupt handler to start the queue */
1429 wmb();
1422 h->drv[drv_index].queue = disk->queue; 1430 h->drv[drv_index].queue = disk->queue;
1423 add_disk(disk); 1431 add_disk(disk);
1424 } 1432 }
@@ -3520,10 +3528,17 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3520 continue; 3528 continue;
3521 blk_queue_hardsect_size(q, drv->block_size); 3529 blk_queue_hardsect_size(q, drv->block_size);
3522 set_capacity(disk, drv->nr_blocks); 3530 set_capacity(disk, drv->nr_blocks);
3523 add_disk(disk);
3524 j++; 3531 j++;
3525 } while (j <= hba[i]->highest_lun); 3532 } while (j <= hba[i]->highest_lun);
3526 3533
3534 /* Make sure all queue data is written out before */
3535 /* interrupt handler, triggered by add_disk, */
3536 /* is allowed to start them. */
3537 wmb();
3538
3539 for (j = 0; j <= hba[i]->highest_lun; j++)
3540 add_disk(hba[i]->gendisk[j]);
3541
3527 return 1; 3542 return 1;
3528 3543
3529 clean4: 3544 clean4:
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index 45ac09300eb3..e4bf9a11ca0d 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -1349,9 +1349,9 @@ cciss_unregister_scsi(int ctlr)
1349 /* set scsi_host to NULL so our detect routine will 1349 /* set scsi_host to NULL so our detect routine will
1350 find us on register */ 1350 find us on register */
1351 sa->scsi_host = NULL; 1351 sa->scsi_host = NULL;
1352 spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
1352 scsi_cmd_stack_free(ctlr); 1353 scsi_cmd_stack_free(ctlr);
1353 kfree(sa); 1354 kfree(sa);
1354 spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
1355} 1355}
1356 1356
1357static int 1357static int
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 91ebb007416c..f7f163557aa0 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -82,6 +82,9 @@
82static LIST_HEAD(loop_devices); 82static LIST_HEAD(loop_devices);
83static DEFINE_MUTEX(loop_devices_mutex); 83static DEFINE_MUTEX(loop_devices_mutex);
84 84
85static int max_part;
86static int part_shift;
87
85/* 88/*
86 * Transfer functions 89 * Transfer functions
87 */ 90 */
@@ -692,6 +695,8 @@ static int loop_change_fd(struct loop_device *lo, struct file *lo_file,
692 goto out_putf; 695 goto out_putf;
693 696
694 fput(old_file); 697 fput(old_file);
698 if (max_part > 0)
699 ioctl_by_bdev(bdev, BLKRRPART, 0);
695 return 0; 700 return 0;
696 701
697 out_putf: 702 out_putf:
@@ -819,6 +824,8 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
819 } 824 }
820 lo->lo_state = Lo_bound; 825 lo->lo_state = Lo_bound;
821 wake_up_process(lo->lo_thread); 826 wake_up_process(lo->lo_thread);
827 if (max_part > 0)
828 ioctl_by_bdev(bdev, BLKRRPART, 0);
822 return 0; 829 return 0;
823 830
824out_clr: 831out_clr:
@@ -919,6 +926,8 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev)
919 fput(filp); 926 fput(filp);
920 /* This is safe: open() is still holding a reference. */ 927 /* This is safe: open() is still holding a reference. */
921 module_put(THIS_MODULE); 928 module_put(THIS_MODULE);
929 if (max_part > 0)
930 ioctl_by_bdev(bdev, BLKRRPART, 0);
922 return 0; 931 return 0;
923} 932}
924 933
@@ -1360,6 +1369,8 @@ static struct block_device_operations lo_fops = {
1360static int max_loop; 1369static int max_loop;
1361module_param(max_loop, int, 0); 1370module_param(max_loop, int, 0);
1362MODULE_PARM_DESC(max_loop, "Maximum number of loop devices"); 1371MODULE_PARM_DESC(max_loop, "Maximum number of loop devices");
1372module_param(max_part, int, 0);
1373MODULE_PARM_DESC(max_part, "Maximum number of partitions per loop device");
1363MODULE_LICENSE("GPL"); 1374MODULE_LICENSE("GPL");
1364MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR); 1375MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR);
1365 1376
@@ -1412,7 +1423,7 @@ static struct loop_device *loop_alloc(int i)
1412 if (!lo->lo_queue) 1423 if (!lo->lo_queue)
1413 goto out_free_dev; 1424 goto out_free_dev;
1414 1425
1415 disk = lo->lo_disk = alloc_disk(1); 1426 disk = lo->lo_disk = alloc_disk(1 << part_shift);
1416 if (!disk) 1427 if (!disk)
1417 goto out_free_queue; 1428 goto out_free_queue;
1418 1429
@@ -1422,7 +1433,7 @@ static struct loop_device *loop_alloc(int i)
1422 init_waitqueue_head(&lo->lo_event); 1433 init_waitqueue_head(&lo->lo_event);
1423 spin_lock_init(&lo->lo_lock); 1434 spin_lock_init(&lo->lo_lock);
1424 disk->major = LOOP_MAJOR; 1435 disk->major = LOOP_MAJOR;
1425 disk->first_minor = i; 1436 disk->first_minor = i << part_shift;
1426 disk->fops = &lo_fops; 1437 disk->fops = &lo_fops;
1427 disk->private_data = lo; 1438 disk->private_data = lo;
1428 disk->queue = lo->lo_queue; 1439 disk->queue = lo->lo_queue;
@@ -1502,7 +1513,12 @@ static int __init loop_init(void)
1502 * themselves and have kernel automatically instantiate actual 1513 * themselves and have kernel automatically instantiate actual
1503 * device on-demand. 1514 * device on-demand.
1504 */ 1515 */
1505 if (max_loop > 1UL << MINORBITS) 1516
1517 part_shift = 0;
1518 if (max_part > 0)
1519 part_shift = fls(max_part);
1520
1521 if (max_loop > 1UL << (MINORBITS - part_shift))
1506 return -EINVAL; 1522 return -EINVAL;
1507 1523
1508 if (max_loop) { 1524 if (max_loop) {
@@ -1510,7 +1526,7 @@ static int __init loop_init(void)
1510 range = max_loop; 1526 range = max_loop;
1511 } else { 1527 } else {
1512 nr = 8; 1528 nr = 8;
1513 range = 1UL << MINORBITS; 1529 range = 1UL << (MINORBITS - part_shift);
1514 } 1530 }
1515 1531
1516 if (register_blkdev(LOOP_MAJOR, "loop")) 1532 if (register_blkdev(LOOP_MAJOR, "loop"))
@@ -1549,7 +1565,7 @@ static void __exit loop_exit(void)
1549 unsigned long range; 1565 unsigned long range;
1550 struct loop_device *lo, *next; 1566 struct loop_device *lo, *next;
1551 1567
1552 range = max_loop ? max_loop : 1UL << MINORBITS; 1568 range = max_loop ? max_loop : 1UL << (MINORBITS - part_shift);
1553 1569
1554 list_for_each_entry_safe(lo, next, &loop_devices, lo_list) 1570 list_for_each_entry_safe(lo, next, &loop_devices, lo_list)
1555 loop_del_one(lo); 1571 loop_del_one(lo);
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index cd5674b63faf..a18e1ca0f761 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -79,9 +79,9 @@ MODULE_PARM_DESC(max_queue, "Maximum number of queued commands. (min==1, max==30
79 79
80/* note: prints function name for you */ 80/* note: prints function name for you */
81#ifdef CARM_DEBUG 81#ifdef CARM_DEBUG
82#define DPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) 82#define DPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
83#ifdef CARM_VERBOSE_DEBUG 83#ifdef CARM_VERBOSE_DEBUG
84#define VPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) 84#define VPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
85#else 85#else
86#define VPRINTK(fmt, args...) 86#define VPRINTK(fmt, args...)
87#endif /* CARM_VERBOSE_DEBUG */ 87#endif /* CARM_VERBOSE_DEBUG */
@@ -96,7 +96,7 @@ MODULE_PARM_DESC(max_queue, "Maximum number of queued commands. (min==1, max==30
96#define assert(expr) \ 96#define assert(expr) \
97 if(unlikely(!(expr))) { \ 97 if(unlikely(!(expr))) { \
98 printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \ 98 printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \
99 #expr,__FILE__,__FUNCTION__,__LINE__); \ 99 #expr, __FILE__, __func__, __LINE__); \
100 } 100 }
101#endif 101#endif
102 102