diff options
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r-- | drivers/md/dm.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 75bd2fd8575e..2120155929a6 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -45,7 +45,7 @@ struct dm_io { * One of these is allocated per target within a bio. Hopefully * this will be simplified out one day. */ -struct target_io { +struct dm_target_io { struct dm_io *io; struct dm_target *ti; union map_info info; @@ -54,7 +54,7 @@ struct target_io { union map_info *dm_get_mapinfo(struct bio *bio) { if (bio && bio->bi_private) - return &((struct target_io *)bio->bi_private)->info; + return &((struct dm_target_io *)bio->bi_private)->info; return NULL; } @@ -80,7 +80,7 @@ struct mapped_device { unsigned long flags; - request_queue_t *queue; + struct request_queue *queue; struct gendisk *disk; char name[16]; @@ -132,14 +132,12 @@ static int __init local_init(void) int r; /* allocate a slab for the dm_ios */ - _io_cache = kmem_cache_create("dm_io", - sizeof(struct dm_io), 0, 0, NULL, NULL); + _io_cache = KMEM_CACHE(dm_io, 0); if (!_io_cache) return -ENOMEM; /* allocate a slab for the target ios */ - _tio_cache = kmem_cache_create("dm_tio", sizeof(struct target_io), - 0, 0, NULL, NULL); + _tio_cache = KMEM_CACHE(dm_target_io, 0); if (!_tio_cache) { kmem_cache_destroy(_io_cache); return -ENOMEM; @@ -163,9 +161,7 @@ static void local_exit(void) { kmem_cache_destroy(_tio_cache); kmem_cache_destroy(_io_cache); - - if (unregister_blkdev(_major, _name) < 0) - DMERR("unregister_blkdev failed"); + unregister_blkdev(_major, _name); _major = 0; @@ -325,22 +321,22 @@ out: return r; } -static inline struct dm_io *alloc_io(struct mapped_device *md) +static struct dm_io *alloc_io(struct mapped_device *md) { return mempool_alloc(md->io_pool, GFP_NOIO); } -static inline void free_io(struct mapped_device *md, struct dm_io *io) +static void free_io(struct mapped_device *md, struct dm_io *io) { mempool_free(io, md->io_pool); } -static inline struct target_io *alloc_tio(struct mapped_device *md) +static struct dm_target_io *alloc_tio(struct mapped_device *md) { return mempool_alloc(md->tio_pool, GFP_NOIO); } -static inline void free_tio(struct mapped_device *md, struct target_io *tio) +static void free_tio(struct mapped_device *md, struct dm_target_io *tio) { mempool_free(tio, md->tio_pool); } @@ -498,7 +494,7 @@ static void dec_pending(struct dm_io *io, int error) static int clone_endio(struct bio *bio, unsigned int done, int error) { int r = 0; - struct target_io *tio = bio->bi_private; + struct dm_target_io *tio = bio->bi_private; struct mapped_device *md = tio->io->md; dm_endio_fn endio = tio->ti->type->end_io; @@ -558,7 +554,7 @@ static sector_t max_io_len(struct mapped_device *md, } static void __map_bio(struct dm_target *ti, struct bio *clone, - struct target_io *tio) + struct dm_target_io *tio) { int r; sector_t sector; @@ -584,8 +580,8 @@ static void __map_bio(struct dm_target *ti, struct bio *clone, /* the bio has been remapped so dispatch it */ blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone, - tio->io->bio->bi_bdev->bd_dev, sector, - clone->bi_sector); + tio->io->bio->bi_bdev->bd_dev, + clone->bi_sector, sector); generic_make_request(clone); } else if (r < 0 || r == DM_MAPIO_REQUEUE) { @@ -672,7 +668,7 @@ static void __clone_and_map(struct clone_info *ci) struct bio *clone, *bio = ci->bio; struct dm_target *ti = dm_table_find_target(ci->map, ci->sector); sector_t len = 0, max = max_io_len(ci->md, ci->sector, ti); - struct target_io *tio; + struct dm_target_io *tio; /* * Allocate a target io object. @@ -796,7 +792,7 @@ static void __split_bio(struct mapped_device *md, struct bio *bio) * The request function that just remaps the bio built up by * dm_merge_bvec. */ -static int dm_request(request_queue_t *q, struct bio *bio) +static int dm_request(struct request_queue *q, struct bio *bio) { int r; int rw = bio_data_dir(bio); @@ -848,7 +844,7 @@ static int dm_request(request_queue_t *q, struct bio *bio) return 0; } -static int dm_flush_all(request_queue_t *q, struct gendisk *disk, +static int dm_flush_all(struct request_queue *q, struct gendisk *disk, sector_t *error_sector) { struct mapped_device *md = q->queuedata; @@ -863,7 +859,7 @@ static int dm_flush_all(request_queue_t *q, struct gendisk *disk, return ret; } -static void dm_unplug_all(request_queue_t *q) +static void dm_unplug_all(struct request_queue *q) { struct mapped_device *md = q->queuedata; struct dm_table *map = dm_get_table(md); @@ -1114,7 +1110,7 @@ static void __set_size(struct mapped_device *md, sector_t size) static int __bind(struct mapped_device *md, struct dm_table *t) { - request_queue_t *q = md->queue; + struct request_queue *q = md->queue; sector_t size; size = dm_table_get_size(t); |