aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2009-06-22 05:12:21 -0400
committerAlasdair G Kergon <agk@redhat.com>2009-06-22 05:12:21 -0400
commit9015df24a8008d7bea2bd3df881783ebe0dcb9af (patch)
treeaff9a824a202525036d5f2dc52ad728dc9a38cbd /drivers/md
parentf9ab94cee313746573b2d693bc2afb807ebb0998 (diff)
dm: initialise tio in alloc_tio
Move repeated dm_target_io initialisation inside alloc_tio(). Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index badb7519ccc..edf9f246769 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -391,11 +391,6 @@ static void free_io(struct mapped_device *md, struct dm_io *io)
391 mempool_free(io, md->io_pool); 391 mempool_free(io, md->io_pool);
392} 392}
393 393
394static struct dm_target_io *alloc_tio(struct mapped_device *md)
395{
396 return mempool_alloc(md->tio_pool, GFP_NOIO);
397}
398
399static void free_tio(struct mapped_device *md, struct dm_target_io *tio) 394static void free_tio(struct mapped_device *md, struct dm_target_io *tio)
400{ 395{
401 mempool_free(tio, md->tio_pool); 396 mempool_free(tio, md->tio_pool);
@@ -750,16 +745,24 @@ static struct bio *clone_bio(struct bio *bio, sector_t sector,
750 return clone; 745 return clone;
751} 746}
752 747
753static void __flush_target(struct clone_info *ci, struct dm_target *ti, 748static struct dm_target_io *alloc_tio(struct clone_info *ci,
754 unsigned flush_nr) 749 struct dm_target *ti)
755{ 750{
756 struct dm_target_io *tio = alloc_tio(ci->md); 751 struct dm_target_io *tio = mempool_alloc(ci->md->tio_pool, GFP_NOIO);
757 struct bio *clone;
758 752
759 tio->io = ci->io; 753 tio->io = ci->io;
760 tio->ti = ti; 754 tio->ti = ti;
761
762 memset(&tio->info, 0, sizeof(tio->info)); 755 memset(&tio->info, 0, sizeof(tio->info));
756
757 return tio;
758}
759
760static void __flush_target(struct clone_info *ci, struct dm_target *ti,
761 unsigned flush_nr)
762{
763 struct dm_target_io *tio = alloc_tio(ci, ti);
764 struct bio *clone;
765
763 tio->info.flush_request = flush_nr; 766 tio->info.flush_request = flush_nr;
764 767
765 clone = bio_alloc_bioset(GFP_NOIO, 0, ci->md->bs); 768 clone = bio_alloc_bioset(GFP_NOIO, 0, ci->md->bs);
@@ -803,10 +806,7 @@ static int __clone_and_map(struct clone_info *ci)
803 /* 806 /*
804 * Allocate a target io object. 807 * Allocate a target io object.
805 */ 808 */
806 tio = alloc_tio(ci->md); 809 tio = alloc_tio(ci, ti);
807 tio->io = ci->io;
808 tio->ti = ti;
809 memset(&tio->info, 0, sizeof(tio->info));
810 810
811 if (ci->sector_count <= max) { 811 if (ci->sector_count <= max) {
812 /* 812 /*
@@ -862,10 +862,7 @@ static int __clone_and_map(struct clone_info *ci)
862 862
863 max = max_io_len(ci->md, ci->sector, ti); 863 max = max_io_len(ci->md, ci->sector, ti);
864 864
865 tio = alloc_tio(ci->md); 865 tio = alloc_tio(ci, ti);
866 tio->io = ci->io;
867 tio->ti = ti;
868 memset(&tio->info, 0, sizeof(tio->info));
869 } 866 }
870 867
871 len = min(remaining, max); 868 len = min(remaining, max);