提交 9015df24 编写于 作者: A Alasdair G Kergon

dm: initialise tio in alloc_tio

Move repeated dm_target_io initialisation inside alloc_tio().
Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
上级 f9ab94ce
...@@ -391,11 +391,6 @@ static void free_io(struct mapped_device *md, struct dm_io *io) ...@@ -391,11 +391,6 @@ static void free_io(struct mapped_device *md, struct dm_io *io)
mempool_free(io, md->io_pool); mempool_free(io, md->io_pool);
} }
static struct dm_target_io *alloc_tio(struct mapped_device *md)
{
return mempool_alloc(md->tio_pool, GFP_NOIO);
}
static void free_tio(struct mapped_device *md, struct dm_target_io *tio) static void free_tio(struct mapped_device *md, struct dm_target_io *tio)
{ {
mempool_free(tio, md->tio_pool); mempool_free(tio, md->tio_pool);
...@@ -750,16 +745,24 @@ static struct bio *clone_bio(struct bio *bio, sector_t sector, ...@@ -750,16 +745,24 @@ static struct bio *clone_bio(struct bio *bio, sector_t sector,
return clone; return clone;
} }
static void __flush_target(struct clone_info *ci, struct dm_target *ti, static struct dm_target_io *alloc_tio(struct clone_info *ci,
unsigned flush_nr) struct dm_target *ti)
{ {
struct dm_target_io *tio = alloc_tio(ci->md); struct dm_target_io *tio = mempool_alloc(ci->md->tio_pool, GFP_NOIO);
struct bio *clone;
tio->io = ci->io; tio->io = ci->io;
tio->ti = ti; tio->ti = ti;
memset(&tio->info, 0, sizeof(tio->info)); memset(&tio->info, 0, sizeof(tio->info));
return tio;
}
static void __flush_target(struct clone_info *ci, struct dm_target *ti,
unsigned flush_nr)
{
struct dm_target_io *tio = alloc_tio(ci, ti);
struct bio *clone;
tio->info.flush_request = flush_nr; tio->info.flush_request = flush_nr;
clone = bio_alloc_bioset(GFP_NOIO, 0, ci->md->bs); clone = bio_alloc_bioset(GFP_NOIO, 0, ci->md->bs);
...@@ -803,10 +806,7 @@ static int __clone_and_map(struct clone_info *ci) ...@@ -803,10 +806,7 @@ static int __clone_and_map(struct clone_info *ci)
/* /*
* Allocate a target io object. * Allocate a target io object.
*/ */
tio = alloc_tio(ci->md); tio = alloc_tio(ci, ti);
tio->io = ci->io;
tio->ti = ti;
memset(&tio->info, 0, sizeof(tio->info));
if (ci->sector_count <= max) { if (ci->sector_count <= max) {
/* /*
...@@ -862,10 +862,7 @@ static int __clone_and_map(struct clone_info *ci) ...@@ -862,10 +862,7 @@ static int __clone_and_map(struct clone_info *ci)
max = max_io_len(ci->md, ci->sector, ti); max = max_io_len(ci->md, ci->sector, ti);
tio = alloc_tio(ci->md); tio = alloc_tio(ci, ti);
tio->io = ci->io;
tio->ti = ti;
memset(&tio->info, 0, sizeof(tio->info));
} }
len = min(remaining, max); len = min(remaining, max);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册