diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2002-10-07 07:15:37 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2002-10-07 07:15:37 +0000 |
commit | b362694c3b220a9fee331da02ed82669b6d4f3f1 (patch) | |
tree | 635071dfb1d73588f932bc4bb7d2163f31665a91 /sys/geom/geom_disk.c | |
parent | 0a1d3ef9b80e939e6d3daadd5a3e929587dca162 (diff) | |
download | src-b362694c3b220a9fee331da02ed82669b6d4f3f1.tar.gz src-b362694c3b220a9fee331da02ed82669b6d4f3f1.zip |
Correctly deal with non-DEVBSIZE drives.
Allow BIO_DELETE through too.
This fixes swap-backed md(4) devices.
Sponsored by: DARPA & NAI Labs.
Notes
Notes:
svn path=/head/; revision=104609
Diffstat (limited to 'sys/geom/geom_disk.c')
-rw-r--r-- | sys/geom/geom_disk.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index be9008ca53d4..006ff328a111 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -142,14 +142,20 @@ g_disk_start(struct bio *bp) dp = bp->bio_to->geom->softc; dev = dp->d_dev; - error = 0; + error = EJUSTRETURN; switch(bp->bio_cmd) { + case BIO_DELETE: + if (!(devsw(dev)->d_flags & D_CANFREE)) { + error = 0; + break; + } + /* fall-through */ case BIO_READ: case BIO_WRITE: bp2 = g_clone_bio(bp); bp2->bio_done = g_disk_done; bp2->bio_blkno = bp2->bio_offset >> DEV_BSHIFT; - bp2->bio_pblkno = bp2->bio_blkno; + bp2->bio_pblkno = bp2->bio_offset / dp->d_sectorsize; bp2->bio_bcount = bp2->bio_length; bp2->bio_dev = dev; mtx_lock(&Giant); @@ -192,9 +198,8 @@ g_disk_start(struct bio *bp) error = EOPNOTSUPP; break; } - if (error) { + if (error != EJUSTRETURN) g_io_deliver(bp, error); - } return; } |