Lines Matching refs:tr

45 static blk_status_t do_blktrans_request(struct mtd_blktrans_ops *tr,  in do_blktrans_request()  argument
54 block = blk_rq_pos(req) << 9 >> tr->blkshift; in do_blktrans_request()
55 nsect = blk_rq_cur_bytes(req) >> tr->blkshift; in do_blktrans_request()
59 if (tr->flush(dev)) in do_blktrans_request()
63 if (tr->discard(dev, block, nsect)) in do_blktrans_request()
68 for (; nsect > 0; nsect--, block++, buf += tr->blksize) { in do_blktrans_request()
69 if (tr->readsect(dev, block, buf)) { in do_blktrans_request()
80 if (!tr->writesect) in do_blktrans_request()
87 for (; nsect > 0; nsect--, block++, buf += tr->blksize) { in do_blktrans_request()
88 if (tr->writesect(dev, block, buf)) { in do_blktrans_request()
124 struct mtd_blktrans_ops *tr = dev->tr; in mtd_blktrans_work() local
133 if (tr->background && !background_done) { in mtd_blktrans_work()
136 tr->background(dev); in mtd_blktrans_work()
152 res = do_blktrans_request(dev->tr, dev, req); in mtd_blktrans_work()
197 __module_get(dev->tr->owner); in blktrans_open()
202 if (dev->tr->open) { in blktrans_open()
203 ret = dev->tr->open(dev); in blktrans_open()
219 if (dev->tr->release) in blktrans_open()
220 dev->tr->release(dev); in blktrans_open()
222 module_put(dev->tr->owner); in blktrans_open()
237 module_put(dev->tr->owner); in blktrans_release()
240 if (dev->tr->release) in blktrans_release()
241 dev->tr->release(dev); in blktrans_release()
259 ret = dev->tr->getgeo ? dev->tr->getgeo(dev, geo) : -ENOTTY; in blktrans_getgeo()
278 struct mtd_blktrans_ops *tr = new->tr; in add_mtd_blktrans_dev() local
287 list_for_each_entry(d, &tr->devs, list) { in add_mtd_blktrans_dev()
314 if (new->devnum > (MINORMASK >> tr->part_bits) || in add_mtd_blktrans_dev()
315 (tr->part_bits && new->devnum >= 27 * 26)) in add_mtd_blktrans_dev()
318 list_add_tail(&new->list, &tr->devs); in add_mtd_blktrans_dev()
323 if (!tr->writesect) in add_mtd_blktrans_dev()
336 lim.logical_block_size = tr->blksize; in add_mtd_blktrans_dev()
337 if (tr->discard) in add_mtd_blktrans_dev()
339 if (tr->flush) in add_mtd_blktrans_dev()
352 gd->major = tr->major; in add_mtd_blktrans_dev()
353 gd->first_minor = (new->devnum) << tr->part_bits; in add_mtd_blktrans_dev()
354 gd->minors = 1 << tr->part_bits; in add_mtd_blktrans_dev()
357 if (tr->part_bits) { in add_mtd_blktrans_dev()
360 "%s%c", tr->name, 'a' + new->devnum); in add_mtd_blktrans_dev()
363 "%s%c%c", tr->name, in add_mtd_blktrans_dev()
368 "%s%d", tr->name, new->devnum); in add_mtd_blktrans_dev()
372 set_capacity(gd, ((u64)new->size * tr->blksize) >> 9); in add_mtd_blktrans_dev()
432 if (old->tr->release) in del_mtd_blktrans_dev()
433 old->tr->release(old); in del_mtd_blktrans_dev()
446 struct mtd_blktrans_ops *tr; in blktrans_notify_remove() local
449 list_for_each_entry(tr, &blktrans_majors, list) in blktrans_notify_remove()
450 list_for_each_entry_safe(dev, next, &tr->devs, list) in blktrans_notify_remove()
452 tr->remove_dev(dev); in blktrans_notify_remove()
457 struct mtd_blktrans_ops *tr; in blktrans_notify_add() local
462 list_for_each_entry(tr, &blktrans_majors, list) in blktrans_notify_add()
463 tr->add_mtd(tr, mtd); in blktrans_notify_add()
471 int register_mtd_blktrans(struct mtd_blktrans_ops *tr) in register_mtd_blktrans() argument
482 ret = register_blkdev(tr->major, tr->name); in register_mtd_blktrans()
485 tr->name, tr->major, ret); in register_mtd_blktrans()
490 tr->major = ret; in register_mtd_blktrans()
492 tr->blkshift = ffs(tr->blksize) - 1; in register_mtd_blktrans()
494 INIT_LIST_HEAD(&tr->devs); in register_mtd_blktrans()
497 list_add(&tr->list, &blktrans_majors); in register_mtd_blktrans()
500 tr->add_mtd(tr, mtd); in register_mtd_blktrans()
505 int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr) in deregister_mtd_blktrans() argument
512 list_del(&tr->list); in deregister_mtd_blktrans()
514 list_for_each_entry_safe(dev, next, &tr->devs, list) in deregister_mtd_blktrans()
515 tr->remove_dev(dev); in deregister_mtd_blktrans()
518 unregister_blkdev(tr->major, tr->name); in deregister_mtd_blktrans()
520 BUG_ON(!list_empty(&tr->devs)); in deregister_mtd_blktrans()