Commit 3e5510ab authored by Evgeniy Polyakov's avatar Evgeniy Polyakov Committed by Greg Kroah-Hartman

Staging: DST: optimize bio allocation.

Use bio prepend feature as suggested by Jens Axboe.
Signed-off-by: default avatarEvgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cac22275
...@@ -33,7 +33,7 @@ int __init dst_export_init(void) ...@@ -33,7 +33,7 @@ int __init dst_export_init(void)
{ {
int err = -ENOMEM; int err = -ENOMEM;
dst_bio_set = bioset_create(32, 32); dst_bio_set = bioset_create(32, sizeof(struct dst_export_priv));
if (!dst_bio_set) if (!dst_bio_set)
goto err_out_exit; goto err_out_exit;
...@@ -424,12 +424,8 @@ static void dst_bio_destructor(struct bio *bio) ...@@ -424,12 +424,8 @@ static void dst_bio_destructor(struct bio *bio)
__free_page(bv->bv_page); __free_page(bv->bv_page);
} }
if (priv) { if (priv)
struct dst_node *n = priv->state->node;
dst_state_put(priv->state); dst_state_put(priv->state);
mempool_free(priv, n->trans_pool);
}
bio_free(bio, dst_bio_set); bio_free(bio, dst_bio_set);
} }
...@@ -555,11 +551,8 @@ int dst_process_io(struct dst_state *st) ...@@ -555,11 +551,8 @@ int dst_process_io(struct dst_state *st)
dst_bio_set); dst_bio_set);
if (!bio) if (!bio)
goto err_out_exit; goto err_out_exit;
bio->bi_private = NULL;
priv = mempool_alloc(st->node->trans_pool, GFP_KERNEL); priv = (struct dst_export_priv *)(((void *)bio) - sizeof (struct dst_export_priv));
if (!priv)
goto err_out_free;
priv->state = dst_state_get(st); priv->state = dst_state_get(st);
priv->bio = bio; priv->bio = bio;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment