Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Dec 2014 14:52:12 +0530
From:      Shivaram Upadhyayula <shivaram.u@quadstor.com>
To:        freebsd-scsi@freebsd.org
Subject:   Tape block size greater than MAXPHYS
Message-ID:  <CAN-_EfxSk8nsoVLGi=Z4E-ejb6ynyCE1PHvNkpz0pWYo-PfqPg@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,

It seems that currently any tape reads/writes greater than MAXPHYS
will fail. For example

cpi->maxio = 256 * 1024; /* Controller max io size 256K */

root@quadstorvtl # dd if=/dev/zero of=/dev/sa0 bs=256k count=1
sa0.0: request size=262144 > si_iosize_max=131072; cannot split request
sa0.0: request size=262144 > MAXPHYS=131072; cannot split request
dd: /dev/sa0: File too large
1+0 records in
0+0 records out
0 bytes transferred in 0.000390 secs (0 bytes/sec)

The first limitation comes from sys/cam/scsi/scsi_sa.c:saregister
        /*
         * If maxio isn't set, we fall back to DFLTPHYS.  Otherwise we take
         * the smaller of cpi.maxio or MAXPHYS.
         */
        if (cpi.maxio == 0)
                softc->maxio = DFLTPHYS;
        else if (cpi.maxio > MAXPHYS)
                softc->maxio = MAXPHYS;
        else
                softc->maxio = cpi.maxio;

softc limits maxio to MAXPHYS even if the controller supports a higher
maxio value. I tried removing the limitation which then led me to
reason for the actual reason for the limiation in
sys/kern/kern_physio.c:physio

        /*
         * If the driver does not want I/O to be split, that means that we
         * need to reject any requests that will not fit into one buffer.
         */
        if (dev->si_flags & SI_NOSPLIT &&
            (uio->uio_resid > dev->si_iosize_max || uio->uio_resid > MAXPHYS ||
            uio->uio_iovcnt > 1)) {

To maintain consistency of the block numbers SI_NOSPLIT has to be set,
but then to issue the entire request in a single bio the request size
will be limited to MAXPHYS.

Would is be correct to assume that the only way to increase the tape
block size for writes/reads is to increase MAXPHYS and recompile the
kernel ? (As of now on FreeBSD 10.1)

Regards,
Shivaram



-- 
QUADStor Open Source Storage Virtualization : Thin Provisioning, Data
Deduplication, VAAI, High Availability, Virtual Tape Library
http://www.quadstor.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAN-_EfxSk8nsoVLGi=Z4E-ejb6ynyCE1PHvNkpz0pWYo-PfqPg>