From 2e759cd4fa60c6df4cb117848274f444c2c0a12d Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Sun, 24 Apr 2005 02:04:21 -0500 Subject: [SCSI] make blk layer set REQ_SOFTBARRIER on defer and requeue This is the reworked version of the patch. It sets REQ_SOFTBARRIER in two places - in elv_next_request() on BLKPREP_DEFER and in blk_requeue_request(). Signed-off-by: Tejun Heo Signed-off-by: James Bottomley --- drivers/block/elevator.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'drivers/block') diff --git a/drivers/block/elevator.c b/drivers/block/elevator.c index 6b79b43..8c51d1c 100644 --- a/drivers/block/elevator.c +++ b/drivers/block/elevator.c @@ -291,6 +291,13 @@ void elv_requeue_request(request_queue_t *q, struct request *rq) } /* + * the request is prepped and may have some resources allocated. + * allowing unprepped requests to pass this one may cause resource + * deadlock. turn on softbarrier. + */ + rq->flags |= REQ_SOFTBARRIER; + + /* * if iosched has an explicit requeue hook, then use that. otherwise * just put the request at the front of the queue */ @@ -386,6 +393,12 @@ struct request *elv_next_request(request_queue_t *q) if (ret == BLKPREP_OK) { break; } else if (ret == BLKPREP_DEFER) { + /* + * the request may have been (partially) prepped. + * we need to keep this request in the front to + * avoid resource deadlock. turn on softbarrier. + */ + rq->flags |= REQ_SOFTBARRIER; rq = NULL; break; } else if (ret == BLKPREP_KILL) { -- cgit v1.1 From 867d1191fca388a79e4bb500dd85a9e871c96b99 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Sun, 24 Apr 2005 02:06:05 -0500 Subject: [SCSI] remove requeue feature from blk_insert_request() blk_insert_request() has a unobivous feature of requeuing a request setting REQ_SPECIAL|REQ_SOFTBARRIER. SCSI midlayer was the only user and as previous patches removed the usage, remove the feature from blk_insert_request(). Only special requests should be queued with blk_insert_request(). All requeueing should go through blk_requeue_request(). Signed-off-by: Tejun Heo Signed-off-by: James Bottomley --- drivers/block/ll_rw_blk.c | 20 ++++++-------------- drivers/block/paride/pd.c | 2 +- drivers/block/sx8.c | 4 ++-- 3 files changed, 9 insertions(+), 17 deletions(-) (limited to 'drivers/block') diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 11ef9d9..f20eba2 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -2038,7 +2038,6 @@ EXPORT_SYMBOL(blk_requeue_request); * @rq: request to be inserted * @at_head: insert request at head or tail of queue * @data: private data - * @reinsert: true if request it a reinsertion of previously processed one * * Description: * Many block devices need to execute commands asynchronously, so they don't @@ -2053,8 +2052,9 @@ EXPORT_SYMBOL(blk_requeue_request); * host that is unable to accept a particular command. */ void blk_insert_request(request_queue_t *q, struct request *rq, - int at_head, void *data, int reinsert) + int at_head, void *data) { + int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK; unsigned long flags; /* @@ -2071,20 +2071,12 @@ void blk_insert_request(request_queue_t *q, struct request *rq, /* * If command is tagged, release the tag */ - if (reinsert) - blk_requeue_request(q, rq); - else { - int where = ELEVATOR_INSERT_BACK; - - if (at_head) - where = ELEVATOR_INSERT_FRONT; + if (blk_rq_tagged(rq)) + blk_queue_end_tag(q, rq); - if (blk_rq_tagged(rq)) - blk_queue_end_tag(q, rq); + drive_stat_acct(rq, rq->nr_sectors, 1); + __elv_add_request(q, rq, where, 0); - drive_stat_acct(rq, rq->nr_sectors, 1); - __elv_add_request(q, rq, where, 0); - } if (blk_queue_plugged(q)) __generic_unplug_device(q); else diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index 202a5a7..fa49d62 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c @@ -723,7 +723,7 @@ static int pd_special_command(struct pd_unit *disk, rq.ref_count = 1; rq.waiting = &wait; rq.end_io = blk_end_sync_rq; - blk_insert_request(disk->gd->queue, &rq, 0, func, 0); + blk_insert_request(disk->gd->queue, &rq, 0, func); wait_for_completion(&wait); rq.waiting = NULL; if (rq.errors) diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c index 797f598..5ed3a63 100644 --- a/drivers/block/sx8.c +++ b/drivers/block/sx8.c @@ -614,7 +614,7 @@ static int carm_array_info (struct carm_host *host, unsigned int array_idx) spin_unlock_irq(&host->lock); DPRINTK("blk_insert_request, tag == %u\n", idx); - blk_insert_request(host->oob_q, crq->rq, 1, crq, 0); + blk_insert_request(host->oob_q, crq->rq, 1, crq); return 0; @@ -653,7 +653,7 @@ static int carm_send_special (struct carm_host *host, carm_sspc_t func) crq->msg_bucket = (u32) rc; DPRINTK("blk_insert_request, tag == %u\n", idx); - blk_insert_request(host->oob_q, crq->rq, 1, crq, 0); + blk_insert_request(host->oob_q, crq->rq, 1, crq); return 0; } -- cgit v1.1 From eb0df9962d97f7156a0870aced9018bf5c8f54c1 Mon Sep 17 00:00:00 2001 From: "mike.miller@hp.com" Date: Fri, 10 Jun 2005 14:51:04 -0500 Subject: [SCSI] cciss 2.6 DMA mapping Patch removes our homegrown DMA masks and uses the ones defined in the kernel. This patch replaces the broken one I sent in earlier. It has been tested and works. Please discard the first submission. Signed-off-by: Mike Miller Signed-off-by: James Bottomley --- drivers/block/cciss.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'drivers/block') diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 8f7c1a1..abde270 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -126,8 +127,6 @@ static struct board_type products[] = { #define MAX_CTLR_ORIG 8 -#define CCISS_DMA_MASK 0xFFFFFFFF /* 32 bit DMA */ - static ctlr_info_t *hba[MAX_CTLR]; static void do_cciss_request(request_queue_t *q); @@ -2393,11 +2392,6 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) printk(KERN_ERR "cciss: Unable to Enable PCI device\n"); return( -1); } - if (pci_set_dma_mask(pdev, CCISS_DMA_MASK ) != 0) - { - printk(KERN_ERR "cciss: Unable to set DMA mask\n"); - return(-1); - } subsystem_vendor_id = pdev->subsystem_vendor; subsystem_device_id = pdev->subsystem_device; @@ -2747,9 +2741,9 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, hba[i]->pdev = pdev; /* configure PCI DMA stuff */ - if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL)) + if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) printk("cciss: using DAC cycles\n"); - else if (!pci_set_dma_mask(pdev, 0xffffffff)) + else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK)) printk("cciss: not using DAC cycles\n"); else { printk("cciss: no suitable DMA available\n"); -- cgit v1.1