mirror of
https://github.com/opnsense/src.git
synced 2026-05-19 08:25:22 -04:00
Check error return from g_clone_bio(). (netchild@)
Rearrange code to avoid duplication (phk@) Submitted by: netchild@
This commit is contained in:
parent
cc93dd4b73
commit
abc2e0fd56
1 changed files with 8 additions and 6 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue