Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Dec 1998 09:09:52 -0700
From:      Tim Jones <tjones@estinc.com>
To:        "Jordan K. Hubbard" <jkh@zippy.cdrom.com>
Cc:        Matt Jacob <mjacob@FreeBSD.ORG>, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/sys mtio.h
Message-ID:  <367A7E50.B0F5AA3B@estinc.com>
References:  <82280.913951353@zippy.cdrom.com>

next in thread | previous in thread | raw e-mail | index | archive | help
"Jordan K. Hubbard" wrote:
> 
> Speaking of which, the folks who make BRU were recently asking for a
> linux-compatible ioctl which would allow them to set the tape to a
> specific LBA without reading data.  This is to allow fast-indexing of
> backups.  Would anyone at Enhanced Software Technologies (cc'd) care
> to comment on this?  If we had a more detailed spec (I don't have
> access to any Linux machines at the moment), it would certainly go a
> long ways towards getting it implemented for them.
> 
> - Jordan
> 
> > mjacob      1998/12/17 11:26:49 PST
> >
> >   Modified files:
> >     sys/sys              mtio.h
> >   Log:
> >   import logical/hardware block locate ioctls from NetBSD
> >
> >   Revision  Changes    Path
> >   1.12      +11 -1     src/sys/sys/mtio.h

Thanks, Jordon.

So that everyone understands, the next version of BRu for Linux will
offer Quick File Access.  This means that the user can say "Restore
mydatafile.dbf" and BRU will fast forward the tape to the appropriate
logical block address and restore the file.  This means a file 2GB deep
on a DAT tape will restore in 30 seconds, instead of 45 minutes.

To implement this, BRU needs to be able to ask the drive WHERE it is
(logical block address) and tell the drive to move, using fast seek mode
(200x read on a DAT or AIT drive), to that location.  Under LINUX, we
have two ioctls and appropriate macro defines in mtio.h that enable
this.  Here is my code to perform this operation (basically taken from
the st-mt-0.5 package):

---------------------------------------------------------------
/*
 * QFA_seek - perform a quick file access seek
 *
 * This is experimental and currently only works under Linux
 *
 */
long QFA_seek( long tapeblk )
{
    struct mtop mt_com;

    mt_com.mt_op = MTSEEK;
    mt_com.mt_count = tapeblk;
    if (rmtioctl (afile.fildes, MTIOCTOP, &mt_com) < 0) {
        /* the MTSEEK failed, so turn off QFA */
        flags.QCflag = !flags.QCflag;
    } else {
        DBUG_RETURN(TRUE);
    }
}

long QFA_tell( void )
{
  struct mtop control;
  struct mtpos getblkno;

  control.mt_op = MTTELL;
  if(rmtioctl(afile.fildes, MTIOCTOP, &control) == -1)
    {
      if (rmtioctl(afile.fildes, MTIOCPOS , &getblkno) == -1) {
        /* the MTTELL failed, so turn off QFA */
        flags.QCflag = !flags.QCflag;
      } else {
        return (long)getblkno.mt_blkno;
      }
    } else {
      return (long)control.mt_count;
    }
}
-----------------------------------------------------------------------

It's not necessary fopr me to use this code explicitly under FreeBSD,
just something similar that performs the same operations.

I'm attaching the usr/include/linux/mtio.h file frokm the 2.0.35 kernel
tree for your viewing pleasure.

Please don't hesitate to contact me if there's something in FreeBSD that
I've missed, or if there are other questions about what we're asking. 
We really want to provide the same level of support in BRU for FreeBSD
that we provide under Linux.

Happy holidays to all.

-- 
Tim Jones				tjones@estinc.com
Vice President				Visit our tape backup web pages:
Enhanced Software Technologies, Inc.	http://www.estinc.com/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?367A7E50.B0F5AA3B>