diff options
author | Alasdair G Kergon <agk@redhat.com> | 2007-07-12 12:26:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-12 18:01:08 -0400 |
commit | 028867ac28e51afc834a5931e7545c022557eded (patch) | |
tree | 0a268776ac68f26c86a28416b35a60ab54e3fb94 /drivers/md/dm.c | |
parent | 79e15ae424afa0a40b1a0c4478046d6ba0b71e20 (diff) |
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 { | |||
45 | * One of these is allocated per target within a bio. Hopefully | 45 | * One of these is allocated per target within a bio. Hopefully |
46 | * this will be simplified out one day. | 46 | * this will be simplified out one day. |
47 | */ | 47 | */ |
48 | struct target_io { | 48 | struct dm_target_io { |
49 | struct dm_io *io; | 49 | struct dm_io *io; |
50 | struct dm_target *ti; | 50 | struct dm_target *ti; |
51 | union map_info info; | 51 | union map_info info; |
@@ -54,7 +54,7 @@ struct target_io { | |||
54 | union map_info *dm_get_mapinfo(struct bio *bio) | 54 | union map_info *dm_get_mapinfo(struct bio *bio) |
55 | { | 55 | { |
56 | if (bio && bio->bi_private) | 56 | if (bio && bio->bi_private) |
57 | return &((struct target_io *)bio->bi_private)->info; | 57 | return &((struct dm_target_io *)bio->bi_private)->info; |
58 | return NULL; | 58 | return NULL; |
59 | } | 59 | } |
60 | 60 | ||
@@ -132,14 +132,12 @@ static int __init local_init(void) | |||
132 | int r; | 132 | int r; |
133 | 133 | ||
134 | /* allocate a slab for the dm_ios */ | 134 | /* allocate a slab for the dm_ios */ |
135 | _io_cache = kmem_cache_create("dm_io", | 135 | _io_cache = KMEM_CACHE(dm_io, 0); |
136 | sizeof(struct dm_io), 0, 0, NULL, NULL); | ||
137 | if (!_io_cache) | 136 | if (!_io_cache) |
138 | return -ENOMEM; | 137 | return -ENOMEM; |
139 | 138 | ||
140 | /* allocate a slab for the target ios */ | 139 | /* allocate a slab for the target ios */ |
141 | _tio_cache = kmem_cache_create("dm_tio", sizeof(struct target_io), | 140 | _tio_cache = KMEM_CACHE(dm_target_io, 0); |
142 | 0, 0, NULL, NULL); | ||
143 | if (!_tio_cache) { | 141 | if (!_tio_cache) { |
144 | kmem_cache_destroy(_io_cache); | 142 | kmem_cache_destroy(_io_cache); |
145 | return -ENOMEM; | 143 | return -ENOMEM; |
@@ -325,22 +323,22 @@ out: | |||
325 | return r; | 323 | return r; |
326 | } | 324 | } |
327 | 325 | ||
328 | static inline struct dm_io *alloc_io(struct mapped_device *md) | 326 | static struct dm_io *alloc_io(struct mapped_device *md) |
329 | { | 327 | { |
330 | return mempool_alloc(md->io_pool, GFP_NOIO); | 328 | return mempool_alloc(md->io_pool, GFP_NOIO); |
331 | } | 329 | } |
332 | 330 | ||
333 | static inline void free_io(struct mapped_device *md, struct dm_io *io) | 331 | static void free_io(struct mapped_device *md, struct dm_io *io) |
334 | { | 332 | { |
335 | mempool_free(io, md->io_pool); | 333 | mempool_free(io, md->io_pool); |
336 | } | 334 | } |
337 | 335 | ||
338 | static inline struct target_io *alloc_tio(struct mapped_device *md) | 336 | static struct dm_target_io *alloc_tio(struct mapped_device *md) |
339 | { | 337 | { |
340 | return mempool_alloc(md->tio_pool, GFP_NOIO); | 338 | return mempool_alloc(md->tio_pool, GFP_NOIO); |
341 | } | 339 | } |
342 | 340 | ||
343 | static inline void free_tio(struct mapped_device *md, struct target_io *tio) | 341 | static void free_tio(struct mapped_device *md, struct dm_target_io *tio) |
344 | { | 342 | { |
345 | mempool_free(tio, md->tio_pool); | 343 | mempool_free(tio, md->tio_pool); |
346 | } | 344 | } |
@@ -498,7 +496,7 @@ static void dec_pending(struct dm_io *io, int error) | |||
498 | static int clone_endio(struct bio *bio, unsigned int done, int error) | 496 | static int clone_endio(struct bio *bio, unsigned int done, int error) |
499 | { | 497 | { |
500 | int r = 0; | 498 | int r = 0; |
501 | struct target_io *tio = bio->bi_private; | 499 | struct dm_target_io *tio = bio->bi_private; |
502 | struct mapped_device *md = tio->io->md; | 500 | struct mapped_device *md = tio->io->md; |
503 | dm_endio_fn endio = tio->ti->type->end_io; | 501 | dm_endio_fn endio = tio->ti->type->end_io; |
504 | 502 | ||
@@ -558,7 +556,7 @@ static sector_t max_io_len(struct mapped_device *md, | |||
558 | } | 556 | } |
559 | 557 | ||
560 | static void __map_bio(struct dm_target *ti, struct bio *clone, | 558 | static void __map_bio(struct dm_target *ti, struct bio *clone, |
561 | struct target_io *tio) | 559 | struct dm_target_io *tio) |
562 | { | 560 | { |
563 | int r; | 561 | int r; |
564 | sector_t sector; | 562 | sector_t sector; |
@@ -672,7 +670,7 @@ static void __clone_and_map(struct clone_info *ci) | |||
672 | struct bio *clone, *bio = ci->bio; | 670 | struct bio *clone, *bio = ci->bio; |
673 | struct dm_target *ti = dm_table_find_target(ci->map, ci->sector); | 671 | struct dm_target *ti = dm_table_find_target(ci->map, ci->sector); |
674 | sector_t len = 0, max = max_io_len(ci->md, ci->sector, ti); | 672 | sector_t len = 0, max = max_io_len(ci->md, ci->sector, ti); |
675 | struct target_io *tio; | 673 | struct dm_target_io *tio; |
676 | 674 | ||
677 | /* | 675 | /* |
678 | * Allocate a target io object. | 676 | * Allocate a target io object. |