diff options
author | phk <phk@FreeBSD.org> | 2002-10-07 07:15:37 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-10-07 07:15:37 +0000 |
commit | 2490bca6eae4a957af46d8ed0f026794462a52b0 (patch) | |
tree | 635071dfb1d73588f932bc4bb7d2163f31665a91 /sys/geom/geom_disk.c | |
parent | f6845196683cdfa0fe2a39c32bd9360840cb21a4 (diff) | |
download | FreeBSD-src-2490bca6eae4a957af46d8ed0f026794462a52b0.zip FreeBSD-src-2490bca6eae4a957af46d8ed0f026794462a52b0.tar.gz |
Correctly deal with non-DEVBSIZE drives.
Allow BIO_DELETE through too.
This fixes swap-backed md(4) devices.
Sponsored by: DARPA & NAI Labs.
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 be9008c..006ff32 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; } |