aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2005-02-05 00:30:08 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2005-02-05 00:30:08 +0000
commit662a4e5878e9a5f6f9f535dce33c6427d33e9bf7 (patch)
tree564a345fefc45dd2c4cec575a767eecadf0e8989 /sys
parenta436589ae27f8b098fef4054b16fada768b1a897 (diff)
downloadsrc-662a4e5878e9a5f6f9f535dce33c6427d33e9bf7.tar.gz
src-662a4e5878e9a5f6f9f535dce33c6427d33e9bf7.zip
- Use bioq_insert_tail()/bioq_insert_head() instead of bioq_disksort().
- Improve mediasize checking. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=141312
Diffstat (limited to 'sys')
-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 bcd3cfbfce59..64aa9066d83b 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 {