aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/block/dasd.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-06-15 06:02:23 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-15 06:02:23 -0400
commit9cbc1cb8cd46ce1f7645b9de249b2ce8460129bb (patch)
tree8d104ec2a459346b99413b0b77421ca7b9936c1a /drivers/s390/block/dasd.c
parentca44d6e60f9de26281fda203f58b570e1748c015 (diff)
parent45e3e1935e2857c54783291107d33323b3ef33c8 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: Documentation/feature-removal-schedule.txt drivers/scsi/fcoe/fcoe.c net/core/drop_monitor.c net/core/net-traces.c
Diffstat (limited to 'drivers/s390/block/dasd.c')
-rw-r--r--drivers/s390/block/dasd.c71
1 files changed, 37 insertions, 34 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index d1815272c435..442bb98a2821 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -603,7 +603,7 @@ static void dasd_profile_end(struct dasd_block *block,
603 if (dasd_profile_level != DASD_PROFILE_ON) 603 if (dasd_profile_level != DASD_PROFILE_ON)
604 return; 604 return;
605 605
606 sectors = req->nr_sectors; 606 sectors = blk_rq_sectors(req);
607 if (!cqr->buildclk || !cqr->startclk || 607 if (!cqr->buildclk || !cqr->startclk ||
608 !cqr->stopclk || !cqr->endclk || 608 !cqr->stopclk || !cqr->endclk ||
609 !sectors) 609 !sectors)
@@ -851,8 +851,10 @@ int dasd_start_IO(struct dasd_ccw_req *cqr)
851 851
852 /* Check the cqr */ 852 /* Check the cqr */
853 rc = dasd_check_cqr(cqr); 853 rc = dasd_check_cqr(cqr);
854 if (rc) 854 if (rc) {
855 cqr->intrc = rc;
855 return rc; 856 return rc;
857 }
856 device = (struct dasd_device *) cqr->startdev; 858 device = (struct dasd_device *) cqr->startdev;
857 if (cqr->retries < 0) { 859 if (cqr->retries < 0) {
858 /* internal error 14 - start_IO run out of retries */ 860 /* internal error 14 - start_IO run out of retries */
@@ -915,6 +917,7 @@ int dasd_start_IO(struct dasd_ccw_req *cqr)
915 BUG(); 917 BUG();
916 break; 918 break;
917 } 919 }
920 cqr->intrc = rc;
918 return rc; 921 return rc;
919} 922}
920 923
@@ -1454,8 +1457,12 @@ int dasd_sleep_on(struct dasd_ccw_req *cqr)
1454 dasd_add_request_tail(cqr); 1457 dasd_add_request_tail(cqr);
1455 wait_event(generic_waitq, _wait_for_wakeup(cqr)); 1458 wait_event(generic_waitq, _wait_for_wakeup(cqr));
1456 1459
1457 /* Request status is either done or failed. */ 1460 if (cqr->status == DASD_CQR_DONE)
1458 rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; 1461 rc = 0;
1462 else if (cqr->intrc)
1463 rc = cqr->intrc;
1464 else
1465 rc = -EIO;
1459 return rc; 1466 return rc;
1460} 1467}
1461 1468
@@ -1477,8 +1484,15 @@ int dasd_sleep_on_interruptible(struct dasd_ccw_req *cqr)
1477 dasd_cancel_req(cqr); 1484 dasd_cancel_req(cqr);
1478 /* wait (non-interruptible) for final status */ 1485 /* wait (non-interruptible) for final status */
1479 wait_event(generic_waitq, _wait_for_wakeup(cqr)); 1486 wait_event(generic_waitq, _wait_for_wakeup(cqr));
1487 cqr->intrc = rc;
1480 } 1488 }
1481 rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; 1489
1490 if (cqr->status == DASD_CQR_DONE)
1491 rc = 0;
1492 else if (cqr->intrc)
1493 rc = cqr->intrc;
1494 else
1495 rc = -EIO;
1482 return rc; 1496 return rc;
1483} 1497}
1484 1498
@@ -1523,8 +1537,12 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
1523 1537
1524 wait_event(generic_waitq, _wait_for_wakeup(cqr)); 1538 wait_event(generic_waitq, _wait_for_wakeup(cqr));
1525 1539
1526 /* Request status is either done or failed. */ 1540 if (cqr->status == DASD_CQR_DONE)
1527 rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; 1541 rc = 0;
1542 else if (cqr->intrc)
1543 rc = cqr->intrc;
1544 else
1545 rc = -EIO;
1528 return rc; 1546 return rc;
1529} 1547}
1530 1548
@@ -1614,15 +1632,6 @@ void dasd_block_clear_timer(struct dasd_block *block)
1614} 1632}
1615 1633
1616/* 1634/*
1617 * posts the buffer_cache about a finalized request
1618 */
1619static inline void dasd_end_request(struct request *req, int error)
1620{
1621 if (__blk_end_request(req, error, blk_rq_bytes(req)))
1622 BUG();
1623}
1624
1625/*
1626 * Process finished error recovery ccw. 1635 * Process finished error recovery ccw.
1627 */ 1636 */
1628static inline void __dasd_block_process_erp(struct dasd_block *block, 1637static inline void __dasd_block_process_erp(struct dasd_block *block,
@@ -1665,18 +1674,14 @@ static void __dasd_process_request_queue(struct dasd_block *block)
1665 if (basedev->state < DASD_STATE_READY) 1674 if (basedev->state < DASD_STATE_READY)
1666 return; 1675 return;
1667 /* Now we try to fetch requests from the request queue */ 1676 /* Now we try to fetch requests from the request queue */
1668 while (!blk_queue_plugged(queue) && 1677 while (!blk_queue_plugged(queue) && (req = blk_peek_request(queue))) {
1669 elv_next_request(queue)) {
1670
1671 req = elv_next_request(queue);
1672
1673 if (basedev->features & DASD_FEATURE_READONLY && 1678 if (basedev->features & DASD_FEATURE_READONLY &&
1674 rq_data_dir(req) == WRITE) { 1679 rq_data_dir(req) == WRITE) {
1675 DBF_DEV_EVENT(DBF_ERR, basedev, 1680 DBF_DEV_EVENT(DBF_ERR, basedev,
1676 "Rejecting write request %p", 1681 "Rejecting write request %p",
1677 req); 1682 req);
1678 blkdev_dequeue_request(req); 1683 blk_start_request(req);
1679 dasd_end_request(req, -EIO); 1684 __blk_end_request_all(req, -EIO);
1680 continue; 1685 continue;
1681 } 1686 }
1682 cqr = basedev->discipline->build_cp(basedev, block, req); 1687 cqr = basedev->discipline->build_cp(basedev, block, req);
@@ -1704,8 +1709,8 @@ static void __dasd_process_request_queue(struct dasd_block *block)
1704 "CCW creation failed (rc=%ld) " 1709 "CCW creation failed (rc=%ld) "
1705 "on request %p", 1710 "on request %p",
1706 PTR_ERR(cqr), req); 1711 PTR_ERR(cqr), req);
1707 blkdev_dequeue_request(req); 1712 blk_start_request(req);
1708 dasd_end_request(req, -EIO); 1713 __blk_end_request_all(req, -EIO);
1709 continue; 1714 continue;
1710 } 1715 }
1711 /* 1716 /*
@@ -1714,7 +1719,7 @@ static void __dasd_process_request_queue(struct dasd_block *block)
1714 */ 1719 */
1715 cqr->callback_data = (void *) req; 1720 cqr->callback_data = (void *) req;
1716 cqr->status = DASD_CQR_FILLED; 1721 cqr->status = DASD_CQR_FILLED;
1717 blkdev_dequeue_request(req); 1722 blk_start_request(req);
1718 list_add_tail(&cqr->blocklist, &block->ccw_queue); 1723 list_add_tail(&cqr->blocklist, &block->ccw_queue);
1719 dasd_profile_start(block, cqr, req); 1724 dasd_profile_start(block, cqr, req);
1720 } 1725 }
@@ -1731,7 +1736,7 @@ static void __dasd_cleanup_cqr(struct dasd_ccw_req *cqr)
1731 status = cqr->block->base->discipline->free_cp(cqr, req); 1736 status = cqr->block->base->discipline->free_cp(cqr, req);
1732 if (status <= 0) 1737 if (status <= 0)
1733 error = status ? status : -EIO; 1738 error = status ? status : -EIO;
1734 dasd_end_request(req, error); 1739 __blk_end_request_all(req, error);
1735} 1740}
1736 1741
1737/* 1742/*
@@ -2003,7 +2008,7 @@ static void dasd_setup_queue(struct dasd_block *block)
2003{ 2008{
2004 int max; 2009 int max;
2005 2010
2006 blk_queue_hardsect_size(block->request_queue, block->bp_block); 2011 blk_queue_logical_block_size(block->request_queue, block->bp_block);
2007 max = block->base->discipline->max_blocks << block->s2b_shift; 2012 max = block->base->discipline->max_blocks << block->s2b_shift;
2008 blk_queue_max_sectors(block->request_queue, max); 2013 blk_queue_max_sectors(block->request_queue, max);
2009 blk_queue_max_phys_segments(block->request_queue, -1L); 2014 blk_queue_max_phys_segments(block->request_queue, -1L);
@@ -2038,10 +2043,8 @@ static void dasd_flush_request_queue(struct dasd_block *block)
2038 return; 2043 return;
2039 2044
2040 spin_lock_irq(&block->request_queue_lock); 2045 spin_lock_irq(&block->request_queue_lock);
2041 while ((req = elv_next_request(block->request_queue))) { 2046 while ((req = blk_fetch_request(block->request_queue)))
2042 blkdev_dequeue_request(req); 2047 __blk_end_request_all(req, -EIO);
2043 dasd_end_request(req, -EIO);
2044 }
2045 spin_unlock_irq(&block->request_queue_lock); 2048 spin_unlock_irq(&block->request_queue_lock);
2046} 2049}
2047 2050
@@ -2442,12 +2445,12 @@ static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device,
2442 2445
2443 2446
2444int dasd_generic_read_dev_chars(struct dasd_device *device, char *magic, 2447int dasd_generic_read_dev_chars(struct dasd_device *device, char *magic,
2445 void **rdc_buffer, int rdc_buffer_size) 2448 void *rdc_buffer, int rdc_buffer_size)
2446{ 2449{
2447 int ret; 2450 int ret;
2448 struct dasd_ccw_req *cqr; 2451 struct dasd_ccw_req *cqr;
2449 2452
2450 cqr = dasd_generic_build_rdc(device, *rdc_buffer, rdc_buffer_size, 2453 cqr = dasd_generic_build_rdc(device, rdc_buffer, rdc_buffer_size,
2451 magic); 2454 magic);
2452 if (IS_ERR(cqr)) 2455 if (IS_ERR(cqr))
2453 return PTR_ERR(cqr); 2456 return PTR_ERR(cqr);