Commit a0befbbc authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] dm: Get rid of struct dm_deferred_io in dm.c

From: Joe Thornber <thornber@redhat.com>

Remove struct dm_deferred_io from dm.c.  [Christophe Saout]
parent 0901c174
...@@ -27,11 +27,6 @@ struct dm_io { ...@@ -27,11 +27,6 @@ struct dm_io {
atomic_t io_count; atomic_t io_count;
}; };
struct deferred_io {
struct bio *bio;
struct deferred_io *next;
};
/* /*
* Bits for the md->flags field. * Bits for the md->flags field.
*/ */
...@@ -52,7 +47,7 @@ struct mapped_device { ...@@ -52,7 +47,7 @@ struct mapped_device {
*/ */
atomic_t pending; atomic_t pending;
wait_queue_head_t wait; wait_queue_head_t wait;
struct deferred_io *deferred; struct bio *deferred;
/* /*
* The current mapping. * The current mapping.
...@@ -188,38 +183,20 @@ static inline void free_io(struct mapped_device *md, struct dm_io *io) ...@@ -188,38 +183,20 @@ static inline void free_io(struct mapped_device *md, struct dm_io *io)
mempool_free(io, md->io_pool); mempool_free(io, md->io_pool);
} }
static inline struct deferred_io *alloc_deferred(void)
{
return kmalloc(sizeof(struct deferred_io), GFP_NOIO);
}
static inline void free_deferred(struct deferred_io *di)
{
kfree(di);
}
/* /*
* Add the bio to the list of deferred io. * Add the bio to the list of deferred io.
*/ */
static int queue_io(struct mapped_device *md, struct bio *bio) static int queue_io(struct mapped_device *md, struct bio *bio)
{ {
struct deferred_io *di;
di = alloc_deferred();
if (!di)
return -ENOMEM;
down_write(&md->lock); down_write(&md->lock);
if (!test_bit(DMF_BLOCK_IO, &md->flags)) { if (!test_bit(DMF_BLOCK_IO, &md->flags)) {
up_write(&md->lock); up_write(&md->lock);
free_deferred(di);
return 1; return 1;
} }
di->bio = bio; bio->bi_next = md->deferred;
di->next = md->deferred; md->deferred = bio;
md->deferred = di;
up_write(&md->lock); up_write(&md->lock);
return 0; /* deferred successfully */ return 0; /* deferred successfully */
...@@ -743,14 +720,14 @@ void dm_put(struct mapped_device *md) ...@@ -743,14 +720,14 @@ void dm_put(struct mapped_device *md)
/* /*
* Requeue the deferred bios by calling generic_make_request. * Requeue the deferred bios by calling generic_make_request.
*/ */
static void flush_deferred_io(struct deferred_io *c) static void flush_deferred_io(struct bio *c)
{ {
struct deferred_io *n; struct bio *n;
while (c) { while (c) {
n = c->next; n = c->bi_next;
generic_make_request(c->bio); c->bi_next = NULL;
free_deferred(c); generic_make_request(c);
c = n; c = n;
} }
} }
...@@ -832,7 +809,7 @@ int dm_suspend(struct mapped_device *md) ...@@ -832,7 +809,7 @@ int dm_suspend(struct mapped_device *md)
int dm_resume(struct mapped_device *md) int dm_resume(struct mapped_device *md)
{ {
struct deferred_io *def; struct bio *def;
down_write(&md->lock); down_write(&md->lock);
if (!md->map || if (!md->map ||
......
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