Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6
[pandora-kernel.git] / drivers / mtd / mtd_blkdevs.c
index 4ea2e67..aaac3b6 100644 (file)
@@ -48,7 +48,7 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr,
        char *buf;
 
        block = blk_rq_pos(req) << 9 >> tr->blkshift;
-       nsect = blk_rq_cur_sectors(req) << 9 >> tr->blkshift;
+       nsect = blk_rq_cur_bytes(req) >> tr->blkshift;
 
        buf = req->buffer;
 
@@ -89,19 +89,18 @@ static int mtd_blktrans_thread(void *arg)
 {
        struct mtd_blktrans_ops *tr = arg;
        struct request_queue *rq = tr->blkcore_priv->rq;
+       struct request *req = NULL;
 
        /* we might get involved when memory gets low, so use PF_MEMALLOC */
        current->flags |= PF_MEMALLOC;
 
        spin_lock_irq(rq->queue_lock);
+
        while (!kthread_should_stop()) {
-               struct request *req;
                struct mtd_blktrans_dev *dev;
                int res;
 
-               req = elv_next_request(rq);
-
-               if (!req) {
+               if (!req && !(req = blk_fetch_request(rq))) {
                        set_current_state(TASK_INTERRUPTIBLE);
                        spin_unlock_irq(rq->queue_lock);
                        schedule();
@@ -120,8 +119,13 @@ static int mtd_blktrans_thread(void *arg)
 
                spin_lock_irq(rq->queue_lock);
 
-               __blk_end_request_cur(req, res);
+               if (!__blk_end_request_cur(req, res))
+                       req = NULL;
        }
+
+       if (req)
+               __blk_end_request_all(req, -EIO);
+
        spin_unlock_irq(rq->queue_lock);
 
        return 0;
@@ -374,7 +378,7 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
        }
 
        tr->blkcore_priv->rq->queuedata = tr;
-       blk_queue_hardsect_size(tr->blkcore_priv->rq, tr->blksize);
+       blk_queue_logical_block_size(tr->blkcore_priv->rq, tr->blksize);
        if (tr->discard)
                blk_queue_set_discard(tr->blkcore_priv->rq,
                                      blktrans_discard_request);