Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ata Limit wd(4) transfers to 128 (512-byte) logical ...
details: https://anonhg.NetBSD.org/src/rev/a9a729b332f5
branches: trunk
changeset: 770134:a9a729b332f5
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Wed Oct 05 03:40:18 2011 +0000
description:
Limit wd(4) transfers to 128 (512-byte) logical sectors, as the traditional
MAXPHYS value has for at least the past decade.
There are issues in wd(4) and possibly in host adapter drivers that need
work before this should be raised.
diffstat:
sys/dev/ata/wd.c | 26 +++++++++++++++++++-------
1 files changed, 19 insertions(+), 7 deletions(-)
diffs (87 lines):
diff -r 5833cd001370 -r a9a729b332f5 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c Wed Oct 05 01:53:03 2011 +0000
+++ b/sys/dev/ata/wd.c Wed Oct 05 03:40:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wd.c,v 1.387 2011/07/30 04:42:03 jakllsch Exp $ */
+/* $NetBSD: wd.c,v 1.388 2011/10/05 03:40:18 jakllsch Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.387 2011/07/30 04:42:03 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.388 2011/10/05 03:40:18 jakllsch Exp $");
#include "opt_ata.h"
@@ -125,6 +125,8 @@
int wdprint(void *, char *);
void wdperror(const struct wd_softc *);
+static void wdminphys(struct buf *);
+
static int wdlastclose(device_t);
static bool wd_suspend(device_t, const pmf_qual_t *);
static int wd_standby(struct wd_softc *, int);
@@ -185,7 +187,7 @@
int wd_getcache(struct wd_softc *, int *);
int wd_setcache(struct wd_softc *, int);
-struct dkdriver wddkdriver = { wdstrategy, minphys };
+struct dkdriver wddkdriver = { wdstrategy, wdminphys };
#ifdef HAS_BAD144_HANDLING
static void bad144intern(struct wd_softc *);
@@ -849,12 +851,22 @@
splx(s);
}
+static void
+wdminphys(struct buf *bp)
+{
+
+ if (bp->b_bcount > (512 * 128)) {
+ bp->b_bcount = (512 * 128);
+ }
+ minphys(bp);
+}
+
int
wdread(dev_t dev, struct uio *uio, int flags)
{
ATADEBUG_PRINT(("wdread\n"), DEBUG_XFERS);
- return (physio(wdstrategy, NULL, dev, B_READ, minphys, uio));
+ return (physio(wdstrategy, NULL, dev, B_READ, wdminphys, uio));
}
int
@@ -862,7 +874,7 @@
{
ATADEBUG_PRINT(("wdwrite\n"), DEBUG_XFERS);
- return (physio(wdstrategy, NULL, dev, B_WRITE, minphys, uio));
+ return (physio(wdstrategy, NULL, dev, B_WRITE, wdminphys, uio));
}
int
@@ -1349,7 +1361,7 @@
auio.uio_offset =
fop->df_startblk * wd->sc_dk.dk_label->d_secsize;
auio.uio_vmspace = l->l_proc->p_vmspace;
- error = physio(wdformat, NULL, dev, B_WRITE, minphys,
+ error = physio(wdformat, NULL, dev, B_WRITE, wdminphys,
&auio);
fop->df_count -= auio.uio_resid;
fop->df_reg[0] = wdc->sc_status;
@@ -1405,7 +1417,7 @@
(atareq->flags & ATACMD_READ) ? B_READ : B_WRITE;
error1 = physio(wdioctlstrategy, &wi->wi_bp, dev,
(atareq->flags & ATACMD_READ) ? B_READ : B_WRITE,
- minphys, &wi->wi_uio);
+ wdminphys, &wi->wi_uio);
if (tbuf != NULL && error1 == 0) {
error1 = copyout(tbuf, atareq->databuf,
atareq->datalen);
Home |
Main Index |
Thread Index |
Old Index