[PATCH] DM 4/5: dm-raid1.c: Make delayed_bios a bio_list

From: Kevin Corry
Date: Mon Jun 14 2004 - 13:22:09 EST


dm-raid1.c: Make struct region::delayed_bios a bio_list instead of a bio*.
This will ensure the queued bios are kept in the proper order.

Signed-off-by: Kevin Corry <kevcorry@xxxxxxxxxx>

--- diff/drivers/md/dm-raid1.c 2004-06-14 09:29:56.946129416 +0000
+++ source/drivers/md/dm-raid1.c 2004-06-14 09:30:12.916701520 +0000
@@ -103,7 +103,7 @@
struct list_head list;

atomic_t pending;
- struct bio *delayed_bios;
+ struct bio_list delayed_bios;
};

/*
@@ -244,7 +244,7 @@
INIT_LIST_HEAD(&nreg->list);

atomic_set(&nreg->pending, 0);
- nreg->delayed_bios = NULL;
+ bio_list_init(&nreg->delayed_bios);
write_lock_irq(&rh->hash_lock);

reg = __rh_lookup(rh, region);
@@ -310,14 +310,12 @@
return state == RH_CLEAN || state == RH_DIRTY;
}

-static void dispatch_bios(struct mirror_set *ms, struct bio *bio)
+static void dispatch_bios(struct mirror_set *ms, struct bio_list *bio_list)
{
- struct bio *nbio;
+ struct bio *bio;

- while (bio) {
- nbio = bio->bi_next;
+ while ((bio = bio_list_pop(bio_list))) {
queue_bio(ms, bio, WRITE);
- bio = nbio;
}
}

@@ -361,7 +359,7 @@
list_for_each_entry_safe (reg, next, &recovered, list) {
rh->log->type->clear_region(rh->log, reg->key);
rh->log->type->complete_resync_work(rh->log, reg->key, 1);
- dispatch_bios(rh->ms, reg->delayed_bios);
+ dispatch_bios(rh->ms, &reg->delayed_bios);
up(&rh->recovery_count);
mempool_free(reg, rh->region_pool);
}
@@ -516,8 +514,7 @@

read_lock(&rh->hash_lock);
reg = __rh_find(rh, bio_to_region(rh, bio));
- bio->bi_next = reg->delayed_bios;
- reg->delayed_bios = bio;
+ bio_list_add(&reg->delayed_bios, bio);
read_unlock(&rh->hash_lock);
}

-
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/