diff options
author | Alasdair G Kergon <agk@redhat.com> | 2007-07-12 18:26:32 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-13 00:01:08 +0200 |
commit | 028867ac28e51afc834a5931e7545c022557eded (patch) | |
tree | 0a268776ac68f26c86a28416b35a60ab54e3fb94 /drivers/md/dm.c | |
parent | dm: bio_list prefetch removal (diff) | |
download | linux-028867ac28e51afc834a5931e7545c022557eded.tar.xz linux-028867ac28e51afc834a5931e7545c022557eded.zip |
dm: use kmem_cache macro
Use new KMEM_CACHE() macro and make the newly-exposed structure names more
meaningful. Also remove some superfluous casts and inlines (let a modern
compiler be the judge).
Acked-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r-- | drivers/md/dm.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 2717a355dc5b..b5e56af8f85a 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; } @@ -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; @@ -325,22 +323,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 +496,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 +556,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; @@ -672,7 +670,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. |