Commit 34ab96e6 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

mtd_blkdevs: handle highmem pages

Just kmap the single payload page before passing it on to the FTL.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 7c2d748e
...@@ -82,7 +82,6 @@ static blk_status_t do_blktrans_request(struct mtd_blktrans_ops *tr, ...@@ -82,7 +82,6 @@ static blk_status_t do_blktrans_request(struct mtd_blktrans_ops *tr,
block = blk_rq_pos(req) << 9 >> tr->blkshift; block = blk_rq_pos(req) << 9 >> tr->blkshift;
nsect = blk_rq_cur_bytes(req) >> tr->blkshift; nsect = blk_rq_cur_bytes(req) >> tr->blkshift;
buf = bio_data(req->bio);
if (req_op(req) == REQ_OP_FLUSH) { if (req_op(req) == REQ_OP_FLUSH) {
if (tr->flush(dev)) if (tr->flush(dev))
...@@ -100,9 +99,14 @@ static blk_status_t do_blktrans_request(struct mtd_blktrans_ops *tr, ...@@ -100,9 +99,14 @@ static blk_status_t do_blktrans_request(struct mtd_blktrans_ops *tr,
return BLK_STS_IOERR; return BLK_STS_IOERR;
return BLK_STS_OK; return BLK_STS_OK;
case REQ_OP_READ: case REQ_OP_READ:
for (; nsect > 0; nsect--, block++, buf += tr->blksize) buf = kmap(bio_page(req->bio)) + bio_offset(req->bio);
if (tr->readsect(dev, block, buf)) for (; nsect > 0; nsect--, block++, buf += tr->blksize) {
if (tr->readsect(dev, block, buf)) {
kunmap(bio_page(req->bio));
return BLK_STS_IOERR; return BLK_STS_IOERR;
}
}
kunmap(bio_page(req->bio));
rq_flush_dcache_pages(req); rq_flush_dcache_pages(req);
return BLK_STS_OK; return BLK_STS_OK;
case REQ_OP_WRITE: case REQ_OP_WRITE:
...@@ -110,9 +114,14 @@ static blk_status_t do_blktrans_request(struct mtd_blktrans_ops *tr, ...@@ -110,9 +114,14 @@ static blk_status_t do_blktrans_request(struct mtd_blktrans_ops *tr,
return BLK_STS_IOERR; return BLK_STS_IOERR;
rq_flush_dcache_pages(req); rq_flush_dcache_pages(req);
for (; nsect > 0; nsect--, block++, buf += tr->blksize) buf = kmap(bio_page(req->bio)) + bio_offset(req->bio);
if (tr->writesect(dev, block, buf)) for (; nsect > 0; nsect--, block++, buf += tr->blksize) {
if (tr->writesect(dev, block, buf)) {
kunmap(bio_page(req->bio));
return BLK_STS_IOERR; return BLK_STS_IOERR;
}
}
kunmap(bio_page(req->bio));
return BLK_STS_OK; return BLK_STS_OK;
default: default:
return BLK_STS_IOERR; return BLK_STS_IOERR;
...@@ -418,7 +427,6 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) ...@@ -418,7 +427,6 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
new->rq->queuedata = new; new->rq->queuedata = new;
blk_queue_logical_block_size(new->rq, tr->blksize); blk_queue_logical_block_size(new->rq, tr->blksize);
blk_queue_bounce_limit(new->rq, BLK_BOUNCE_HIGH);
blk_queue_flag_set(QUEUE_FLAG_NONROT, new->rq); blk_queue_flag_set(QUEUE_FLAG_NONROT, new->rq);
blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, new->rq); blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, new->rq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment