]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/s390/block/dasd.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux...
[linux-2.6-omap-h63xx.git] / drivers / s390 / block / dasd.c
index 1db15f3e5d20cc5e21fe4d144dd8840c08e5d009..ac6d4d3218b3d9c4d7652407c5847d87dc844fbb 100644 (file)
@@ -980,12 +980,12 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
                        break;
                case -ETIMEDOUT:
                        printk(KERN_WARNING"%s(%s): request timed out\n",
-                              __FUNCTION__, cdev->dev.bus_id);
+                              __func__, cdev->dev.bus_id);
                        //FIXME - dasd uses own timeout interface...
                        break;
                default:
                        printk(KERN_WARNING"%s(%s): unknown error %ld\n",
-                              __FUNCTION__, cdev->dev.bus_id, PTR_ERR(irb));
+                              __func__, cdev->dev.bus_id, PTR_ERR(irb));
                }
                return;
        }
@@ -1057,12 +1057,11 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
                if (device->features & DASD_FEATURE_ERPLOG) {
                        dasd_log_sense(cqr, irb);
                }
-               /* If we have no sense data, or we just don't want complex ERP
-                * for this request, but if we have retries left, then just
-                * reset this request and retry it in the fastpath
+               /*
+                * If we don't want complex ERP for this request, then just
+                * reset this and retry it in the fastpath
                 */
-               if (!(cqr->irb.esw.esw0.erw.cons &&
-                     test_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags)) &&
+               if (!test_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags) &&
                    cqr->retries > 0) {
                        DEV_MESSAGE(KERN_DEBUG, device,
                                    "default ERP in fastpath (%i retries left)",
@@ -1150,12 +1149,14 @@ static void __dasd_device_process_final_queue(struct dasd_device *device,
 {
        struct list_head *l, *n;
        struct dasd_ccw_req *cqr;
+       struct dasd_block *block;
 
        list_for_each_safe(l, n, final_queue) {
                cqr = list_entry(l, struct dasd_ccw_req, devlist);
                list_del_init(&cqr->devlist);
-               if (cqr->block)
-                       spin_lock_bh(&cqr->block->queue_lock);
+               block = cqr->block;
+               if (block)
+                       spin_lock_bh(&block->queue_lock);
                switch (cqr->status) {
                case DASD_CQR_SUCCESS:
                        cqr->status = DASD_CQR_DONE;
@@ -1173,15 +1174,13 @@ static void __dasd_device_process_final_queue(struct dasd_device *device,
                                    cqr, cqr->status);
                        BUG();
                }
-               if (cqr->block)
-                       spin_unlock_bh(&cqr->block->queue_lock);
                if (cqr->callback != NULL)
                        (cqr->callback)(cqr, cqr->callback_data);
+               if (block)
+                       spin_unlock_bh(&block->queue_lock);
        }
 }
 
-
-
 /*
  * Take a look at the first request on the ccw queue and check
  * if it reached its expire time. If so, terminate the IO.
@@ -1595,12 +1594,10 @@ void dasd_block_clear_timer(struct dasd_block *block)
 /*
  * posts the buffer_cache about a finalized request
  */
-static inline void dasd_end_request(struct request *req, int uptodate)
+static inline void dasd_end_request(struct request *req, int error)
 {
-       if (end_that_request_first(req, uptodate, req->hard_nr_sectors))
+       if (__blk_end_request(req, error, blk_rq_bytes(req)))
                BUG();
-       add_disk_randomness(req->rq_disk);
-       end_that_request_last(req, uptodate);
 }
 
 /*
@@ -1657,7 +1654,7 @@ static void __dasd_process_request_queue(struct dasd_block *block)
                                      "Rejecting write request %p",
                                      req);
                        blkdev_dequeue_request(req);
-                       dasd_end_request(req, 0);
+                       dasd_end_request(req, -EIO);
                        continue;
                }
                cqr = basedev->discipline->build_cp(basedev, block, req);
@@ -1686,7 +1683,7 @@ static void __dasd_process_request_queue(struct dasd_block *block)
                                      "on request %p",
                                      PTR_ERR(cqr), req);
                        blkdev_dequeue_request(req);
-                       dasd_end_request(req, 0);
+                       dasd_end_request(req, -EIO);
                        continue;
                }
                /*
@@ -1705,11 +1702,14 @@ static void __dasd_cleanup_cqr(struct dasd_ccw_req *cqr)
 {
        struct request *req;
        int status;
+       int error = 0;
 
        req = (struct request *) cqr->callback_data;
        dasd_profile_end(cqr->block, cqr, req);
-       status = cqr->memdev->discipline->free_cp(cqr, req);
-       dasd_end_request(req, status);
+       status = cqr->block->base->discipline->free_cp(cqr, req);
+       if (status <= 0)
+               error = status ? status : -EIO;
+       dasd_end_request(req, error);
 }
 
 /*
@@ -1741,12 +1741,8 @@ restart:
 
                /*  Process requests that may be recovered */
                if (cqr->status == DASD_CQR_NEED_ERP) {
-                       if (cqr->irb.esw.esw0.erw.cons &&
-                           test_bit(DASD_CQR_FLAGS_USE_ERP,
-                                    &cqr->flags)) {
-                               erp_fn = base->discipline->erp_action(cqr);
-                               erp_fn(cqr);
-                       }
+                       erp_fn = base->discipline->erp_action(cqr);
+                       erp_fn(cqr);
                        goto restart;
                }
 
@@ -1960,6 +1956,7 @@ static int dasd_alloc_queue(struct dasd_block *block)
        block->request_queue->queuedata = block;
 
        elevator_exit(block->request_queue->elevator);
+       block->request_queue->elevator = NULL;
        rc = elevator_init(block->request_queue, "deadline");
        if (rc) {
                blk_cleanup_queue(block->request_queue);
@@ -2009,7 +2006,7 @@ static void dasd_flush_request_queue(struct dasd_block *block)
        spin_lock_irq(&block->request_queue_lock);
        while ((req = elv_next_request(block->request_queue))) {
                blkdev_dequeue_request(req);
-               dasd_end_request(req, 0);
+               dasd_end_request(req, -EIO);
        }
        spin_unlock_irq(&block->request_queue_lock);
 }
@@ -2302,9 +2299,8 @@ int dasd_generic_set_offline(struct ccw_device *cdev)
         * in the other openers.
         */
        if (device->block) {
-               struct dasd_block *block = device->block;
-               max_count = block->bdev ? 0 : -1;
-               open_count = (int) atomic_read(&block->open_count);
+               max_count = device->block->bdev ? 0 : -1;
+               open_count = atomic_read(&device->block->open_count);
                if (open_count > max_count) {
                        if (open_count > 0)
                                printk(KERN_WARNING "Can't offline dasd "