[Patch 3/10] dm: Get rid of struct dm_deferred_io in dm.c

From: Joe Thornber
Date: Tue Feb 10 2004 - 12:26:15 EST


Get rid of struct dm_deferred_io in dm.c. [Chripstophe Saout]
--- diff/drivers/md/dm.c 2004-02-10 16:11:24.000000000 +0000
+++ source/drivers/md/dm.c 2004-02-10 16:11:30.000000000 +0000
@@ -27,11 +27,6 @@
atomic_t io_count;
};

-struct deferred_io {
- struct bio *bio;
- struct deferred_io *next;
-};
-
/*
* Bits for the md->flags field.
*/
@@ -52,7 +47,7 @@
*/
atomic_t pending;
wait_queue_head_t wait;
- struct deferred_io *deferred;
+ struct bio *deferred;

/*
* The current mapping.
@@ -188,38 +183,20 @@
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.
*/
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);

if (!test_bit(DMF_BLOCK_IO, &md->flags)) {
up_write(&md->lock);
- free_deferred(di);
return 1;
}

- di->bio = bio;
- di->next = md->deferred;
- md->deferred = di;
+ bio->bi_next = md->deferred;
+ md->deferred = bio;

up_write(&md->lock);
return 0; /* deferred successfully */
@@ -743,14 +720,14 @@
/*
* 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) {
- n = c->next;
- generic_make_request(c->bio);
- free_deferred(c);
+ n = c->bi_next;
+ c->bi_next = NULL;
+ generic_make_request(c);
c = n;
}
}
@@ -832,7 +809,7 @@

int dm_resume(struct mapped_device *md)
{
- struct deferred_io *def;
+ struct bio *def;

down_write(&md->lock);
if (!md->map ||
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/