tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ubc_uiomove returns EINVAL



Hi

I am working on PUFFS page cache write-once: before entering data in the
page cache, we must make sure the backend storage is available,
otherwise we will not be able to flush the cache later. Flush may fail
because of EDQUOT or ENOSPC, which lets processes stuck in DE state
(exiting, disk I/O in progress).

The idea is that when file grows, or if file is known to be sparse
(because its allocated block size is lower than its size), then before
entering data in cache, we first read from the file and rewrite to make
sure backend is allocated. I do it using ubc_uiomove, but it always
returns me EINVAL. What did I do wrong?

/* sample value: off = 0xa0000, len = 0x20000 */

        zbuf = kmem_alloc(len, KM_SLEEP);
       
        iov.iov_base = zbuf;
        iov.iov_len = len;
       
        UIO_SETUP_SYSSPACE(&uio);
        uio.uio_iov = &iov;
        uio.uio_iovcnt = 1;
        uio.uio_offset = off;
        uio.uio_resid = len;
        uio.uio_rw = UIO_READ;
       
        error = ubc_uiomove(&vp->v_uobj, &uio, len,
                            UVM_ADV_SEQUENTIAL,
                            UBC_READ|UBC_UNMAP_FLAG(vp));


-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index