svn commit: r187227 - in user/luigi/geom_sched/sys: conf dev/ata
geom
Luigi Rizzo
luigi at FreeBSD.org
Wed Jan 14 09:25:29 PST 2009
Author: luigi
Date: Wed Jan 14 17:25:28 2009
New Revision: 187227
URL: http://svn.freebsd.org/changeset/base/187227
Log:
revert the changes for the in-driver scheduler.
They are not used now and interfere with debugging
of the other code.
Modified:
user/luigi/geom_sched/sys/conf/files
user/luigi/geom_sched/sys/dev/ata/ata-all.h
user/luigi/geom_sched/sys/dev/ata/ata-disk.c
user/luigi/geom_sched/sys/dev/ata/ata-queue.c
user/luigi/geom_sched/sys/geom/geom_disk.c
user/luigi/geom_sched/sys/geom/geom_disk.h
user/luigi/geom_sched/sys/geom/geom_io.c
Modified: user/luigi/geom_sched/sys/conf/files
==============================================================================
--- user/luigi/geom_sched/sys/conf/files Wed Jan 14 16:27:04 2009 (r187226)
+++ user/luigi/geom_sched/sys/conf/files Wed Jan 14 17:25:28 2009 (r187227)
@@ -1283,7 +1283,7 @@ geom/geom_mbr_enc.c optional geom_mbr
geom/geom_pc98.c optional geom_pc98
geom/geom_pc98_enc.c optional geom_pc98
geom/geom_slice.c standard
-geom/geom_sched.c standard
+# geom/geom_sched.c standard
geom/geom_subr.c standard
geom/geom_sunlabel.c optional geom_sunlabel
geom/geom_sunlabel_enc.c optional geom_sunlabel
Modified: user/luigi/geom_sched/sys/dev/ata/ata-all.h
==============================================================================
--- user/luigi/geom_sched/sys/dev/ata/ata-all.h Wed Jan 14 16:27:04 2009 (r187226)
+++ user/luigi/geom_sched/sys/dev/ata/ata-all.h Wed Jan 14 17:25:28 2009 (r187227)
@@ -510,7 +510,6 @@ struct ata_channel {
TAILQ_HEAD(, ata_request) ata_queue; /* head of ATA queue */
struct ata_request *freezepoint; /* composite freezepoint */
struct ata_request *running; /* currently running request */
- struct disk *disks[2]; /* disks, if any */
};
/* disk bay/enclosure related */
@@ -547,9 +546,6 @@ int ata_wmode(struct ata_params *ap);
int ata_umode(struct ata_params *ap);
int ata_limit_mode(device_t dev, int mode, int maxmode);
-/* ata-disk.c */
-struct ata_request *ata_create_request(struct bio *bp, int full);
-
/* ata-queue.c: */
int ata_controlcmd(device_t dev, u_int8_t command, u_int16_t feature, u_int64_t lba, u_int16_t count);
int ata_atapicmd(device_t dev, u_int8_t *ccb, caddr_t data, int count, int flags, int timeout);
Modified: user/luigi/geom_sched/sys/dev/ata/ata-disk.c
==============================================================================
--- user/luigi/geom_sched/sys/dev/ata/ata-disk.c Wed Jan 14 16:27:04 2009 (r187226)
+++ user/luigi/geom_sched/sys/dev/ata/ata-disk.c Wed Jan 14 17:25:28 2009 (r187227)
@@ -60,7 +60,6 @@ static void ad_describe(device_t dev);
static int ad_version(u_int16_t);
static disk_strategy_t ad_strategy;
static disk_ioctl_t ad_ioctl;
-static disk_kick_t ad_kick;
static dumper_t ad_dump;
/*
@@ -149,7 +148,6 @@ ad_attach(device_t dev)
adp->disk = disk_alloc();
adp->disk->d_strategy = ad_strategy;
adp->disk->d_ioctl = ad_ioctl;
- adp->disk->d_kick = ad_kick;
adp->disk->d_dump = ad_dump;
adp->disk->d_name = "ad";
adp->disk->d_drv1 = dev;
@@ -170,7 +168,6 @@ ad_attach(device_t dev)
snprintf(adp->disk->d_ident, sizeof(adp->disk->d_ident), "ad:%s",
atadev->param.serial);
disk_create(adp->disk, DISK_VERSION);
- ch->disks[atadev->unit == ATA_SLAVE] = adp->disk;
device_add_child(dev, "subdisk", device_get_unit(dev));
ad_firmware_geom_adjust(dev, adp->disk);
bus_generic_attach(dev);
@@ -182,7 +179,6 @@ ad_attach(device_t dev)
static int
ad_detach(device_t dev)
{
- struct ata_channel *ch = device_get_softc(device_get_parent(dev));
struct ad_softc *adp = device_get_ivars(dev);
struct ata_device *atadev = device_get_softc(dev);
device_t *children;
@@ -203,8 +199,6 @@ ad_detach(device_t dev)
free(children, M_TEMP);
}
- ch->disks[atadev->unit == ATA_SLAVE] = NULL;
-
/* detroy disk from the system so we dont get any further requests */
disk_destroy(adp->disk);
@@ -272,13 +266,13 @@ ad_spindown(void *priv)
ata_queue_request(request);
}
-struct ata_request *
-ata_create_request(struct bio *bp, int full)
+
+static void
+ad_strategy(struct bio *bp)
{
- device_t dev = bp->bio_disk->d_drv1;
+ device_t dev = bp->bio_disk->d_drv1;
struct ata_device *atadev = device_get_softc(dev);
struct ata_request *request;
- struct ata_channel *ch;
if (atadev->spindown != 0)
callout_reset(&atadev->spindown_timer, hz * atadev->spindown,
@@ -287,7 +281,7 @@ ata_create_request(struct bio *bp, int f
if (!(request = ata_alloc_request())) {
device_printf(dev, "FAILURE - out of memory in start\n");
biofinish(bp, NULL, ENOMEM);
- return NULL;
+ return;
}
/* setup request */
@@ -350,32 +344,10 @@ ata_create_request(struct bio *bp, int f
device_printf(dev, "FAILURE - unknown BIO operation\n");
ata_free_request(request);
biofinish(bp, NULL, EIO);
- return NULL;
+ return;
}
request->flags |= ATA_R_ORDERED;
-
- if (full != 0) {
- if ((request->parent = device_get_parent(dev)) == NULL) {
- ata_free_request(request);
- biofinish(bp, NULL, ENXIO);
- return NULL;
- }
-
- ch = device_get_softc(request->parent);
- callout_init_mtx(&request->callout, &ch->state_mtx,
- CALLOUT_RETURNUNLOCKED);
- }
-
- return request;
-}
-
-static void
-ad_strategy(struct bio *bp)
-{
- struct ata_request *request;
-
- if ((request = ata_create_request(bp, 0)) != NULL)
- ata_queue_request(request);
+ ata_queue_request(request);
}
static void
@@ -397,18 +369,6 @@ ad_ioctl(struct disk *disk, u_long cmd,
return ata_device_ioctl(disk->d_drv1, cmd, data);
}
-static void
-ad_kick(struct disk *disk)
-{
- device_t dev;
- struct ata_channel *ch;
-
- dev = disk->d_drv1;
- ch = device_get_softc(device_get_parent(dev));
- if (ch != NULL)
- ata_start(ch->dev);
-}
-
static int
ad_dump(void *arg, void *virtual, vm_offset_t physical,
off_t offset, size_t length)
Modified: user/luigi/geom_sched/sys/dev/ata/ata-queue.c
==============================================================================
--- user/luigi/geom_sched/sys/dev/ata/ata-queue.c Wed Jan 14 16:27:04 2009 (r187226)
+++ user/luigi/geom_sched/sys/dev/ata/ata-queue.c Wed Jan 14 17:25:28 2009 (r187227)
@@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
#include <sys/rman.h>
#include <dev/ata/ata-all.h>
#include <ata_if.h>
-#include <geom/geom_sched.h>
/* prototypes */
static void ata_completed(void *, int);
@@ -172,25 +171,10 @@ ata_start(device_t dev)
struct ata_channel *ch = device_get_softc(dev);
struct ata_request *request;
struct ata_composite *cptr;
- struct disk *dp;
- struct bio *bp;
- int dependencies = 0, i;
-
- mtx_lock(&ch->queue_mtx);
- if (TAILQ_FIRST(&ch->ata_queue) == NULL) {
- for (i = 0; i < 2; i++) {
- dp = ch->disks[i];
- while (dp != NULL && (bp = g_sched_next(dp)) != NULL) {
- request = ata_create_request(bp, 1);
- if (request != NULL) {
- ata_sort_queue(ch, request);
- break;
- }
- }
- }
- }
+ int dependencies = 0;
/* if we have a request on the queue try to get it running */
+ mtx_lock(&ch->queue_mtx);
if ((request = TAILQ_FIRST(&ch->ata_queue))) {
/* we need the locking function to get the lock for this channel */
Modified: user/luigi/geom_sched/sys/geom/geom_disk.c
==============================================================================
--- user/luigi/geom_sched/sys/geom/geom_disk.c Wed Jan 14 16:27:04 2009 (r187226)
+++ user/luigi/geom_sched/sys/geom/geom_disk.c Wed Jan 14 17:25:28 2009 (r187227)
@@ -55,11 +55,9 @@ __FBSDID("$FreeBSD$");
#include <geom/geom.h>
#include <geom/geom_disk.h>
#include <geom/geom_int.h>
-#include <geom/geom_sched.h>
static struct mtx g_disk_done_mtx;
-static g_ctl_req_t g_disk_ctlreq;
static g_access_t g_disk_access;
static g_init_t g_disk_init;
static g_fini_t g_disk_fini;
@@ -70,7 +68,6 @@ static g_dumpconf_t g_disk_dumpconf;
static struct g_class g_disk_class = {
.name = "DISK",
.version = G_VERSION,
- .ctlreq = g_disk_ctlreq,
.init = g_disk_init,
.fini = g_disk_fini,
.start = g_disk_start,
@@ -84,19 +81,16 @@ g_disk_init(struct g_class *mp __unused)
{
mtx_init(&g_disk_done_mtx, "g_disk_done", NULL, MTX_DEF);
- g_sched_init();
}
static void
g_disk_fini(struct g_class *mp __unused)
{
- g_sched_fini();
mtx_destroy(&g_disk_done_mtx);
}
DECLARE_GEOM_CLASS(g_disk_class, g_disk);
-MODULE_VERSION(g_disk, 0);
static void __inline
g_disk_lock_giant(struct disk *dp)
@@ -112,83 +106,6 @@ g_disk_unlock_giant(struct disk *dp)
mtx_unlock(&Giant);
}
-static void
-g_disk_configure(struct gctl_req *req, struct g_class *mp)
-{
- struct disk *dp;
- struct g_provider *pp;
- const char *sched, *name;
- char param[16];
- int i, *nargs;
-
- g_topology_assert();
-
- nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs));
- if (nargs == NULL) {
- gctl_error(req, "No '%s' argument.", "nargs");
- return;
- }
-
- if (*nargs <= 0) {
- gctl_error(req, "Missing devices.");
- return;
- }
-
- sched = gctl_get_asciiparam(req, "iosched");
- if (sched == NULL) {
- gctl_error(req, "No '%s' argument.", "iosched");
- return;
- }
-
- for (i = 0; i < *nargs; i++) {
- snprintf(param, sizeof(param), "arg%d", i);
- name = gctl_get_asciiparam(req, param);
- if (name == NULL) {
- gctl_error(req, "No '%s' argument.", param);
- return;
- }
-
- if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
- name += strlen("/dev/");
-
- pp = g_provider_by_name(name);
- if (pp == NULL || pp->geom->class != mp) {
- gctl_error(req, "Provider %s is invalid.", name);
- return;
- }
-
- dp = pp->geom->softc;
- if (g_sched_configure(dp, sched) != 0) {
- gctl_error(req, "Could not set scheduler %s.", sched);
- return;
- }
- }
-}
-
-static void
-g_disk_ctlreq(struct gctl_req *req, struct g_class *mp, const char *verb)
-{
- uint32_t *version;
-
- g_topology_assert();
-
- version = gctl_get_paraml(req, "version", sizeof(*version));
- if (version == NULL) {
- gctl_error(req, "No '%s' argument.", "version");
- return;
- }
-
- if (*version != G_VERSION) {
- gctl_error(req, "Userland and kernel parts are out of sync.");
- return;
- }
-
- if (strcmp(verb, "configure") == 0)
- g_disk_configure(req, mp);
- else
- gctl_error(req, "Unknown verb.");
-}
-
static int
g_disk_access(struct g_provider *pp, int r, int w, int e)
{
@@ -281,8 +198,6 @@ g_disk_done(struct bio *bp)
mtx_lock(&g_disk_done_mtx);
bp->bio_completed = bp->bio_length - bp->bio_resid;
- g_sched_done(bp);
-
bp2 = bp->bio_parent;
if (bp2->bio_error == 0)
bp2->bio_error = bp->bio_error;
@@ -373,7 +288,7 @@ g_disk_start(struct bio *bp)
bp2->bio_disk = dp;
devstat_start_transaction_bio(dp->d_devstat, bp2);
g_disk_lock_giant(dp);
- g_sched_start(dp, bp2);
+ dp->d_strategy(bp2);
g_disk_unlock_giant(dp);
bp2 = bp3;
bp3 = NULL;
@@ -551,7 +466,6 @@ disk_create(struct disk *dp, int version
dp->d_sectorsize, DEVSTAT_ALL_SUPPORTED,
DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX);
dp->d_geom = NULL;
- g_sched_disk_init(dp);
g_disk_ident_adjust(dp->d_ident, sizeof(dp->d_ident));
g_post_event(g_disk_create, dp, M_WAITOK, dp, NULL);
}
@@ -562,7 +476,6 @@ disk_destroy(struct disk *dp)
g_cancel_event(dp);
dp->d_destroyed = 1;
- g_sched_disk_fini(dp);
if (dp->d_devstat != NULL)
devstat_remove_entry(dp->d_devstat);
g_post_event(g_disk_destroy, dp, M_WAITOK, NULL);
@@ -574,8 +487,6 @@ disk_gone(struct disk *dp)
struct g_geom *gp;
struct g_provider *pp;
- g_sched_disk_gone(dp);
-
gp = dp->d_geom;
if (gp != NULL)
LIST_FOREACH(pp, &gp->provider, provider)
Modified: user/luigi/geom_sched/sys/geom/geom_disk.h
==============================================================================
--- user/luigi/geom_sched/sys/geom/geom_disk.h Wed Jan 14 16:27:04 2009 (r187226)
+++ user/luigi/geom_sched/sys/geom/geom_disk.h Wed Jan 14 17:25:28 2009 (r187227)
@@ -53,10 +53,7 @@ typedef int disk_ioctl_t(struct disk *,
int fflag, struct thread *td);
/* NB: disk_ioctl_t SHALL be cast'able to d_ioctl_t */
-typedef void disk_kick_t(struct disk *);
-
struct g_geom;
-struct g_sched;
struct devstat;
struct disk {
@@ -77,7 +74,6 @@ struct disk {
disk_close_t *d_close;
disk_strategy_t *d_strategy;
disk_ioctl_t *d_ioctl;
- disk_kick_t *d_kick;
dumper_t *d_dump;
/* Info fields from driver to geom_disk.c. Valid when open */
@@ -90,13 +86,6 @@ struct disk {
u_int d_stripesize;
char d_ident[DISK_IDENT_SIZE];
- /* Scheduler fields */
- struct mtx d_sched_lock;
- u_int d_sched_flags;
- u_int d_nr_sorted;
- struct g_sched *d_sched;
- void *d_sched_data;
-
/* Fields private to the driver */
void *d_drv1;
};
Modified: user/luigi/geom_sched/sys/geom/geom_io.c
==============================================================================
--- user/luigi/geom_sched/sys/geom/geom_io.c Wed Jan 14 16:27:04 2009 (r187226)
+++ user/luigi/geom_sched/sys/geom/geom_io.c Wed Jan 14 17:25:28 2009 (r187227)
@@ -562,8 +562,8 @@ g_io_schedule_down(struct thread *tp __u
break;
}
THREAD_NO_SLEEPING();
- CTR4(KTR_GEOM, "g_down starting bp %p provider %s off %ld "
- "len %ld", bp, bp->bio_to->name, bp->bio_offset,
+ CTR4(KTR_GEOM, "g_down starting bp %p provider %s off %lld "
+ "len %lld", bp, bp->bio_to->name, bp->bio_offset,
bp->bio_length);
bp->bio_to->geom->start(bp);
THREAD_SLEEPING_OK();
@@ -610,7 +610,7 @@ g_io_schedule_up(struct thread *tp __unu
g_bioq_unlock(&g_bio_run_up);
THREAD_NO_SLEEPING();
CTR4(KTR_GEOM, "g_up biodone bp %p provider %s off "
- "%ld len %ld", bp, bp->bio_to->name,
+ "%lld len %lld", bp, bp->bio_to->name,
bp->bio_offset, bp->bio_length);
biodone(bp);
THREAD_SLEEPING_OK();
More information about the svn-src-user
mailing list