From: Albert H. <he...@us...> - 2009-10-25 18:59:37
|
Update of /cvsroot/gc-linux/linux/drivers/block/gcn-di In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv751/drivers/block/gcn-di Modified Files: gcn-di.c Log Message: Merge gc-linux-v2.6.31. Index: gcn-di.c =================================================================== RCS file: /cvsroot/gc-linux/linux/drivers/block/gcn-di/gcn-di.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** gcn-di.c 1 Feb 2009 18:29:35 -0000 1.25 --- gcn-di.c 25 Oct 2009 18:59:28 -0000 1.26 *************** *** 1822,1834 **** spin_lock_irqsave(&ddev->lock, flags); - req = ddev->req; ddev->req = NULL; - spin_unlock_irqrestore(&ddev->lock, flags); if (req) { - __blk_end_request(req, error, req->current_nr_sectors << 9); spin_lock_irqsave(&ddev->queue_lock, flags); blk_start_queue(ddev->queue); spin_unlock_irqrestore(&ddev->queue_lock, flags); --- 1822,1832 ---- spin_lock_irqsave(&ddev->lock, flags); req = ddev->req; ddev->req = NULL; spin_unlock_irqrestore(&ddev->lock, flags); if (req) { spin_lock_irqsave(&ddev->queue_lock, flags); + __blk_end_request_cur(req, error); blk_start_queue(ddev->queue); spin_unlock_irqrestore(&ddev->queue_lock, flags); *************** *** 1844,1861 **** unsigned long flags; size_t len; ! while ((req = elv_next_request(q))) { ! /* keep our reads within limits */ ! if (req->sector + req->current_nr_sectors > ddev->nr_sectors) { ! drv_printk(KERN_ERR, "reading past end\n"); ! end_request(req, 0); ! continue; } /* it doesn't make sense to write to this device */ if (rq_data_dir(req) == WRITE) { drv_printk(KERN_ERR, "write attempted\n"); ! end_request(req, 0); ! continue; } --- 1842,1869 ---- unsigned long flags; size_t len; + int error; ! req = blk_peek_request(q); ! while (req) { ! spin_lock_irqsave(&ddev->lock, flags); ! ! if (ddev->req || ddev->cmd) { ! blk_stop_queue(q); ! if (ddev->cmd) ! set_bit(__DI_START_QUEUE, &ddev->flags); ! spin_unlock_irqrestore(&ddev->lock, flags); ! break; } + blk_start_request(req); + error = -EIO; + + if (!blk_fs_request(req)) + goto done; + /* it doesn't make sense to write to this device */ if (rq_data_dir(req) == WRITE) { drv_printk(KERN_ERR, "write attempted\n"); ! goto done; } *************** *** 1863,1898 **** if ((ddev->flags & DI_MEDIA_CHANGED)) { drv_printk(KERN_ERR, "media changed, aborting\n"); ! end_request(req, 0); ! continue; ! } ! ! spin_lock_irqsave(&ddev->lock, flags); ! ! /* we can schedule just a single request each time */ ! if (ddev->req || ddev->cmd) { ! blk_stop_queue(q); ! if (ddev->cmd) ! set_bit(__DI_START_QUEUE, &ddev->flags); ! spin_unlock_irqrestore(&ddev->lock, flags); ! break; } ! blkdev_dequeue_request(req); ! ! /* ignore requests that we can't handle */ ! if (!blk_fs_request(req)) { ! spin_unlock_irqrestore(&ddev->lock, flags); ! continue; } - /* store the request being handled ... */ ddev->req = req; - blk_stop_queue(q); - spin_unlock_irqrestore(&ddev->lock, flags); ! /* ... and launch the corresponding read sector command */ ! start = req->sector << KERNEL_SECTOR_SHIFT; ! len = req->current_nr_sectors << KERNEL_SECTOR_SHIFT; di_op_readsector(cmd, ddev, start >> 2, --- 1871,1890 ---- if ((ddev->flags & DI_MEDIA_CHANGED)) { drv_printk(KERN_ERR, "media changed, aborting\n"); ! goto done; } ! /* keep our reads within limits */ ! if (blk_rq_pos(req) + ! blk_rq_cur_sectors(req) > ddev->nr_sectors) { ! drv_printk(KERN_ERR, "reading past end\n"); ! goto done; } ddev->req = req; spin_unlock_irqrestore(&ddev->lock, flags); ! /* launch the corresponding read sector command */ ! start = blk_rq_pos(req) << KERNEL_SECTOR_SHIFT; ! len = blk_rq_cur_bytes(req); di_op_readsector(cmd, ddev, start >> 2, *************** *** 1901,1904 **** --- 1893,1902 ---- cmd->done = di_request_done; di_run_command(cmd); + error = 0; + break; + done: + spin_unlock_irqrestore(&ddev->lock, flags); + if (!__blk_end_request_cur(req, error)) + req = blk_peek_request(q); } } *************** *** 2152,2156 **** } ! blk_queue_hardsect_size(queue, DI_SECTOR_SIZE); blk_queue_dma_alignment(queue, DI_DMA_ALIGN); blk_queue_max_phys_segments(queue, 1); --- 2150,2154 ---- } ! blk_queue_logical_block_size(queue, DI_SECTOR_SIZE); blk_queue_dma_alignment(queue, DI_DMA_ALIGN); blk_queue_max_phys_segments(queue, 1); |