diff options
author | Mike Miller <mike.miller@hp.com> | 2005-07-28 04:07:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-28 11:39:01 -0400 |
commit | ad2b93123d2b3cb4ba9a98dd5f62acb6d6b50391 (patch) | |
tree | 250d0f5157c98c1cc650a08bcad3f9f5a6f3ee17 /drivers/block/cciss.c | |
parent | eaaf9c68e75edf0fa51c5770eb68c2a6cb5ff66b (diff) |
[PATCH] cciss per disk queue
This patch adds per disk queue functionality to cciss. Sometime back I
submitted a patch but it looks like only part of what I needed. In the 2.6
kernel if we have more than one logical volume the driver will Oops during
rmmod. It seems all of the queues actually point back to the same queue.
So after deleting the first volume you hit a null pointer on the second
one.
This has been tested in our labs. There is no difference in performance,
it just fixes the Oops.
Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r-- | drivers/block/cciss.c | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 3e9fb6e4a52a..418b1469d75d 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -1135,7 +1135,7 @@ static int revalidate_allvol(ctlr_info_t *host) | |||
1135 | /* this is for the online array utilities */ | 1135 | /* this is for the online array utilities */ |
1136 | if (!drv->heads && i) | 1136 | if (!drv->heads && i) |
1137 | continue; | 1137 | continue; |
1138 | blk_queue_hardsect_size(host->queue, drv->block_size); | 1138 | blk_queue_hardsect_size(drv->queue, drv->block_size); |
1139 | set_capacity(disk, drv->nr_blocks); | 1139 | set_capacity(disk, drv->nr_blocks); |
1140 | add_disk(disk); | 1140 | add_disk(disk); |
1141 | } | 1141 | } |
@@ -1691,7 +1691,7 @@ static int cciss_revalidate(struct gendisk *disk) | |||
1691 | cciss_read_capacity(h->ctlr, logvol, size_buff, 1, &total_size, &block_size); | 1691 | cciss_read_capacity(h->ctlr, logvol, size_buff, 1, &total_size, &block_size); |
1692 | cciss_geometry_inquiry(h->ctlr, logvol, 1, total_size, block_size, inq_buff, drv); | 1692 | cciss_geometry_inquiry(h->ctlr, logvol, 1, total_size, block_size, inq_buff, drv); |
1693 | 1693 | ||
1694 | blk_queue_hardsect_size(h->queue, drv->block_size); | 1694 | blk_queue_hardsect_size(drv->queue, drv->block_size); |
1695 | set_capacity(disk, drv->nr_blocks); | 1695 | set_capacity(disk, drv->nr_blocks); |
1696 | 1696 | ||
1697 | kfree(size_buff); | 1697 | kfree(size_buff); |
@@ -2248,12 +2248,12 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
2248 | * them up. We will also keep track of the next queue to run so | 2248 | * them up. We will also keep track of the next queue to run so |
2249 | * that every queue gets a chance to be started first. | 2249 | * that every queue gets a chance to be started first. |
2250 | */ | 2250 | */ |
2251 | for (j=0; j < NWD; j++){ | 2251 | for (j=0; j < h->highest_lun + 1; j++){ |
2252 | int curr_queue = (start_queue + j) % NWD; | 2252 | int curr_queue = (start_queue + j) % (h->highest_lun + 1); |
2253 | /* make sure the disk has been added and the drive is real | 2253 | /* make sure the disk has been added and the drive is real |
2254 | * because this can be called from the middle of init_one. | 2254 | * because this can be called from the middle of init_one. |
2255 | */ | 2255 | */ |
2256 | if(!(h->gendisk[curr_queue]->queue) || | 2256 | if(!(h->drv[curr_queue].queue) || |
2257 | !(h->drv[curr_queue].heads)) | 2257 | !(h->drv[curr_queue].heads)) |
2258 | continue; | 2258 | continue; |
2259 | blk_start_queue(h->gendisk[curr_queue]->queue); | 2259 | blk_start_queue(h->gendisk[curr_queue]->queue); |
@@ -2264,14 +2264,14 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
2264 | if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) | 2264 | if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) |
2265 | { | 2265 | { |
2266 | if (curr_queue == start_queue){ | 2266 | if (curr_queue == start_queue){ |
2267 | h->next_to_run = (start_queue + 1) % NWD; | 2267 | h->next_to_run = (start_queue + 1) % (h->highest_lun + 1); |
2268 | goto cleanup; | 2268 | goto cleanup; |
2269 | } else { | 2269 | } else { |
2270 | h->next_to_run = curr_queue; | 2270 | h->next_to_run = curr_queue; |
2271 | goto cleanup; | 2271 | goto cleanup; |
2272 | } | 2272 | } |
2273 | } else { | 2273 | } else { |
2274 | curr_queue = (curr_queue + 1) % NWD; | 2274 | curr_queue = (curr_queue + 1) % (h->highest_lun + 1); |
2275 | } | 2275 | } |
2276 | } | 2276 | } |
2277 | 2277 | ||
@@ -2279,7 +2279,6 @@ cleanup: | |||
2279 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); | 2279 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); |
2280 | return IRQ_HANDLED; | 2280 | return IRQ_HANDLED; |
2281 | } | 2281 | } |
2282 | |||
2283 | /* | 2282 | /* |
2284 | * We cannot read the structure directly, for portablity we must use | 2283 | * We cannot read the structure directly, for portablity we must use |
2285 | * the io functions. | 2284 | * the io functions. |
@@ -2789,13 +2788,6 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
2789 | } | 2788 | } |
2790 | 2789 | ||
2791 | spin_lock_init(&hba[i]->lock); | 2790 | spin_lock_init(&hba[i]->lock); |
2792 | q = blk_init_queue(do_cciss_request, &hba[i]->lock); | ||
2793 | if (!q) | ||
2794 | goto clean4; | ||
2795 | |||
2796 | q->backing_dev_info.ra_pages = READ_AHEAD; | ||
2797 | hba[i]->queue = q; | ||
2798 | q->queuedata = hba[i]; | ||
2799 | 2791 | ||
2800 | /* Initialize the pdev driver private data. | 2792 | /* Initialize the pdev driver private data. |
2801 | have it point to hba[i]. */ | 2793 | have it point to hba[i]. */ |
@@ -2817,6 +2809,20 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
2817 | 2809 | ||
2818 | cciss_procinit(i); | 2810 | cciss_procinit(i); |
2819 | 2811 | ||
2812 | for(j=0; j < NWD; j++) { /* mfm */ | ||
2813 | drive_info_struct *drv = &(hba[i]->drv[j]); | ||
2814 | struct gendisk *disk = hba[i]->gendisk[j]; | ||
2815 | |||
2816 | q = blk_init_queue(do_cciss_request, &hba[i]->lock); | ||
2817 | if (!q) { | ||
2818 | printk(KERN_ERR | ||
2819 | "cciss: unable to allocate queue for disk %d\n", | ||
2820 | j); | ||
2821 | break; | ||
2822 | } | ||
2823 | drv->queue = q; | ||
2824 | |||
2825 | q->backing_dev_info.ra_pages = READ_AHEAD; | ||
2820 | blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask); | 2826 | blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask); |
2821 | 2827 | ||
2822 | /* This is a hardware imposed limit. */ | 2828 | /* This is a hardware imposed limit. */ |
@@ -2827,26 +2833,23 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
2827 | 2833 | ||
2828 | blk_queue_max_sectors(q, 512); | 2834 | blk_queue_max_sectors(q, 512); |
2829 | 2835 | ||
2830 | 2836 | q->queuedata = hba[i]; | |
2831 | for(j=0; j<NWD; j++) { | ||
2832 | drive_info_struct *drv = &(hba[i]->drv[j]); | ||
2833 | struct gendisk *disk = hba[i]->gendisk[j]; | ||
2834 | |||
2835 | sprintf(disk->disk_name, "cciss/c%dd%d", i, j); | 2837 | sprintf(disk->disk_name, "cciss/c%dd%d", i, j); |
2836 | sprintf(disk->devfs_name, "cciss/host%d/target%d", i, j); | 2838 | sprintf(disk->devfs_name, "cciss/host%d/target%d", i, j); |
2837 | disk->major = hba[i]->major; | 2839 | disk->major = hba[i]->major; |
2838 | disk->first_minor = j << NWD_SHIFT; | 2840 | disk->first_minor = j << NWD_SHIFT; |
2839 | disk->fops = &cciss_fops; | 2841 | disk->fops = &cciss_fops; |
2840 | disk->queue = hba[i]->queue; | 2842 | disk->queue = q; |
2841 | disk->private_data = drv; | 2843 | disk->private_data = drv; |
2842 | /* we must register the controller even if no disks exist */ | 2844 | /* we must register the controller even if no disks exist */ |
2843 | /* this is for the online array utilities */ | 2845 | /* this is for the online array utilities */ |
2844 | if(!drv->heads && j) | 2846 | if(!drv->heads && j) |
2845 | continue; | 2847 | continue; |
2846 | blk_queue_hardsect_size(hba[i]->queue, drv->block_size); | 2848 | blk_queue_hardsect_size(q, drv->block_size); |
2847 | set_capacity(disk, drv->nr_blocks); | 2849 | set_capacity(disk, drv->nr_blocks); |
2848 | add_disk(disk); | 2850 | add_disk(disk); |
2849 | } | 2851 | } |
2852 | |||
2850 | return(1); | 2853 | return(1); |
2851 | 2854 | ||
2852 | clean4: | 2855 | clean4: |
@@ -2912,10 +2915,10 @@ static void __devexit cciss_remove_one (struct pci_dev *pdev) | |||
2912 | for (j = 0; j < NWD; j++) { | 2915 | for (j = 0; j < NWD; j++) { |
2913 | struct gendisk *disk = hba[i]->gendisk[j]; | 2916 | struct gendisk *disk = hba[i]->gendisk[j]; |
2914 | if (disk->flags & GENHD_FL_UP) | 2917 | if (disk->flags & GENHD_FL_UP) |
2918 | blk_cleanup_queue(disk->queue); | ||
2915 | del_gendisk(disk); | 2919 | del_gendisk(disk); |
2916 | } | 2920 | } |
2917 | 2921 | ||
2918 | blk_cleanup_queue(hba[i]->queue); | ||
2919 | pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(CommandList_struct), | 2922 | pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(CommandList_struct), |
2920 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); | 2923 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); |
2921 | pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof( ErrorInfo_struct), | 2924 | pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof( ErrorInfo_struct), |