summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2005-02-05 00:30:08 +0000
committerpjd <pjd@FreeBSD.org>2005-02-05 00:30:08 +0000
commite4c6b83cfd9d5d82f147b7ce2d61530cb03303db (patch)
tree564a345fefc45dd2c4cec575a767eecadf0e8989
parent93f2cf1fa1459bb83a37c8743d853922ea528427 (diff)
downloadFreeBSD-src-e4c6b83cfd9d5d82f147b7ce2d61530cb03303db.zip
FreeBSD-src-e4c6b83cfd9d5d82f147b7ce2d61530cb03303db.tar.gz
- Use bioq_insert_tail()/bioq_insert_head() instead of bioq_disksort().
- Improve mediasize checking. MFC after: 1 week
-rw-r--r--sys/geom/gate/g_gate.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/geom/gate/g_gate.c b/sys/geom/gate/g_gate.c
index bcd3cfb..64aa906 100644
--- a/sys/geom/gate/g_gate.c
+++ b/sys/geom/gate/g_gate.c
@@ -226,7 +226,7 @@ g_gate_start(struct bio *bp)
sc->sc_seq++;
mtx_lock(&sc->sc_inqueue_mtx);
- bioq_disksort(&sc->sc_inqueue, bp);
+ bioq_insert_tail(&sc->sc_inqueue, bp);
wakeup(sc);
mtx_unlock(&sc->sc_inqueue_mtx);
}
@@ -385,6 +385,10 @@ g_gate_create(struct g_gate_ctl_create *ggio)
G_GATE_DEBUG(1, "Invalid sector size.");
return (EINVAL);
}
+ if ((ggio->gctl_mediasize % ggio->gctl_sectorsize) != 0) {
+ G_GATE_DEBUG(1, "Invalid media size.");
+ return (EINVAL);
+ }
if ((ggio->gctl_flags & G_GATE_FLAG_READONLY) != 0 &&
(ggio->gctl_flags & G_GATE_FLAG_WRITEONLY) != 0) {
G_GATE_DEBUG(1, "Invalid flags.");
@@ -536,7 +540,7 @@ g_gate_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct threa
bp->bio_length);
if (error != 0) {
mtx_lock(&sc->sc_inqueue_mtx);
- bioq_disksort(&sc->sc_inqueue, bp);
+ bioq_insert_head(&sc->sc_inqueue, bp);
mtx_unlock(&sc->sc_inqueue_mtx);
g_gate_release(sc);
return (error);
@@ -580,7 +584,7 @@ g_gate_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct threa
G_GATE_LOGREQ(1, bp, "Request desisted.");
atomic_add_acq_32(&sc->sc_queue_count, 1);
mtx_lock(&sc->sc_inqueue_mtx);
- bioq_disksort(&sc->sc_inqueue, bp);
+ bioq_insert_head(&sc->sc_inqueue, bp);
wakeup(sc);
mtx_unlock(&sc->sc_inqueue_mtx);
} else {
OpenPOWER on IntegriCloud