From owner-freebsd-scsi Wed Apr 28 13:51: 4 1999 Delivered-To: freebsd-scsi@freebsd.org Received: from feral.com (feral.com [192.67.166.1]) by hub.freebsd.org (Postfix) with ESMTP id 3591D14E36 for ; Wed, 28 Apr 1999 13:51:00 -0700 (PDT) (envelope-from mjacob@feral.com) Received: from feral.com (mjacob@feral.com [192.67.166.1]) by feral.com (8.8.7/8.8.7) with ESMTP id NAA26467; Wed, 28 Apr 1999 13:49:40 -0700 Date: Wed, 28 Apr 1999 13:49:38 -0700 (PWT) From: Matthew Jacob Reply-To: mjacob@feral.com To: Joerg Wunsch Cc: freebsd-scsi@FreeBSD.ORG Subject: Re: QIC tape problems on -stable (was: hanging `tar xfvR /dev/nrst0' process, can i debug it?) In-Reply-To: <19990428214609.07248@uriah.heep.sax.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > > ...this hunk failed to patch (and manually patching it this way > yielded a `softc might be used unitiniatilized' warning, so i figure > your source was a little different). Yes, I'm off of -current. > > Well, there are still some superfluous WRITE FILEMARKS, nevertheless. > I played a little with `mt rdhpos' and `mt sethpos', and it seems the > `set' operations make the driver think anything had been written, so > it's also issuing the WRITE FILEMARKS command. This doesn't seem to > write any filemarks, indeed, as long as it happens after BOT, _but_ > issuing an `mt sethpos 1' _at_ BOT still erases the tape then... Is > there any reason why the driver sets the SA_FLAG_TAPE_WRITTEN flag for > just the `mt set*pos' operation? Oh- sorry- the same bloody patch applies to sasetpos too- this is what I get for doing this on the fly while working on 50 other projects (and answering this email through a clogged 144Kb DSL line because there's half a dozen dweebs getting the linux networker client from my site....).. static int sardpos(struct cam_periph *periph, int hard, u_int32_t *blkptr) { struct scsi_tape_position_data loc; union ccb *ccb; struct sa_softc *softc = (struct sa_softc *)periph->softc; int error = 0; /* * First flush any pending writes (if any had occurred). * Amazingly stupid drives sometimes take a zero count * and say "Duh! Zero must mean One!". */ if (softc->flags & SA_FLAG_TAPE_WRITTEN) error = sawritefilemarks(periph, 0, 0); /* * The latter case is for 'write protected' tapes * which are too stupid to recognize a zero count * for writing filemarks as a no-op. */ if (error != 0 && error != EACCES) return (error); ccb = cam_periph_getccb(periph, 1); scsi_read_position(&ccb->csio, 1, sadone, MSG_SIMPLE_Q_TAG, hard, &loc, SSD_FULL_SIZE, 5000); softc->dsreg = MTIO_DSREG_RBSY; error = cam_periph_runccb(ccb, saerror, 0, 0, &softc->device_stats); softc->dsreg = MTIO_DSREG_REST; if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) cam_release_devq(ccb->ccb_h.path, 0, 0, 0, 0); if (error == 0) { if (loc.flags & SA_RPOS_UNCERTAIN) { error = EINVAL; /* nothing is certain */ } else { *blkptr = scsi_4btoul(loc.firstblk); } } xpt_release_ccb(ccb); return (error); } static int sasetpos(struct cam_periph *periph, int hard, u_int32_t *blkptr) { union ccb *ccb; struct sa_softc *softc = (struct sa_softc *)periph->softc; int error = 0; /* * First flush any pending writes (if any had occurred). * Amazingly stupid drives sometimes take a zero count * and say "Duh! Zero must mean One!". */ if (softc->flags & SA_FLAG_TAPE_WRITTEN) error = sawritefilemarks(periph, 0, 0); /* * The latter case is for 'write protected' tapes * which are too stupid to recognize a zero count * for writing filemarks as a no-op. */ if (error != 0 && error != EACCES) return (error); softc = (struct sa_softc *)periph->softc; ccb = cam_periph_getccb(periph, 1); scsi_set_position(&ccb->csio, 1, sadone, MSG_SIMPLE_Q_TAG, hard, *blkptr, SSD_FULL_SIZE, 60 * 60 * 1000); softc->dsreg = MTIO_DSREG_POS; error = cam_periph_runccb(ccb, saerror, 0, 0, &softc->device_stats); softc->dsreg = MTIO_DSREG_REST; if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) cam_release_devq(ccb->ccb_h.path, 0, 0, 0, 0); xpt_release_ccb(ccb); /* * Note relative file && block number position now unknown (if * these things ever start being maintained in this driver). * * Do this for any kind of error (to be safe). */ softc->fileno = softc->blkno = (daddr_t) -1; return (error); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message