Commit 54c10328 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] cciss

	* switched to private queue
	* set ->queue and ->private_data
	* switched to new methods
	* switched to use of ->rq_disk

NOTE: we still have mess in open(), release() and ioctl().
parent b9580dbf
...@@ -105,7 +105,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, ...@@ -105,7 +105,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
static int revalidate_allvol(kdev_t dev); static int revalidate_allvol(kdev_t dev);
static int cciss_revalidate(kdev_t dev); static int cciss_revalidate(struct gendisk *disk);
static int deregister_disk(int ctlr, int logvol); static int deregister_disk(int ctlr, int logvol);
static int register_new_disk(int cltr); static int register_new_disk(int cltr);
...@@ -125,11 +125,11 @@ static void cciss_procinit(int i) {} ...@@ -125,11 +125,11 @@ static void cciss_procinit(int i) {}
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
static struct block_device_operations cciss_fops = { static struct block_device_operations cciss_fops = {
owner: THIS_MODULE, .owner = THIS_MODULE,
open: cciss_open, .open = cciss_open,
release: cciss_release, .release = cciss_release,
ioctl: cciss_ioctl, .ioctl = cciss_ioctl,
revalidate: cciss_revalidate, .revalidate_disk= cciss_revalidate,
}; };
#include "cciss_scsi.c" /* For SCSI tape support */ #include "cciss_scsi.c" /* For SCSI tape support */
...@@ -699,12 +699,10 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, ...@@ -699,12 +699,10 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
} }
static int cciss_revalidate(kdev_t dev) static int cciss_revalidate(struct gendisk *disk)
{ {
int ctlr = major(dev) - MAJOR_NR; drive_info_struct *drv = disk->private_data;
int target = minor(dev) >> NWD_SHIFT; set_capacity(disk, drv->nr_blocks);
struct gendisk *disk = hba[ctlr]->gendisk[target];
set_capacity(disk, hba[ctlr]->drv[target].nr_blocks);
return 0; return 0;
} }
...@@ -765,7 +763,7 @@ static int revalidate_allvol(kdev_t dev) ...@@ -765,7 +763,7 @@ static int revalidate_allvol(kdev_t dev)
drive_info_struct *drv = &(hba[ctlr]->drv[i]); drive_info_struct *drv = &(hba[ctlr]->drv[i]);
if (!drv->nr_blocks) if (!drv->nr_blocks)
continue; continue;
(BLK_DEFAULT_QUEUE(MAJOR_NR + ctlr))->hardsect_size = drv->block_size; hba[ctlr]->queue.hardsect_size = drv->block_size;
set_capacity(disk, drv->nr_blocks); set_capacity(disk, drv->nr_blocks);
add_disk(disk); add_disk(disk);
} }
...@@ -1690,10 +1688,11 @@ static void do_cciss_request(request_queue_t *q) ...@@ -1690,10 +1688,11 @@ static void do_cciss_request(request_queue_t *q)
{ {
ctlr_info_t *h= q->queuedata; ctlr_info_t *h= q->queuedata;
CommandList_struct *c; CommandList_struct *c;
int log_unit, start_blk, seg; int start_blk, seg;
struct request *creq; struct request *creq;
u64bit temp64; u64bit temp64;
struct scatterlist tmp_sg[MAXSGENTRIES]; struct scatterlist tmp_sg[MAXSGENTRIES];
drive_info_struct *drv;
int i, dir; int i, dir;
if (blk_queue_plugged(q)) if (blk_queue_plugged(q))
...@@ -1707,16 +1706,6 @@ static void do_cciss_request(request_queue_t *q) ...@@ -1707,16 +1706,6 @@ static void do_cciss_request(request_queue_t *q)
if (creq->nr_phys_segments > MAXSGENTRIES) if (creq->nr_phys_segments > MAXSGENTRIES)
BUG(); BUG();
if (h->ctlr != major(creq->rq_dev)-MAJOR_NR )
{
printk(KERN_WARNING "doreq cmd for %d, %x at %p\n",
h->ctlr, major(creq->rq_dev), creq);
blkdev_dequeue_request(creq);
complete_buffers(creq->bio, 0);
end_that_request_last(creq);
goto startio;
}
if (( c = cmd_alloc(h, 1)) == NULL) if (( c = cmd_alloc(h, 1)) == NULL)
goto startio; goto startio;
...@@ -1728,10 +1717,10 @@ static void do_cciss_request(request_queue_t *q) ...@@ -1728,10 +1717,10 @@ static void do_cciss_request(request_queue_t *q)
c->rq = creq; c->rq = creq;
/* fill in the request */ /* fill in the request */
log_unit = minor(creq->rq_dev) >> NWD_SHIFT; drv = creq->rq_disk->private_data;
c->Header.ReplyQueue = 0; // unused in simple mode c->Header.ReplyQueue = 0; // unused in simple mode
c->Header.Tag.lower = c->busaddr; // use the physical address the cmd block for tag c->Header.Tag.lower = c->busaddr; // use the physical address the cmd block for tag
c->Header.LUN.LogDev.VolId= hba[h->ctlr]->drv[log_unit].LunID; c->Header.LUN.LogDev.VolId= drv->LunID;
c->Header.LUN.LogDev.Mode = 1; c->Header.LUN.LogDev.Mode = 1;
c->Request.CDBLen = 10; // 12 byte commands not in FW yet; c->Request.CDBLen = 10; // 12 byte commands not in FW yet;
c->Request.Type.Type = TYPE_CMD; // It is a command. c->Request.Type.Type = TYPE_CMD; // It is a command.
...@@ -1854,7 +1843,7 @@ static void do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1854,7 +1843,7 @@ static void do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs)
* See if we can queue up some more IO * See if we can queue up some more IO
*/ */
spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
blk_start_queue(BLK_DEFAULT_QUEUE(MAJOR_NR + h->ctlr)); blk_start_queue(&h->queue);
} }
/* /*
* We cannot read the structure directly, for portablity we must use * We cannot read the structure directly, for portablity we must use
...@@ -2425,7 +2414,7 @@ static int __init cciss_init_one(struct pci_dev *pdev, ...@@ -2425,7 +2414,7 @@ static int __init cciss_init_one(struct pci_dev *pdev,
cciss_procinit(i); cciss_procinit(i);
q = BLK_DEFAULT_QUEUE(MAJOR_NR + i); q = &hba[i]->queue;
q->queuedata = hba[i]; q->queuedata = hba[i];
spin_lock_init(&hba[i]->lock); spin_lock_init(&hba[i]->lock);
blk_init_queue(q, do_cciss_request, &hba[i]->lock); blk_init_queue(q, do_cciss_request, &hba[i]->lock);
...@@ -2447,9 +2436,12 @@ static int __init cciss_init_one(struct pci_dev *pdev, ...@@ -2447,9 +2436,12 @@ static int __init cciss_init_one(struct pci_dev *pdev,
sprintf(disk->disk_name, "cciss/c%dd%d", i, j); sprintf(disk->disk_name, "cciss/c%dd%d", i, j);
disk->major = MAJOR_NR + i; disk->major = MAJOR_NR + i;
disk->first_minor = j << NWD_SHIFT; disk->first_minor = j << NWD_SHIFT;
disk->fops = &cciss_fops;
disk->queue = &hba[i]->queue;
disk->private_data = drv;
if( !(drv->nr_blocks)) if( !(drv->nr_blocks))
continue; continue;
(BLK_DEFAULT_QUEUE(MAJOR_NR + i))->hardsect_size = drv->block_size; hba[i]->queue.hardsect_size = drv->block_size;
set_capacity(disk, drv->nr_blocks); set_capacity(disk, drv->nr_blocks);
add_disk(disk); add_disk(disk);
} }
......
...@@ -70,6 +70,7 @@ struct ctlr_info ...@@ -70,6 +70,7 @@ struct ctlr_info
unsigned int maxQsinceinit; unsigned int maxQsinceinit;
unsigned int maxSG; unsigned int maxSG;
spinlock_t lock; spinlock_t lock;
struct request_queue queue;
//* pointers to command and error info pool */ //* pointers to command and error info pool */
CommandList_struct *cmd_pool; CommandList_struct *cmd_pool;
...@@ -245,7 +246,7 @@ struct board_type { ...@@ -245,7 +246,7 @@ struct board_type {
struct access_method *access; struct access_method *access;
}; };
#define CCISS_LOCK(i) ((BLK_DEFAULT_QUEUE(MAJOR_NR + i))->queue_lock) #define CCISS_LOCK(i) (hba[i]->queue.queue_lock)
#endif /* CCISS_H */ #endif /* CCISS_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment