tech-kern archive

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

Re: [PATCH] GOP_ALLOC and fallocate for PUFFS



J. Hannken-Illjes <hannken%eis.cs.tu-bs.de@localhost> wrote:

> genfs_gop_write calls genfs_do_io which does "error = biowait(mbp);"
> near the end.  This will catch errors from VOP_STRATEGY.

I run the code below but VOP_PUTPAGES never return anything else than 0. 

int
puffs_gop_alloc(struct vnode *vp, off_t off, off_t len,
                int flags, kauth_cred_t cred)
{
        struct puffs_mount *pmp = MPTOPUFFSMP(vp->v_mount);
        off_t start, end;
        int pgo_flags = PGO_CLEANIT|PGO_SYNCIO|PGO_PASTEOF;
        int u_flags = PUFFS_UPDATESIZE|PUFFS_UPDATEMTIME|PUFFS_UPDATECTIME;
        int error;

        if (EXISTSOP(pmp, FALLOCATE)) {
                error = _puffs_vnop_fallocate(vp, off, len);
                goto out;
        }

        start = trunc_page(off);
        end = round_page(off + len);

        if (off + len > vp->v_size)
                uvm_vnp_setwritesize(vp, off + len);

        mutex_enter(vp->v_interlock);
        error = VOP_PUTPAGES(vp, start, end, pgo_flags);

        if (off + len > vp->v_size) {
                if (error == 0) {
                        uvm_vnp_setsize(vp, off + len);
                        puffs_updatenode(VPTOPP(vp), u_flags, vp->v_size);
                } else {
                        uvm_vnp_setwritesize(vp, vp->v_size);
                }
        }
out:
        return error;
}

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


Home | Main Index | Thread Index | Old Index