Check error return from g_clone_bio(). (netchild@)

Rearrange code to avoid duplication (phk@)

Submitted by:	netchild@
This commit is contained in:
Poul-Henning Kamp 2004-02-02 13:36:06 +00:00
parent cc93dd4b73
commit abc2e0fd56

View file

@ -110,16 +110,18 @@ g_mirror_start(struct bio *bp)
sc = gp->softc;
switch(bp->bio_cmd) {
case BIO_READ:
bp2 = g_clone_bio(bp);
bp2->bio_offset += sc->sectorsize;
bp2->bio_done = g_std_done;
g_io_request(bp2, LIST_FIRST(&gp->consumer));
return;
case BIO_WRITE:
case BIO_DELETE:
bp2 = g_clone_bio(bp);
if (bp2 == NULL) {
g_io_deliver(bp, ENOMEM);
return;
}
bp2->bio_offset += sc->sectorsize;
bp2->bio_done = g_mirror_done;
if (bp->bio_cmd == BIO_READ)
bp2->bio_done = g_std_done;
else
bp2->bio_done = g_mirror_done;
g_io_request(bp2, LIST_FIRST(&gp->consumer));
return;
default: