From 079f2df393209d4eb295abb686e372ce01b9186a Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sun, 6 May 2001 21:55:22 +0000 Subject: [PATCH] Make the disk mini-layer check for and handle zero-length transfers instead of the underlying drivers. --- sys/dev/aac/aac_disk.c | 7 ------- sys/dev/amr/amr_disk.c | 4 ---- sys/dev/ata/ata-disk.c | 7 ------- sys/dev/ata/ata-raid.c | 7 ------- sys/dev/ata/atapi-fd.c | 7 ------- sys/dev/ida/ida_disk.c | 6 ------ sys/dev/mlx/mlx_disk.c | 4 ---- sys/dev/twe/twe_freebsd.c | 8 -------- sys/kern/subr_disk.c | 6 ++++++ 9 files changed, 6 insertions(+), 50 deletions(-) diff --git a/sys/dev/aac/aac_disk.c b/sys/dev/aac/aac_disk.c index 09bd9716445b..564f79e42bf2 100644 --- a/sys/dev/aac/aac_disk.c +++ b/sys/dev/aac/aac_disk.c @@ -168,13 +168,6 @@ aac_disk_strategy(struct bio *bp) return; } - /* do-nothing operation? */ - if (bp->bio_bcount == 0) { - bp->bio_resid = bp->bio_bcount; - biodone(bp); - return; - } - /* perform accounting */ devstat_start_transaction(&sc->ad_stats); diff --git a/sys/dev/amr/amr_disk.c b/sys/dev/amr/amr_disk.c index f846043bbc97..de703fe03dda 100644 --- a/sys/dev/amr/amr_disk.c +++ b/sys/dev/amr/amr_disk.c @@ -165,10 +165,6 @@ amrd_strategy(struct bio *bio) goto bad; } - /* do-nothing operation */ - if (bio->bio_bcount == 0) - goto done; - devstat_start_transaction(&sc->amrd_stats); amr_submit_bio(sc->amrd_controller, bio); return; diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index 6d449582fa74..d4a2b9c0831a 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -269,13 +269,6 @@ adstrategy(struct bio *bp) return; } - /* if it's a null transfer, return immediatly. */ - if (bp->bio_bcount == 0) { - bp->bio_resid = 0; - biodone(bp); - return; - } - s = splbio(); bioqdisksort(&adp->queue, bp); ata_start(adp->controller); diff --git a/sys/dev/ata/ata-raid.c b/sys/dev/ata/ata-raid.c index 30cbd7643342..546b9986f8d1 100644 --- a/sys/dev/ata/ata-raid.c +++ b/sys/dev/ata/ata-raid.c @@ -158,13 +158,6 @@ arstrategy(struct bio *bp) int lba, count, chunk; caddr_t data; - /* if it's a null transfer, return immediatly. */ - if (bp->bio_bcount == 0) { - bp->bio_resid = 0; - biodone(bp); - return; - } - bp->bio_resid = bp->bio_bcount; lba = bp->bio_pblkno; data = bp->bio_data; diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index a831ff409e7d..a419d2b1353d 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -307,13 +307,6 @@ afdstrategy(struct bio *bp) return; } - /* if it's a null transfer, return immediatly. */ - if (bp->bio_bcount == 0) { - bp->bio_resid = 0; - biodone(bp); - return; - } - s = splbio(); bioqdisksort(&fdp->queue, bp); ata_start(fdp->atp->controller); diff --git a/sys/dev/ida/ida_disk.c b/sys/dev/ida/ida_disk.c index 99251efc8232..4bf662c25786 100644 --- a/sys/dev/ida/ida_disk.c +++ b/sys/dev/ida/ida_disk.c @@ -169,12 +169,6 @@ idad_strategy(struct bio *bp) goto bad; } - /* - * If it's a null transfer, return immediately - */ - if (bp->bio_bcount == 0) - goto done; - bp->bio_driver1 = drv; s = splbio(); devstat_start_transaction(&drv->stats); diff --git a/sys/dev/mlx/mlx_disk.c b/sys/dev/mlx/mlx_disk.c index 18698c2cffd8..b372247d313e 100644 --- a/sys/dev/mlx/mlx_disk.c +++ b/sys/dev/mlx/mlx_disk.c @@ -179,10 +179,6 @@ mlxd_strategy(struct bio *bp) goto bad; } - /* do-nothing operation */ - if (bp->bio_bcount == 0) - goto done; - devstat_start_transaction(&sc->mlxd_stats); mlx_submit_buf(sc->mlxd_controller, bp); return; diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c index 15c55744be21..677e7af82a33 100644 --- a/sys/dev/twe/twe_freebsd.c +++ b/sys/dev/twe/twe_freebsd.c @@ -668,14 +668,6 @@ twed_strategy(twe_bio *bp) return; } - /* do-nothing operation? */ - if (TWE_BIO_LENGTH(bp) == 0) { - TWE_BIO_RESID(bp) = 0; - TWE_BIO_DONE(bp); - TWED_BIO_OUT; - return; - } - /* perform accounting */ TWE_BIO_STATS_START(bp); diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index b4932cbf766e..aaa28c8dac6e 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -309,6 +309,12 @@ diskstrategy(struct bio *bp) return; } + if (bp->bio_bcount == 0) { + bp->bio_resid = 0; + biodone(bp); + return; + } + KASSERT(dp->d_devsw != NULL, ("NULL devsw")); KASSERT(dp->d_devsw->d_strategy != NULL, ("NULL d_strategy")); dp->d_devsw->d_strategy(bp);