From:	CSBVAX::CSBVAX::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 25-MAR-1989 18:54
To:	MRGATE::"ARISIA::EVERHART"
Subj:	V5 BACKUP and tape drive caching


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Sat, 25 MAR 89 15:32:14 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Sat, 25 Mar 89 15:19:36 PST
Received: by ucbvax.Berkeley.EDU (5.61/1.36)
	id AA09488; Sat, 25 Mar 89 14:56:33 -0800
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 25 Mar 89 22:33:57 GMT
From: quanta.eng.ohio-state.edu!kcgl1.eng.ohio-state.edu!JONESD@tut.cis.ohio-state.edu  (David Jones)
Organization: Ohio State University
Subject: V5 BACKUP and tape drive caching
Message-Id: <1801@quanta.eng.ohio-state.edu>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

I was dismayed to find the reports that VMS V5 BACKUP disabled the tape drive
writeback cache were true.  Since at least 95% of our tape drive use is via the
backup utility, the V5 upgrade effectively turned our TU81+ into an expensive
TU81.  I discovered, though, that if you explicitly mount the first tape with
caching, it remains enabled until the next volume in the save set is mounted.
The problem, therefore, seemed to be in the MOUNT requests issued by BACKUP.

Lacking fiche, I resorted to invoking BACKUP with the debugger and trapping
the calls to SYS$MOUNT to determine what mounts flags were being specified.
I found that the mount flags for a mount for read from the TU81+ were FOREIGN,
MESSAGE, and NOCACHE while the flags for mount for write were FOREIGN, MESSAGE,
NOCACHE, and TAPE_DATA_WRITE.  The description in the system services manual
says that MNT$M_TAPE_DATA_WRITE *enables* the writeback cache.  Obviously,
the cache enable was being overridden by the MNT$M_NOCACHE flag.  The
description for MNT$M_NOCACHE, however, states explicitly that this flag
applies only to disks.

Going by what $MOUNT does and not what it claims to do, I wrote a patch to
BACKUP that gives me back my cache.  At a point after the flags field is built,
it checks the state of MNT$M_TAPE_DATA_WRITE and if set clears the MNT$V_NOCACHE
bit.  I'm including below a command procedure that will patch the BACKUP image
in the event that you'd trust any backups made by it.  The patched BACKUP has
the interesting characteristic that now it always enables the writeback cache
rather than always disabling it.

--------------------------------------------------------------------------------
$! Apply patch to backup image to fixed image.
$ VMS_VERSION = F$EDIT(F$GETSYI("VERSION"),"TRIM")
$!
$ IF VMS_VERSION .EQS. "V5.1-B"
$ THEN
$    PATCH BACKUP.EXE
     INSERT/INSTRUCTION 10A05 = 'MOVL #00040004, B^74(SP)'
     'BBC #15, B^04(SP), SKIP'       ! test bit MNT$V_TAPE_DATA_WRITE
     'BICL #00020000, B^04(SP)'      ! if set, clear MNT$M_NOCACHE
     'SKIP: NOP'
     EXIT
     UPDATE
$!
$ ELSE		! 5.0-2, 5.1, maybe 5.0 and 5.0-1
$    PATCH BACKUP.EXE
     INSERT/INSTRUCTION 109F5 = 'MOVL #00040004, B^74(SP)'
     'BBC #15, B^04(SP), SKIP'       ! test bit MNT$V_TAPE_DATA_WRITE
     'BICL #00020000, B^04(SP)'      ! if set, clear MNT$M_NOCACHE
     'SKIP: NOP'
     EXIT
     UPDATE
$!
$ ENDIF
$ EXIT
--------------------------------------------------------------------------------

David L. Jones               |      Phone:    (614) 292-6929
Ohio State Unviversity       |      Internet:
1971 Neil Ave. Rm. 406       |               jonesd@kcgl1.eng.ohio-state.edu
Columbus, OH 43210           |               jones-d@eng.ohio-state.edu

Disclaimer: A repudiation of a claim.

