md: merge reconfig and check_reshape methods.
[safe/jmp/linux-2.6] / drivers / block / ps3disk.c
index d797e20..aaeeb54 100644 (file)
@@ -134,14 +134,13 @@ static int ps3disk_submit_request_sg(struct ps3_storage_device *dev,
        rq_for_each_segment(bv, req, iter)
                n++;
        dev_dbg(&dev->sbd.core,
-               "%s:%u: %s req has %u bvecs for %lu sectors %lu hard sectors\n",
-               __func__, __LINE__, op, n, req->nr_sectors,
-               req->hard_nr_sectors);
+               "%s:%u: %s req has %u bvecs for %u sectors\n",
+               __func__, __LINE__, op, n, blk_rq_sectors(req));
 #endif
 
-       start_sector = req->sector * priv->blocking_factor;
-       sectors = req->nr_sectors * priv->blocking_factor;
-       dev_dbg(&dev->sbd.core, "%s:%u: %s %lu sectors starting at %lu\n",
+       start_sector = blk_rq_pos(req) * priv->blocking_factor;
+       sectors = blk_rq_sectors(req) * priv->blocking_factor;
+       dev_dbg(&dev->sbd.core, "%s:%u: %s %llu sectors starting at %llu\n",
                __func__, __LINE__, op, sectors, start_sector);
 
        if (write) {
@@ -158,7 +157,7 @@ static int ps3disk_submit_request_sg(struct ps3_storage_device *dev,
        if (res) {
                dev_err(&dev->sbd.core, "%s:%u: %s failed %d\n", __func__,
                        __LINE__, op, res);
-               end_request(req, 0);
+               __blk_end_request_all(req, -EIO);
                return 0;
        }
 
@@ -178,9 +177,9 @@ static int ps3disk_submit_flush_request(struct ps3_storage_device *dev,
                                              LV1_STORAGE_ATA_HDDOUT, 0, 0, 0,
                                              0, &dev->tag);
        if (res) {
-               dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%lx\n",
+               dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%llx\n",
                        __func__, __LINE__, res);
-               end_request(req, 0);
+               __blk_end_request_all(req, -EIO);
                return 0;
        }
 
@@ -195,16 +194,17 @@ static void ps3disk_do_request(struct ps3_storage_device *dev,
 
        dev_dbg(&dev->sbd.core, "%s:%u\n", __func__, __LINE__);
 
-       while ((req = elv_next_request(q))) {
+       while ((req = blk_fetch_request(q))) {
                if (blk_fs_request(req)) {
                        if (ps3disk_submit_request_sg(dev, req))
                                break;
-               } else if (req->cmd_type == REQ_TYPE_FLUSH) {
+               } else if (req->cmd_type == REQ_TYPE_LINUX_BLOCK &&
+                          req->cmd[0] == REQ_LB_OP_FLUSH) {
                        if (ps3disk_submit_flush_request(dev, req))
                                break;
                } else {
                        blk_dump_rq_flags(req, DEVICE_NAME " bad request");
-                       end_request(req, 0);
+                       __blk_end_request_all(req, -EIO);
                        continue;
                }
        }
@@ -230,18 +230,17 @@ static irqreturn_t ps3disk_interrupt(int irq, void *data)
        struct request *req;
        int res, read, error;
        u64 tag, status;
-       unsigned long num_sectors;
        const char *op;
 
        res = lv1_storage_get_async_status(dev->sbd.dev_id, &tag, &status);
 
        if (tag != dev->tag)
                dev_err(&dev->sbd.core,
-                       "%s:%u: tag mismatch, got %lx, expected %lx\n",
+                       "%s:%u: tag mismatch, got %llx, expected %llx\n",
                        __func__, __LINE__, tag, dev->tag);
 
        if (res) {
-               dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%lx\n",
+               dev_err(&dev->sbd.core, "%s:%u: res=%d status=0x%llx\n",
                        __func__, __LINE__, res, status);
                return IRQ_HANDLED;
        }
@@ -257,17 +256,16 @@ static irqreturn_t ps3disk_interrupt(int irq, void *data)
                return IRQ_HANDLED;
        }
 
-       if (req->cmd_type == REQ_TYPE_FLUSH) {
+       if (req->cmd_type == REQ_TYPE_LINUX_BLOCK &&
+           req->cmd[0] == REQ_LB_OP_FLUSH) {
                read = 0;
-               num_sectors = req->hard_cur_sectors;
                op = "flush";
        } else {
                read = !rq_data_dir(req);
-               num_sectors = req->nr_sectors;
                op = read ? "read" : "write";
        }
        if (status) {
-               dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%lx\n", __func__,
+               dev_dbg(&dev->sbd.core, "%s:%u: %s failed 0x%llx\n", __func__,
                        __LINE__, op, status);
                error = -EIO;
        } else {
@@ -279,7 +277,7 @@ static irqreturn_t ps3disk_interrupt(int irq, void *data)
        }
 
        spin_lock(&priv->lock);
-       __blk_end_request(req, error, num_sectors << 9);
+       __blk_end_request_all(req, error);
        priv->req = NULL;
        ps3disk_do_request(dev, priv->queue);
        spin_unlock(&priv->lock);
@@ -295,7 +293,7 @@ static int ps3disk_sync_cache(struct ps3_storage_device *dev)
 
        res = ps3stor_send_command(dev, LV1_STORAGE_ATA_HDDOUT, 0, 0, 0, 0);
        if (res) {
-               dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%lx\n",
+               dev_err(&dev->sbd.core, "%s:%u: sync cache failed 0x%llx\n",
                        __func__, __LINE__, res);
                return -EIO;
        }
@@ -386,7 +384,7 @@ static int ps3disk_identify(struct ps3_storage_device *dev)
                                   sizeof(ata_cmnd), ata_cmnd.buffer,
                                   ata_cmnd.arglen);
        if (res) {
-               dev_err(&dev->sbd.core, "%s:%u: identify disk failed 0x%lx\n",
+               dev_err(&dev->sbd.core, "%s:%u: identify disk failed 0x%llx\n",
                        __func__, __LINE__, res);
                return -EIO;
        }
@@ -405,7 +403,8 @@ static void ps3disk_prepare_flush(struct request_queue *q, struct request *req)
 
        dev_dbg(&dev->sbd.core, "%s:%u\n", __func__, __LINE__);
 
-       req->cmd_type = REQ_TYPE_FLUSH;
+       req->cmd_type = REQ_TYPE_LINUX_BLOCK;
+       req->cmd[0] = REQ_LB_OP_FLUSH;
 }
 
 static unsigned long ps3disk_mask;
@@ -423,7 +422,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev)
 
        if (dev->blk_size < 512) {
                dev_err(&dev->sbd.core,
-                       "%s:%u: cannot handle block size %lu\n", __func__,
+                       "%s:%u: cannot handle block size %llu\n", __func__,
                        __LINE__, dev->blk_size);
                return -EINVAL;
        }
@@ -478,7 +477,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev)
        blk_queue_max_sectors(queue, dev->bounce_size >> 9);
        blk_queue_segment_boundary(queue, -1UL);
        blk_queue_dma_alignment(queue, dev->blk_size-1);
-       blk_queue_hardsect_size(queue, dev->blk_size);
+       blk_queue_logical_block_size(queue, dev->blk_size);
 
        blk_queue_ordered(queue, QUEUE_ORDERED_DRAIN_FLUSH,
                          ps3disk_prepare_flush);
@@ -509,7 +508,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev)
                     dev->regions[dev->region_idx].size*priv->blocking_factor);
 
        dev_info(&dev->sbd.core,
-                "%s is a %s (%lu MiB total, %lu MiB for OtherOS)\n",
+                "%s is a %s (%llu MiB total, %lu MiB for OtherOS)\n",
                 gendisk->disk_name, priv->model, priv->raw_capacity >> 11,
                 get_capacity(gendisk) >> 11);
 
@@ -538,7 +537,7 @@ static int ps3disk_remove(struct ps3_system_bus_device *_dev)
        struct ps3disk_private *priv = dev->sbd.core.driver_data;
 
        mutex_lock(&ps3disk_mask_mutex);
-       __clear_bit(priv->gendisk->first_minor / PS3DISK_MINORS,
+       __clear_bit(MINOR(disk_devt(priv->gendisk)) / PS3DISK_MINORS,
                    &ps3disk_mask);
        mutex_unlock(&ps3disk_mask_mutex);
        del_gendisk(priv->gendisk);